| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geoffrey::Role::Converter; |
|
2
|
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
32288
|
use utf8; |
|
|
19
|
|
|
|
|
60
|
|
|
|
19
|
|
|
|
|
100
|
|
|
4
|
19
|
|
|
19
|
|
657
|
use Carp qw/croak/; |
|
|
19
|
|
|
|
|
40
|
|
|
|
19
|
|
|
|
|
908
|
|
|
5
|
19
|
|
|
19
|
|
110
|
use strict; |
|
|
19
|
|
|
|
|
35
|
|
|
|
19
|
|
|
|
|
428
|
|
|
6
|
19
|
|
|
19
|
|
103
|
use warnings; |
|
|
19
|
|
|
|
|
32
|
|
|
|
19
|
|
|
|
|
626
|
|
|
7
|
19
|
|
|
19
|
|
8562
|
use Perl::Version; |
|
|
19
|
|
|
|
|
60337
|
|
|
|
19
|
|
|
|
|
27276
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Geoffrey::Role::Converter::VERSION = '0.000204'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
33
|
|
|
33
|
1
|
10973
|
my $class = shift; |
|
13
|
33
|
|
|
|
|
148
|
my $self = {@_}; |
|
14
|
33
|
|
|
|
|
135
|
return bless $self, $class; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub changelog_table { |
|
18
|
26
|
|
100
|
26
|
1
|
113
|
$_[0]->{changelog_table} //= 'geoffrey_changelogs'; |
|
19
|
26
|
|
|
|
|
117
|
return $_[0]->{changelog_table}; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub changelog_columns { |
|
23
|
|
|
|
|
|
|
return [{ |
|
24
|
3
|
|
|
3
|
1
|
73
|
name => 'id', |
|
25
|
|
|
|
|
|
|
type => 'varchar', |
|
26
|
|
|
|
|
|
|
lenght => 64, |
|
27
|
|
|
|
|
|
|
primarykey => 1, |
|
28
|
|
|
|
|
|
|
notnull => 1, |
|
29
|
|
|
|
|
|
|
default => '\'\'' |
|
30
|
|
|
|
|
|
|
}, |
|
31
|
|
|
|
|
|
|
{name => 'created_by', type => 'varchar', lenght => 128, notnull => 1, default => '\'\'',}, |
|
32
|
|
|
|
|
|
|
{name => 'filename', type => 'varchar', lenght => 255,}, |
|
33
|
|
|
|
|
|
|
{name => 'md5sum', type => 'varchar', lenght => 64,}, |
|
34
|
|
|
|
|
|
|
{name => 'description', type => 'varchar', lenght => 255,}, |
|
35
|
|
|
|
|
|
|
{name => 'comment', type => 'varchar', lenght => 128,}, |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
|
|
|
|
|
|
name => 'geoffrey_version', |
|
38
|
|
|
|
|
|
|
type => 'varchar', |
|
39
|
|
|
|
|
|
|
lenght => 16, |
|
40
|
|
|
|
|
|
|
notnull => 1, |
|
41
|
|
|
|
|
|
|
default => '\'\'' |
|
42
|
|
|
|
|
|
|
}, |
|
43
|
|
|
|
|
|
|
{name => 'created', type => 'timestamp', default => 'current_timestamp', notnull => 1,}, |
|
44
|
|
|
|
|
|
|
]; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub origin_types { |
|
48
|
|
|
|
|
|
|
return [ |
|
49
|
83
|
|
|
83
|
1
|
930
|
'abstime', 'aclitem', #Al |
|
50
|
|
|
|
|
|
|
'bigint', 'bigserial', 'bit', 'varbit', 'blob', 'bool', 'box', 'bytea', #B |
|
51
|
|
|
|
|
|
|
'char', 'character', 'varchar', 'cid', 'cidr', 'circle', #C |
|
52
|
|
|
|
|
|
|
'date', 'daterange', 'double', 'double_precision', 'decimal', #D |
|
53
|
|
|
|
|
|
|
#E |
|
54
|
|
|
|
|
|
|
#F |
|
55
|
|
|
|
|
|
|
'gtsvector', #G |
|
56
|
|
|
|
|
|
|
#H |
|
57
|
|
|
|
|
|
|
'inet', 'int2vector', 'int4range', 'int8range', 'integer', 'interval', #I |
|
58
|
|
|
|
|
|
|
'json', #J |
|
59
|
|
|
|
|
|
|
#K |
|
60
|
|
|
|
|
|
|
'line', 'lseg', #L |
|
61
|
|
|
|
|
|
|
'macaddr', 'money', #M |
|
62
|
|
|
|
|
|
|
'name', 'numeric', 'numrange', #N |
|
63
|
|
|
|
|
|
|
'oid', 'oidvector', #O |
|
64
|
|
|
|
|
|
|
'path', 'pg_node_tree', 'point', 'polygon', #P |
|
65
|
|
|
|
|
|
|
#Q |
|
66
|
|
|
|
|
|
|
'real', 'refcursor', 'regclass', 'regconfig', 'regdictionary', 'regoper', 'regoperator', |
|
67
|
|
|
|
|
|
|
'regproc', 'regprocedure', 'regtype', 'reltime', #R |
|
68
|
|
|
|
|
|
|
'serial', 'smallint', 'smallserial', 'smgr', #S |
|
69
|
|
|
|
|
|
|
'text', 'tid', 'timestamp', 'timestamp_tz', 'time', 'time_tz', 'tinterval', 'tsquery', |
|
70
|
|
|
|
|
|
|
'tsrange', 'tstzrange', 'tsvector', 'txid_snapshot', #T |
|
71
|
|
|
|
|
|
|
'uuid', #U |
|
72
|
|
|
|
|
|
|
#V |
|
73
|
|
|
|
|
|
|
#W |
|
74
|
|
|
|
|
|
|
'xid', #X |
|
75
|
|
|
|
|
|
|
#Y |
|
76
|
|
|
|
|
|
|
#Z |
|
77
|
|
|
|
|
|
|
]; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
9
|
|
|
9
|
1
|
59
|
sub min_version { return shift->{min_version} } |
|
81
|
|
|
|
|
|
|
|
|
82
|
9
|
|
|
9
|
1
|
47
|
sub max_version { return shift->{max_version} } |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub can_create_empty_table; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub check_version { |
|
87
|
9
|
|
|
9
|
1
|
7327
|
my ($self, $s_version) = @_; |
|
88
|
9
|
|
|
|
|
67
|
$s_version = Perl::Version->new($s_version); |
|
89
|
9
|
|
|
|
|
1164
|
my ($s_max_version, $s_min_version) = undef; |
|
90
|
9
|
50
|
|
|
|
25
|
eval { $s_min_version = $self->min_version; } or do { }; |
|
|
9
|
|
|
|
|
69
|
|
|
91
|
9
|
100
|
|
|
|
28
|
eval { $s_max_version = $self->max_version; } or do { }; |
|
|
9
|
|
|
|
|
42
|
|
|
92
|
9
|
|
|
|
|
29
|
$s_min_version = Perl::Version->new($s_min_version); |
|
93
|
9
|
100
|
|
|
|
892
|
if ($s_max_version) { |
|
|
|
100
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
8
|
$s_max_version = Perl::Version->new($s_max_version); |
|
95
|
3
|
100
|
100
|
|
|
227
|
return 1 if ($s_min_version <= $s_version && $s_version <= $s_max_version); |
|
96
|
2
|
|
|
|
|
83
|
require Geoffrey::Exception::NotSupportedException; |
|
97
|
2
|
|
|
|
|
12
|
Geoffrey::Exception::NotSupportedException::throw_version($self, $s_min_version, |
|
98
|
|
|
|
|
|
|
$s_version, $s_max_version); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
elsif ($s_min_version <= $s_version) { |
|
101
|
5
|
|
|
|
|
220
|
return 1; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
1
|
|
|
|
|
47
|
require Geoffrey::Exception::NotSupportedException; |
|
104
|
1
|
|
|
|
|
5
|
return Geoffrey::Exception::NotSupportedException::throw_version($self, $s_min_version, |
|
105
|
|
|
|
|
|
|
$s_version); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub type { |
|
109
|
85
|
|
|
85
|
1
|
257
|
my ($self, $hr_column_params) = @_; |
|
110
|
85
|
100
|
|
|
|
209
|
if (!$hr_column_params->{type}) { |
|
111
|
2
|
|
|
|
|
513
|
require Geoffrey::Exception::RequiredValue; |
|
112
|
2
|
|
|
|
|
11
|
Geoffrey::Exception::RequiredValue::throw_column_type($self); |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
my $s_column_type |
|
115
|
5893
|
|
|
|
|
14083
|
= (grep {/^$hr_column_params->{type}$/sxm} @{$self->origin_types()}) |
|
|
83
|
|
|
|
|
231
|
|
|
116
|
|
|
|
|
|
|
? $self->types()->{$hr_column_params->{type}} |
|
117
|
83
|
100
|
|
|
|
127
|
: undef; |
|
118
|
83
|
100
|
|
|
|
497
|
if (!$s_column_type) { |
|
119
|
1
|
|
|
|
|
6
|
require Geoffrey::Exception::NotSupportedException; |
|
120
|
|
|
|
|
|
|
Geoffrey::Exception::NotSupportedException::throw_column_type($hr_column_params->{type}, |
|
121
|
1
|
|
|
|
|
4
|
$self); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
82
|
50
|
|
|
|
198
|
$s_column_type .= $hr_column_params->{strict} ? '(strict)' : q//; |
|
124
|
|
|
|
|
|
|
$s_column_type |
|
125
|
82
|
100
|
|
|
|
196
|
.= defined $hr_column_params->{lenght} ? qq~($hr_column_params->{lenght})~ : q//; |
|
126
|
82
|
|
|
|
|
303
|
return $s_column_type; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub _get_table_hashref { |
|
130
|
3
|
|
|
3
|
|
14
|
my ($self, $dbh, $s_name, $ar_columns, $s_schema) = @_; |
|
131
|
3
|
|
|
|
|
13
|
my $s_select_get_table = $self->select_get_table; |
|
132
|
3
|
|
|
|
|
30
|
my $sth = $dbh->prepare($s_select_get_table); |
|
133
|
3
|
50
|
|
|
|
1408
|
if ($s_schema) { |
|
134
|
0
|
0
|
|
|
|
0
|
$sth->execute($s_schema, $s_name) or Carp::confess $!; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
else { |
|
137
|
3
|
50
|
|
|
|
198
|
$sth->execute($s_name) or Carp::confess $!; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
3
|
|
|
|
|
117
|
my $hr_table = $sth->fetchrow_hashref(); |
|
140
|
3
|
100
|
|
|
|
42
|
return if defined $hr_table; |
|
141
|
2
|
|
|
|
|
55
|
return {name => $s_name, columns => $ar_columns,}; |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub get_changelog_table_hashref { |
|
145
|
3
|
|
|
3
|
1
|
12
|
my ($self, $o_dbh, $s_schema) = @_; |
|
146
|
3
|
|
|
|
|
22
|
return $self->_get_table_hashref( |
|
147
|
|
|
|
|
|
|
$o_dbh, |
|
148
|
|
|
|
|
|
|
$self->changelog_table(), |
|
149
|
|
|
|
|
|
|
$self->changelog_columns(), $s_schema |
|
150
|
|
|
|
|
|
|
); |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub constraints { |
|
154
|
1
|
|
|
1
|
1
|
83
|
require Geoffrey::Exception::NotSupportedException; |
|
155
|
1
|
|
|
|
|
6
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub index { |
|
159
|
1
|
|
|
1
|
1
|
1740
|
require Geoffrey::Exception::NotSupportedException; |
|
160
|
1
|
|
|
|
|
5
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
161
|
|
|
|
|
|
|
} |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub table { |
|
164
|
1
|
|
|
1
|
1
|
1547
|
require Geoffrey::Exception::NotSupportedException; |
|
165
|
1
|
|
|
|
|
13
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub view { |
|
169
|
1
|
|
|
1
|
1
|
1560
|
require Geoffrey::Exception::NotSupportedException; |
|
170
|
1
|
|
|
|
|
5
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub foreign_key { |
|
174
|
1
|
|
|
1
|
1
|
1610
|
require Geoffrey::Exception::NotSupportedException; |
|
175
|
1
|
|
|
|
|
6
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub trigger { |
|
179
|
1
|
|
|
1
|
1
|
1549
|
require Geoffrey::Exception::NotSupportedException; |
|
180
|
1
|
|
|
|
|
8
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub primary_key { |
|
184
|
1
|
|
|
1
|
1
|
1597
|
require Geoffrey::Exception::NotSupportedException; |
|
185
|
1
|
|
|
|
|
4
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub sequence { |
|
189
|
7
|
|
|
7
|
1
|
1570
|
require Geoffrey::Exception::NotSupportedException; |
|
190
|
7
|
|
|
|
|
38
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub function { |
|
194
|
6
|
|
|
6
|
1
|
1594
|
require Geoffrey::Exception::NotSupportedException; |
|
195
|
6
|
|
|
|
|
31
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub unique { |
|
199
|
1
|
|
|
1
|
1
|
1599
|
require Geoffrey::Exception::NotSupportedException; |
|
200
|
1
|
|
|
|
|
5
|
return Geoffrey::Exception::NotSupportedException::throw_converter(); |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub colums_information { |
|
204
|
2
|
|
|
2
|
1
|
1549
|
require Geoffrey::Exception::NotSupportedException; |
|
205
|
2
|
|
|
|
|
14
|
return Geoffrey::Exception::NotSupportedException::throw_list_information('colums_information', |
|
206
|
|
|
|
|
|
|
shift); |
|
207
|
|
|
|
|
|
|
} |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub index_information { |
|
210
|
2
|
|
|
2
|
1
|
1634
|
require Geoffrey::Exception::NotSupportedException; |
|
211
|
2
|
|
|
|
|
14
|
return Geoffrey::Exception::NotSupportedException::throw_list_information('index_information', |
|
212
|
|
|
|
|
|
|
shift); |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub view_information { |
|
216
|
2
|
|
|
2
|
1
|
1560
|
require Geoffrey::Exception::NotSupportedException; |
|
217
|
2
|
|
|
|
|
11
|
return Geoffrey::Exception::NotSupportedException::throw_list_information('view_information', |
|
218
|
|
|
|
|
|
|
shift); |
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub sequence_information { |
|
222
|
1
|
|
|
1
|
1
|
1552
|
require Geoffrey::Exception::NotSupportedException; |
|
223
|
1
|
|
|
|
|
5
|
return Geoffrey::Exception::NotSupportedException::throw_list_information( |
|
224
|
|
|
|
|
|
|
'sequence_information', shift); |
|
225
|
|
|
|
|
|
|
} |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub primary_key_information { |
|
228
|
1
|
|
|
1
|
1
|
1593
|
require Geoffrey::Exception::NotSupportedException; |
|
229
|
1
|
|
|
|
|
7
|
return Geoffrey::Exception::NotSupportedException::throw_list_information( |
|
230
|
|
|
|
|
|
|
'primary_key_information', shift); |
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub function_information { |
|
234
|
2
|
|
|
2
|
1
|
3211
|
require Geoffrey::Exception::NotSupportedException; |
|
235
|
2
|
|
|
|
|
14
|
return Geoffrey::Exception::NotSupportedException::throw_list_information( |
|
236
|
|
|
|
|
|
|
'function_information', shift); |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub unique_information { |
|
240
|
1
|
|
|
1
|
1
|
1579
|
require Geoffrey::Exception::NotSupportedException; |
|
241
|
1
|
|
|
|
|
7
|
return Geoffrey::Exception::NotSupportedException::throw_list_information('unique_information', |
|
242
|
|
|
|
|
|
|
shift); |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
sub trigger_information { |
|
246
|
1
|
|
|
1
|
1
|
1620
|
require Geoffrey::Exception::NotSupportedException; |
|
247
|
1
|
|
|
|
|
6
|
return Geoffrey::Exception::NotSupportedException::throw_list_information( |
|
248
|
|
|
|
|
|
|
'trigger_information', shift); |
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
1; # End of Geoffrey::converter |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
__END__ |