| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CellBIS::SQL::Abstract::Test::Table; |
|
2
|
|
|
|
|
|
|
$CellBIS::SQL::Abstract::Test::Table::VERSION = '1.5'; |
|
3
|
4
|
|
|
4
|
|
26
|
use Mojo::Base -base; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
57
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has 'users'; |
|
6
|
|
|
|
|
|
|
has 'roles'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
1
|
|
|
1
|
1
|
9
|
my $self = shift->SUPER::new(@_); |
|
10
|
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
7
|
my $table_users = __PACKAGE__ . '::_users'; |
|
12
|
1
|
|
|
|
|
2
|
my $table_roles = __PACKAGE__ . '::_roles'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
8
|
$self->{users} = $table_users->new; |
|
15
|
1
|
|
|
|
|
14
|
$self->{roles} = $table_roles->new; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
10
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package CellBIS::SQL::Abstract::Test::Table::_users; |
|
21
|
|
|
|
|
|
|
$CellBIS::SQL::Abstract::Test::Table::_users::VERSION = '1.5'; |
|
22
|
4
|
|
|
4
|
|
1178
|
use Mojo::Base -base; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
17
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Table fields |
|
25
|
|
|
|
|
|
|
has table_name => 'users'; |
|
26
|
|
|
|
|
|
|
has id => 'id_users'; |
|
27
|
|
|
|
|
|
|
has id_roles => 'roles_id'; |
|
28
|
|
|
|
|
|
|
has firstname => 'firstname'; |
|
29
|
|
|
|
|
|
|
has lastname => 'lastname'; |
|
30
|
|
|
|
|
|
|
has fullname => 'fullname'; |
|
31
|
|
|
|
|
|
|
has username => 'username'; |
|
32
|
|
|
|
|
|
|
has password => 'password'; |
|
33
|
|
|
|
|
|
|
has create => 'date_create'; |
|
34
|
|
|
|
|
|
|
has update => 'date_update'; |
|
35
|
|
|
|
|
|
|
has status => 'status'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub sqlite { |
|
38
|
2
|
|
|
2
|
|
22
|
my $self = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
return ( |
|
41
|
2
|
|
|
|
|
7
|
$self->table_name, |
|
42
|
|
|
|
|
|
|
[ |
|
43
|
|
|
|
|
|
|
$self->id, $self->id_roles, $self->firstname, $self->lastname, |
|
44
|
|
|
|
|
|
|
$self->fullname, $self->username, $self->password, $self->create, |
|
45
|
|
|
|
|
|
|
$self->update, $self->status |
|
46
|
|
|
|
|
|
|
], |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
|
|
|
|
|
|
$self->id => |
|
49
|
|
|
|
|
|
|
{type => {name => 'integer'}, is_primarykey => 1, is_autoincre => 1}, |
|
50
|
|
|
|
|
|
|
$self->id_roles => {type => {name => 'integer'}, is_null => 0}, |
|
51
|
|
|
|
|
|
|
$self->firstname => {type => {name => 'varchar', size => 50}}, |
|
52
|
|
|
|
|
|
|
$self->lastname => {type => {name => 'varchar', size => 50}}, |
|
53
|
|
|
|
|
|
|
$self->fullname => {type => {name => 'varchar', size => 100}}, |
|
54
|
|
|
|
|
|
|
$self->username => {type => {name => 'varchar', size => 60}}, |
|
55
|
|
|
|
|
|
|
$self->password => {type => {name => 'text'}}, |
|
56
|
|
|
|
|
|
|
$self->create => {type => {name => 'datetime'}}, |
|
57
|
|
|
|
|
|
|
$self->update => {type => {name => 'datetime'}}, |
|
58
|
|
|
|
|
|
|
$self->status => {type => {name => 'int', size => 1}} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub mariadb { |
|
64
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return ( |
|
67
|
0
|
|
|
|
|
0
|
$self->table_name, |
|
68
|
|
|
|
|
|
|
[ |
|
69
|
|
|
|
|
|
|
$self->id, $self->id_roles, $self->firstname, $self->lastname, |
|
70
|
|
|
|
|
|
|
$self->fullname, $self->username, $self->password, $self->create, |
|
71
|
|
|
|
|
|
|
$self->update, $self->status |
|
72
|
|
|
|
|
|
|
], |
|
73
|
|
|
|
|
|
|
{ |
|
74
|
|
|
|
|
|
|
$self->id => |
|
75
|
|
|
|
|
|
|
{type => {name => 'int'}, is_primarykey => 1, is_autoincre => 1}, |
|
76
|
|
|
|
|
|
|
$self->id_roles => {type => {name => 'int'}, is_null => 0}, |
|
77
|
|
|
|
|
|
|
$self->firstname => {type => {name => 'varchar', size => 50}}, |
|
78
|
|
|
|
|
|
|
$self->lastname => {type => {name => 'varchar', size => 50}}, |
|
79
|
|
|
|
|
|
|
$self->fullname => {type => {name => 'varchar', size => 100}}, |
|
80
|
|
|
|
|
|
|
$self->username => {type => {name => 'varchar', size => 60}}, |
|
81
|
|
|
|
|
|
|
$self->password => {type => {name => 'text'}}, |
|
82
|
|
|
|
|
|
|
$self->create => {type => {name => 'datetime'}}, |
|
83
|
|
|
|
|
|
|
$self->update => {type => {name => 'datetime'}}, |
|
84
|
|
|
|
|
|
|
$self->status => {type => {name => 'int', size => 1}} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub pg { |
|
90
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
91
|
|
|
|
|
|
|
return ( |
|
92
|
0
|
|
|
|
|
0
|
$self->table_name, |
|
93
|
|
|
|
|
|
|
[ |
|
94
|
|
|
|
|
|
|
$self->id, $self->id_roles, $self->firstname, $self->lastname, |
|
95
|
|
|
|
|
|
|
$self->fullname, $self->username, $self->password, $self->create, |
|
96
|
|
|
|
|
|
|
$self->update, $self->status |
|
97
|
|
|
|
|
|
|
], |
|
98
|
|
|
|
|
|
|
{ |
|
99
|
|
|
|
|
|
|
$self->id => {type => {name => 'serial'}, is_primarykey => 1}, |
|
100
|
|
|
|
|
|
|
$self->id_roles => {type => {name => 'int'}, is_null => 0}, |
|
101
|
|
|
|
|
|
|
$self->firstname => {type => {name => 'varchar', size => 50}}, |
|
102
|
|
|
|
|
|
|
$self->lastname => {type => {name => 'varchar', size => 50}}, |
|
103
|
|
|
|
|
|
|
$self->fullname => {type => {name => 'varchar', size => 100}}, |
|
104
|
|
|
|
|
|
|
$self->username => {type => {name => 'varchar', size => 60}}, |
|
105
|
|
|
|
|
|
|
$self->password => {type => {name => 'text'}}, |
|
106
|
|
|
|
|
|
|
$self->create => {type => {name => 'timestamp'}}, |
|
107
|
|
|
|
|
|
|
$self->update => {type => {name => 'timestamp'}}, |
|
108
|
|
|
|
|
|
|
$self->status => {type => {name => 'int'}} |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
package CellBIS::SQL::Abstract::Test::Table::_roles; |
|
114
|
|
|
|
|
|
|
$CellBIS::SQL::Abstract::Test::Table::_roles::VERSION = '1.5'; |
|
115
|
4
|
|
|
4
|
|
2719
|
use Mojo::Base -base; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
19
|
|
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
# Table fields |
|
118
|
|
|
|
|
|
|
has table_name => 'roles'; |
|
119
|
|
|
|
|
|
|
has id => 'id_roles'; |
|
120
|
|
|
|
|
|
|
has name => 'name'; |
|
121
|
|
|
|
|
|
|
has config => 'config'; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub sqlite { |
|
124
|
2
|
|
|
2
|
|
39
|
my $self = shift; |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
return ( |
|
127
|
2
|
|
|
|
|
8
|
$self->table_name, |
|
128
|
|
|
|
|
|
|
[$self->id, $self->name, $self->config], |
|
129
|
|
|
|
|
|
|
{ |
|
130
|
|
|
|
|
|
|
$self->id => |
|
131
|
|
|
|
|
|
|
{type => {name => 'integer'}, is_primarykey => 1, is_autoincre => 1}, |
|
132
|
|
|
|
|
|
|
$self->name => {type => {name => 'varchar', size => 50}}, |
|
133
|
|
|
|
|
|
|
$self->config => {type => {name => 'text'}} |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub mariadb { |
|
139
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
return ( |
|
142
|
0
|
|
|
|
|
|
$self->table_name, |
|
143
|
|
|
|
|
|
|
[$self->id, $self->name, $self->config], |
|
144
|
|
|
|
|
|
|
{ |
|
145
|
|
|
|
|
|
|
$self->id => |
|
146
|
|
|
|
|
|
|
{type => {name => 'int'}, is_primarykey => 1, is_autoincre => 1}, |
|
147
|
|
|
|
|
|
|
$self->name => {type => {name => 'varchar', size => 50}}, |
|
148
|
|
|
|
|
|
|
$self->config => {type => {name => 'text'}} |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub pg { |
|
154
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
return ( |
|
157
|
0
|
|
|
|
|
|
$self->table_name, |
|
158
|
|
|
|
|
|
|
[$self->id, $self->name, $self->config], |
|
159
|
|
|
|
|
|
|
{ |
|
160
|
|
|
|
|
|
|
$self->id => {type => {name => 'serial'}, is_primarykey => 1}, |
|
161
|
|
|
|
|
|
|
$self->name => {type => {name => 'varchar', size => 50}}, |
|
162
|
|
|
|
|
|
|
$self->config => {type => {name => 'text'}} |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=encoding utf8 |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 NAME |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
CellBIS::SQL::Abstract::Test::Table - A part of Unit Testing |
|
174
|
|
|
|
|
|
|
with contain information of tables |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
use CellBIS::SQL::Abstract::Test::Table; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
my $tables = CellBIS::SQL::Abstract::Test::Table->new; |
|
181
|
|
|
|
|
|
|
my $users = $tables->users; |
|
182
|
|
|
|
|
|
|
my $roles = $tables->roles; |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
# get table field - users; |
|
185
|
|
|
|
|
|
|
$users->id; |
|
186
|
|
|
|
|
|
|
$users->id_roles; |
|
187
|
|
|
|
|
|
|
$users->firstname; |
|
188
|
|
|
|
|
|
|
$users->lastname; |
|
189
|
|
|
|
|
|
|
$users->fullname; |
|
190
|
|
|
|
|
|
|
$users->username; |
|
191
|
|
|
|
|
|
|
$users->password; |
|
192
|
|
|
|
|
|
|
$users->create; |
|
193
|
|
|
|
|
|
|
$users->update; |
|
194
|
|
|
|
|
|
|
$users->status; |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# get table field - roles; |
|
197
|
|
|
|
|
|
|
$roles->id; |
|
198
|
|
|
|
|
|
|
$roles->name; |
|
199
|
|
|
|
|
|
|
$roles->config; |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# get table query for users |
|
202
|
|
|
|
|
|
|
my $users_sqlite = $users->sqlite; |
|
203
|
|
|
|
|
|
|
my $users_mariadb = $users->mariadb; |
|
204
|
|
|
|
|
|
|
my $users_pg = $users->pg; |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
# get table query for roles |
|
207
|
|
|
|
|
|
|
my $roles_sqlite = $roles->sqlite; |
|
208
|
|
|
|
|
|
|
my $roles_mariadb = $roles->mariadb; |
|
209
|
|
|
|
|
|
|
my $roles_pg = $roles->pg; |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This module is only for testing which contains 2 sample tables, |
|
214
|
|
|
|
|
|
|
namely C and C. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 ATTRIBUTES AND METHODS |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L implements two attributes, |
|
219
|
|
|
|
|
|
|
namely C and C. |
|
220
|
|
|
|
|
|
|
Each attributes can call C attributes and method
|
221
|
|
|
|
|
|
|
for table query (C). |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 AUTHOR |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Achmad Yusri Afandi, C |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Copyright (C) 2021 by Achmad Yusri Afandi |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify |
|
232
|
|
|
|
|
|
|
it under the terms of the Artistic License version 2.0. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=cut |
|