1 |
joko |
1.6 |
############################################ |
2 |
cvsjoko |
1.1 |
# |
3 |
jonen |
1.35 |
# $Id: Tangram.pm,v 1.34 2003/04/11 01:18:53 joko Exp $ |
4 |
joko |
1.2 |
# |
5 |
|
|
# $Log: Tangram.pm,v $ |
6 |
jonen |
1.35 |
# Revision 1.34 2003/04/11 01:18:53 joko |
7 |
|
|
# sendQuery: |
8 |
|
|
# + introduced crud action 'DELETE' |
9 |
|
|
# |
10 |
joko |
1.34 |
# Revision 1.33 2003/04/09 06:07:43 joko |
11 |
|
|
# revamped 'sub sendQuery' |
12 |
|
|
# |
13 |
joko |
1.33 |
# Revision 1.32 2003/04/08 22:52:22 joko |
14 |
|
|
# modified 'querySchema': better behaviour regarding filtering result |
15 |
|
|
# |
16 |
joko |
1.32 |
# Revision 1.31 2003/04/05 21:24:09 joko |
17 |
|
|
# modified 'sub getChildNodes': now contains code from 'querySchema' |
18 |
|
|
# |
19 |
joko |
1.31 |
# Revision 1.30 2003/03/27 15:31:14 joko |
20 |
|
|
# fixes to modules regarding new namespace(s) below Data::Mungle::* |
21 |
|
|
# |
22 |
joko |
1.30 |
# Revision 1.29 2003/02/21 01:47:18 joko |
23 |
|
|
# purged old code |
24 |
|
|
# minor cosmetics |
25 |
|
|
# |
26 |
joko |
1.29 |
# Revision 1.28 2003/02/20 20:20:26 joko |
27 |
|
|
# tried to get auto-disconnect working again - failed with that |
28 |
|
|
# |
29 |
joko |
1.28 |
# Revision 1.27 2003/01/31 06:30:59 joko |
30 |
|
|
# + enabled 'sendQuery' |
31 |
|
|
# |
32 |
joko |
1.27 |
# Revision 1.26 2003/01/30 22:29:47 joko |
33 |
|
|
# + fixed module usage (removed dependency on 'libp.pm') |
34 |
|
|
# |
35 |
joko |
1.26 |
# Revision 1.25 2003/01/19 02:30:05 joko |
36 |
|
|
# + fix: modified call to '_initSchema' |
37 |
|
|
# |
38 |
joko |
1.25 |
# Revision 1.24 2002/12/22 14:13:01 joko |
39 |
|
|
# + sub dropDb |
40 |
|
|
# |
41 |
joko |
1.24 |
# Revision 1.23 2002/12/19 16:31:53 joko |
42 |
|
|
# +- renamed sub to 'rebuildDb' |
43 |
|
|
# |
44 |
joko |
1.23 |
# Revision 1.22 2002/12/18 22:28:16 jonen |
45 |
|
|
# + added extended logging at 'getObjectByGuid()' |
46 |
|
|
# |
47 |
jonen |
1.22 |
# Revision 1.21 2002/12/16 22:20:49 jonen |
48 |
|
|
# + fixed bug at 'getObjectByGuid()' |
49 |
|
|
# |
50 |
jonen |
1.21 |
# Revision 1.20 2002/12/16 20:49:17 jonen |
51 |
|
|
# + added sub 'getObjectByGuid()' |
52 |
|
|
# + added functionality to use 'getObjectByGuid' at 'getObjectAsHash()' |
53 |
|
|
# |
54 |
jonen |
1.20 |
# Revision 1.19 2002/12/16 06:46:09 joko |
55 |
|
|
# + attempt to introduce a generic '_patchSchema' - cancelled! |
56 |
|
|
# |
57 |
joko |
1.19 |
# Revision 1.18 2002/12/13 21:48:07 joko |
58 |
|
|
# + fix to 'sub sendQuery' |
59 |
|
|
# |
60 |
joko |
1.18 |
# Revision 1.17 2002/12/12 02:51:09 joko |
61 |
|
|
# + cosmetics |
62 |
|
|
# |
63 |
joko |
1.17 |
# Revision 1.16 2002/12/11 06:54:10 joko |
64 |
|
|
# + fix: encapsulated object-loading inside an 'eval' |
65 |
|
|
# |
66 |
joko |
1.16 |
# Revision 1.15 2002/12/05 13:55:21 joko |
67 |
joko |
1.28 |
# + now utilizing 'expand' instead of 'var_deref' |
68 |
joko |
1.16 |
# + played around with having fresh-objects - no progress.... |
69 |
|
|
# |
70 |
joko |
1.15 |
# Revision 1.14 2002/12/05 09:40:30 jonen |
71 |
|
|
# + added option->{destroy} at getObject for unloading all instance |
72 |
|
|
# |
73 |
jonen |
1.14 |
# Revision 1.13 2002/12/05 07:59:04 joko |
74 |
|
|
# + now using Tie::SecureHash as a base for the COREHANDLE |
75 |
|
|
# + former public COREHANDLE becomes private _COREHANDLE now |
76 |
|
|
# + sub getCOREHANDLE |
77 |
|
|
# |
78 |
joko |
1.13 |
# Revision 1.12 2002/12/04 11:34:49 joko |
79 |
|
|
# - $schema_tangram doesn't have to be in class? |
80 |
|
|
# |
81 |
joko |
1.12 |
# Revision 1.11 2002/12/04 08:54:08 jonen |
82 |
|
|
# + untested bugfix: undef($object) after transform to hash at getObjectAsHash |
83 |
|
|
# |
84 |
jonen |
1.11 |
# Revision 1.10 2002/12/03 15:53:23 joko |
85 |
|
|
# + small bugfix regarding object hierarchy |
86 |
|
|
# |
87 |
joko |
1.10 |
# Revision 1.9 2002/12/03 05:29:40 joko |
88 |
|
|
# + sub getObject |
89 |
|
|
# + sub getObjectAsHash |
90 |
|
|
# |
91 |
joko |
1.9 |
# Revision 1.8 2002/12/01 22:25:51 joko |
92 |
|
|
# + now utilizing metadata from storage locator when connecting to DBI in "raw"-mode |
93 |
|
|
# |
94 |
joko |
1.8 |
# Revision 1.7 2002/12/01 04:46:19 joko |
95 |
|
|
# + sub eraseAll |
96 |
|
|
# |
97 |
joko |
1.7 |
# Revision 1.6 2002/11/29 05:02:30 joko |
98 |
|
|
# - sub getNewPerlObjectByPkgName (moved to libp.pm) |
99 |
|
|
# + sub getMetaInfo |
100 |
|
|
# - sub existsChildNode (moved to Abstract.pm) |
101 |
|
|
# + sub getListUnfiltered |
102 |
|
|
# + sub getListFiltered |
103 |
|
|
# + sub createCursor |
104 |
|
|
# + sub createSet |
105 |
|
|
# + sub sendQuery |
106 |
|
|
# |
107 |
joko |
1.6 |
# Revision 1.5 2002/11/17 06:35:18 joko |
108 |
|
|
# + locator metadata can now be reached via ->{locator} |
109 |
|
|
# - getChildNodes is now wrapped via COREHANDLE |
110 |
|
|
# |
111 |
joko |
1.5 |
# Revision 1.4 2002/10/25 11:44:44 joko |
112 |
|
|
# + sub _initSchema |
113 |
|
|
# + sub existsChildNode |
114 |
|
|
# + sub testIntegrity |
115 |
|
|
# + sub rebuildDbAndSchema |
116 |
|
|
# |
117 |
joko |
1.4 |
# Revision 1.3 2002/10/17 03:56:55 joko |
118 |
|
|
# + bugfix: trapped eval error |
119 |
|
|
# |
120 |
joko |
1.3 |
# Revision 1.2 2002/10/17 00:10:05 joko |
121 |
|
|
# + removed dependency from tsobj.pm, schema is now independent |
122 |
|
|
# + sub getNewPerlObjectByPkgName |
123 |
|
|
# + sub deploySchema |
124 |
|
|
# + sub retreatSchema |
125 |
|
|
# |
126 |
joko |
1.2 |
# Revision 1.1 2002/10/10 03:44:07 cvsjoko |
127 |
|
|
# + new |
128 |
cvsjoko |
1.1 |
# |
129 |
joko |
1.6 |
############################################ |
130 |
|
|
|
131 |
cvsjoko |
1.1 |
|
132 |
|
|
package Data::Storage::Handler::Tangram; |
133 |
|
|
|
134 |
|
|
use strict; |
135 |
|
|
use warnings; |
136 |
|
|
|
137 |
joko |
1.13 |
use base ("Data::Storage::Handler"); |
138 |
cvsjoko |
1.1 |
use base ("Data::Storage::Handler::Abstract"); |
139 |
|
|
|
140 |
joko |
1.28 |
|
141 |
|
|
use Data::Dumper; |
142 |
cvsjoko |
1.1 |
use Tangram; |
143 |
joko |
1.28 |
|
144 |
joko |
1.26 |
use DesignPattern::Object; |
145 |
joko |
1.6 |
use Data::Storage::Result::Tangram; |
146 |
joko |
1.30 |
use Data::Mungle::Compare::Struct qw( isEmpty ); |
147 |
joko |
1.33 |
use Data::Mungle::Transform::Deep qw( expand deep_copy merge_to ); |
148 |
joko |
1.9 |
|
149 |
cvsjoko |
1.1 |
# get logger instance |
150 |
|
|
my $logger = Log::Dispatch::Config->instance; |
151 |
|
|
|
152 |
|
|
|
153 |
joko |
1.12 |
# this holds the complete instantiated schema from tangram |
154 |
|
|
my $schema_tangram; |
155 |
|
|
|
156 |
joko |
1.6 |
sub getMetaInfo { |
157 |
|
|
my $self = shift; |
158 |
|
|
$logger->debug( __PACKAGE__ . "->getMetaInfo()" ); |
159 |
|
|
return { |
160 |
|
|
'disconnectMethod' => 'disconnect', |
161 |
|
|
}; |
162 |
joko |
1.2 |
} |
163 |
|
|
|
164 |
joko |
1.4 |
sub _initSchema { |
165 |
|
|
my $self = shift; |
166 |
|
|
$logger->debug( __PACKAGE__ . "->_initSchema()" ); |
167 |
joko |
1.12 |
#if (!$schema_tangram) { |
168 |
joko |
1.26 |
#my $obj = getNewPerlObjectByPkgName($self->{locator}->{schema}, { EXPORT_OBJECTS => $self->{locator}->{classnames}, want_transactions => $self->{locator}->{want_transactions} } ); |
169 |
|
|
my $obj = DesignPattern::Object->fromPackage($self->{locator}->{schema}, { 'EXPORT_OBJECTS' => $self->{locator}->{classnames}, 'want_transactions' => $self->{locator}->{want_transactions} } ); |
170 |
joko |
1.12 |
$schema_tangram = $obj->getSchema(); |
171 |
joko |
1.4 |
#} |
172 |
joko |
1.12 |
if (!$schema_tangram) { |
173 |
joko |
1.4 |
$logger->error( __PACKAGE__ . "->_initSchema: No Schema available for $self->{schema}" ); |
174 |
|
|
return 0; |
175 |
|
|
} |
176 |
joko |
1.19 |
#$self->_patchSchema(); |
177 |
joko |
1.4 |
return 1; |
178 |
joko |
1.19 |
} |
179 |
|
|
|
180 |
|
|
sub _patchSchema { |
181 |
|
|
my $self = shift; |
182 |
|
|
foreach (keys %{$schema_tangram->{classes}}) { |
183 |
|
|
next if $schema_tangram->{classes}->{$_}->{abstract}; |
184 |
|
|
#next if ($_ ne 'TsBankAccount'); |
185 |
|
|
#$_ ne 'AbstractAccount' && |
186 |
|
|
print "class: $_", "\n"; |
187 |
|
|
#print Dumper($schema_tangram->{classes}->{$_}); |
188 |
|
|
# create new string property named 'guid' |
189 |
|
|
my $tstring = Tangram::String->new(); |
190 |
|
|
$tstring->{name} = $tstring->{col} = 'guid'; |
191 |
|
|
# inject property into schema |
192 |
|
|
#$schema_tangram->{classes}->{$_}->{root}->{SPECS}->[0]->{fields}->{string}->{$tstring->{name}} = $tstring; |
193 |
|
|
print Dumper($schema_tangram->{classes}->{$_}->{root}->{SPECS}->[0]->{fields}); |
194 |
|
|
} |
195 |
joko |
1.4 |
} |
196 |
|
|
|
197 |
cvsjoko |
1.1 |
sub connect { |
198 |
|
|
|
199 |
|
|
my $self = shift; |
200 |
|
|
|
201 |
|
|
my $dsn = shift; |
202 |
joko |
1.25 |
|
203 |
|
|
#print Dumper($self); |
204 |
|
|
#exit; |
205 |
|
|
|
206 |
|
|
# TODO: re-enable |
207 |
joko |
1.5 |
$dsn ||= $self->{locator}->{dbi}->{dsn}; |
208 |
joko |
1.2 |
$logger->debug( __PACKAGE__ . "->connect( dsn $dsn )" ); |
209 |
cvsjoko |
1.1 |
|
210 |
|
|
#my $storage = Tangram::Relational->connect( $schema, $dsn ); |
211 |
|
|
#my $storage = Tangram::mysql->connect( $schema, $dsn ); |
212 |
|
|
#$storage = Tangram::Relational->connect( Project->schema, $dsn ); |
213 |
|
|
|
214 |
|
|
# if (!testDsn($dsn)) { |
215 |
|
|
# croak("Database at \"$dsn\" is not available"); |
216 |
|
|
# return; |
217 |
|
|
# } |
218 |
|
|
|
219 |
joko |
1.25 |
#return unless $self->_initSchema(); |
220 |
|
|
$self->_initSchema(); |
221 |
joko |
1.4 |
|
222 |
joko |
1.6 |
# create the main tangram storage object |
223 |
joko |
1.2 |
#$self->{COREHANDLE} = Tangram::Relational->connect( $schema, $dsn ); |
224 |
joko |
1.13 |
$self->{_COREHANDLE} = Tangram::Relational->connect( $schema_tangram, $dsn ); |
225 |
|
|
|
226 |
|
|
#print "connect", "\n"; |
227 |
|
|
#my $core = $self->{_COREHANDLE}; |
228 |
|
|
#print Dumper($core); |
229 |
cvsjoko |
1.1 |
|
230 |
joko |
1.6 |
# some attempts for configuring the wrapped underlying dbi..... |
231 |
cvsjoko |
1.1 |
#$self->{STORAGEHANDLE_UNDERLYING} = $self->getUnderlyingStorage(); |
232 |
|
|
#$self->{STORAGEHANDLE_UNDERLYING}->_configureCOREHANDLE(); |
233 |
|
|
#$self->_configureUnderlyingStorage; |
234 |
joko |
1.6 |
|
235 |
|
|
# ..... encapsulation wins! |
236 |
cvsjoko |
1.1 |
$self->configureCOREHANDLE(); |
237 |
|
|
|
238 |
joko |
1.5 |
$self->{locator}->{status}->{connected} = 1; |
239 |
|
|
|
240 |
joko |
1.4 |
return 1; |
241 |
|
|
|
242 |
cvsjoko |
1.1 |
} |
243 |
|
|
|
244 |
|
|
sub getChildNodes { |
245 |
|
|
|
246 |
|
|
my $self = shift; |
247 |
joko |
1.31 |
my $mode = shift; |
248 |
joko |
1.32 |
my $filter = shift; |
249 |
|
|
|
250 |
joko |
1.31 |
$mode ||= 'core'; |
251 |
joko |
1.32 |
$filter ||= 'all'; |
252 |
joko |
1.31 |
|
253 |
|
|
$logger->debug( __PACKAGE__ . "->getChildNodes($mode)" ); |
254 |
|
|
|
255 |
|
|
if ($mode eq 'core') { |
256 |
cvsjoko |
1.1 |
|
257 |
joko |
1.31 |
my @nodes; |
258 |
|
|
|
259 |
|
|
# create new DBI - Data::Storage - object from already connected DBI::db - handle inside the current COREHANDLE |
260 |
|
|
#my $loc = new Data::Storage::Locator( type => "DBI", dbi => { db => $self->{COREHANDLE}->{db} }); |
261 |
|
|
#my $loc = new Data::Storage::Locator( type => "DBI", COREHANDLE => $self->{COREHANDLE}->{db} ); |
262 |
|
|
|
263 |
|
|
# todo: should we retrieve information from the schema here |
264 |
|
|
# rather than poorly getting table names from underlying dbi? |
265 |
|
|
my $storage = $self->_getSubLayerHandle(); |
266 |
|
|
@nodes = @{$storage->getChildNodes()}; |
267 |
|
|
#$storage->_configureCOREHANDLE(); |
268 |
|
|
#print "getchildnodes\n"; |
269 |
|
|
#print Dumper($self); |
270 |
|
|
#if (my $result = $self->sendCommand( 'SHOW TABLES;' ) ) { |
271 |
|
|
|
272 |
|
|
# TODO: REVIEW |
273 |
|
|
#$storage->disconnect(); |
274 |
|
|
|
275 |
|
|
$self->{meta}->{childnodes} = \@nodes; |
276 |
joko |
1.4 |
|
277 |
joko |
1.31 |
return \@nodes; |
278 |
|
|
|
279 |
|
|
} elsif ($mode eq 'root') { |
280 |
|
|
|
281 |
|
|
# FIXME: this will return *all* known classes to 'Class::Tangram', |
282 |
|
|
# which might not be what you expect since more than one instance |
283 |
|
|
# of Tangram may be in memory and Class::Tangram seems to |
284 |
|
|
# offer no methods to determine this or filter its result(s) according |
285 |
|
|
# to a specific database. |
286 |
|
|
my @object_names = Class::Tangram::known_classes(); |
287 |
|
|
my @concret_names; |
288 |
|
|
my $o_cnt; |
289 |
|
|
foreach (sort @object_names) { |
290 |
|
|
push @concret_names, $_ if (!Class::Tangram::class_is_abstract($_)); |
291 |
|
|
$o_cnt++; |
292 |
|
|
} |
293 |
joko |
1.32 |
|
294 |
|
|
if ($filter eq 'all') { |
295 |
|
|
return \@object_names; |
296 |
|
|
} elsif ($filter eq 'concrete') { |
297 |
|
|
return \@concret_names; |
298 |
|
|
} |
299 |
cvsjoko |
1.1 |
|
300 |
joko |
1.31 |
} |
301 |
joko |
1.4 |
|
302 |
cvsjoko |
1.1 |
|
303 |
|
|
} |
304 |
|
|
|
305 |
joko |
1.4 |
sub testIntegrity { |
306 |
|
|
|
307 |
|
|
my $self = shift; |
308 |
|
|
|
309 |
|
|
$logger->debug( __PACKAGE__ . "->testIntegrity()" ); |
310 |
|
|
|
311 |
|
|
# 1st test: are there tables? |
312 |
|
|
if (!$self->getChildNodes()) { |
313 |
|
|
$logger->warning( __PACKAGE__ . "->testIntegrity no childnodes exist" ); |
314 |
|
|
return; |
315 |
|
|
} |
316 |
|
|
|
317 |
|
|
# 2nd test: is there a table named "Tangram"? |
318 |
|
|
if (!$self->existsChildNode("Tangram")) { |
319 |
|
|
$logger->warning( __PACKAGE__ . "->testIntegrity childnode \"Tangram\" doesn't exist" ); |
320 |
|
|
return; |
321 |
|
|
} |
322 |
|
|
|
323 |
joko |
1.5 |
$self->{locator}->{status}->{integrity} = 1; |
324 |
joko |
1.4 |
return 1; |
325 |
|
|
|
326 |
|
|
} |
327 |
|
|
|
328 |
|
|
|
329 |
cvsjoko |
1.1 |
sub _getSubLayerHandle { |
330 |
|
|
|
331 |
|
|
my $self = shift; |
332 |
|
|
|
333 |
joko |
1.4 |
$logger->debug( __PACKAGE__ . "->_getSubLayerHandle()" ); |
334 |
|
|
|
335 |
cvsjoko |
1.1 |
#print Dumper($self); |
336 |
joko |
1.5 |
|
337 |
cvsjoko |
1.1 |
# hack, make more generic! |
338 |
joko |
1.4 |
if (!$self->{dataStorageLayer}) { |
339 |
|
|
$logger->debug( __PACKAGE__ . "->_getSubLayerHandle() creating new dataStorageLayer" ); |
340 |
|
|
#my $loc = Data::Storage::Locator->new( type => "DBI", dbi => $self->{dbi}, COREHANDLE => $self->{COREHANDLE}->{db} ); |
341 |
joko |
1.5 |
my $loc = Data::Storage::Locator->new( { type => "DBI", dbi => $self->{locator}->{dbi} } ); |
342 |
joko |
1.4 |
$self->{dataStorageLayer} = Data::Storage->new( $loc, { protected => 1 } ); |
343 |
cvsjoko |
1.1 |
#$self->{STORAGE_UNDER_THE_HOOD}->{STORAGEHANDLE}->_configureCOREHANDLE(); |
344 |
|
|
#$self->{STORAGE_UNDER_THE_HOOD}->_configureCOREHANDLE(); |
345 |
|
|
} |
346 |
|
|
|
347 |
|
|
#print Dumper($self->{STORAGE_UNDER_THE_HOOD}); |
348 |
|
|
|
349 |
joko |
1.4 |
return $self->{dataStorageLayer}; |
350 |
cvsjoko |
1.1 |
|
351 |
|
|
} |
352 |
|
|
|
353 |
|
|
sub _configureUnderlyingStorage { |
354 |
|
|
|
355 |
|
|
my $self = shift; |
356 |
joko |
1.4 |
|
357 |
|
|
$logger->debug( __PACKAGE__ . "->_configureUnderlyingStorage" ); |
358 |
|
|
|
359 |
cvsjoko |
1.1 |
$self->_configureCOREHANDLE_DBI(); |
360 |
|
|
return; |
361 |
|
|
|
362 |
|
|
foreach my $key (keys %{$self->{dbi}}) { |
363 |
|
|
my $val = $self->{dbi}->{$key}; |
364 |
|
|
print "entry: $key; $val", "\n"; |
365 |
joko |
1.13 |
$self->{_COREHANDLE}->{db}->{$key} = $val; |
366 |
cvsjoko |
1.1 |
} |
367 |
|
|
#print Dumper($self->{COREHANDLE}->{db}); |
368 |
|
|
} |
369 |
|
|
|
370 |
|
|
|
371 |
|
|
sub configureCOREHANDLE { |
372 |
|
|
|
373 |
|
|
my $self = shift; |
374 |
|
|
|
375 |
joko |
1.4 |
$logger->debug( __PACKAGE__ . "->configureCOREHANDLE" ); |
376 |
cvsjoko |
1.1 |
|
377 |
|
|
#my $subLayer = $self->_getSubLayerHandle(); |
378 |
joko |
1.26 |
#print Dumper($self); |
379 |
|
|
#exit; |
380 |
cvsjoko |
1.1 |
|
381 |
|
|
# apply configured modifications |
382 |
|
|
if (exists $self->{dbi}->{trace_level} && exists $self->{dbi}->{trace_file}) { |
383 |
joko |
1.13 |
$self->{_COREHANDLE}->{db}->trace($self->{dbi}->{trace_level}, $self->{dbi}->{trace_file}); |
384 |
cvsjoko |
1.1 |
} |
385 |
|
|
if (exists $self->{dbi}->{RaiseError}) { |
386 |
joko |
1.13 |
$self->{_COREHANDLE}->{db}->{RaiseError} = $self->{dbi}->{RaiseError}; |
387 |
cvsjoko |
1.1 |
} |
388 |
|
|
if (exists $self->{dbi}->{PrintError}) { |
389 |
joko |
1.13 |
$self->{_COREHANDLE}->{db}->{PrintError} = $self->{dbi}->{PrintError}; |
390 |
cvsjoko |
1.1 |
} |
391 |
|
|
if (exists $self->{dbi}->{HandleError}) { |
392 |
joko |
1.13 |
$self->{_COREHANDLE}->{db}->{HandleError} = $self->{dbi}->{HandleError}; |
393 |
cvsjoko |
1.1 |
} |
394 |
|
|
|
395 |
joko |
1.2 |
} |
396 |
|
|
|
397 |
|
|
sub deploySchema { |
398 |
|
|
my $self = shift; |
399 |
joko |
1.5 |
my $args = shift; |
400 |
|
|
|
401 |
|
|
my $dsn = $self->{locator}->{dbi}->{dsn}; |
402 |
joko |
1.4 |
|
403 |
|
|
$logger->debug( __PACKAGE__ . "->deploySchema( dsn $dsn )" ); |
404 |
|
|
|
405 |
joko |
1.2 |
my $ok; |
406 |
joko |
1.8 |
if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { |
407 |
joko |
1.4 |
return unless $self->_initSchema(); |
408 |
joko |
1.12 |
$ok = Tangram::Relational->deploy($schema_tangram, $dbh ); |
409 |
joko |
1.2 |
$dbh->disconnect(); |
410 |
|
|
} |
411 |
|
|
return $ok; |
412 |
|
|
} |
413 |
|
|
|
414 |
|
|
sub retreatSchema { |
415 |
joko |
1.4 |
|
416 |
joko |
1.2 |
my $self = shift; |
417 |
joko |
1.5 |
my $dsn = $self->{locator}->{dbi}->{dsn}; |
418 |
joko |
1.4 |
|
419 |
|
|
$logger->debug( __PACKAGE__ . "->retreatSchema( dsn $dsn )" ); |
420 |
|
|
|
421 |
joko |
1.2 |
my $ok; |
422 |
joko |
1.8 |
if ( my $dbh = DBI->connect($dsn, '', '', $self->{locator}->{dbi} ) ) { |
423 |
joko |
1.4 |
|
424 |
|
|
return unless $self->_initSchema(); |
425 |
|
|
|
426 |
|
|
#use Data::Dumper; print Dumper($self); |
427 |
|
|
$self->{dataStorageLayer}->removeLogDispatchHandler("Tangram11"); |
428 |
|
|
|
429 |
joko |
1.12 |
$ok = Tangram::Relational->retreat($schema_tangram, $dbh ); |
430 |
joko |
1.8 |
|
431 |
|
|
# answer "$ok=2" means "maybe" for now - we have to patch this to a constant here because... |
432 |
|
|
# - ... Tangram::Relational->retreat doesn't seem to return a valid status |
433 |
|
|
# - possible improvement: |
434 |
|
|
# - test this by checking for count of tables in database |
435 |
|
|
# - problem with this: there may be some left not having been included to the schema |
436 |
|
|
# - maybe better: use "->getChildNodes"? |
437 |
|
|
$ok = 2; |
438 |
|
|
|
439 |
joko |
1.2 |
$dbh->disconnect(); |
440 |
joko |
1.8 |
|
441 |
joko |
1.2 |
} |
442 |
|
|
return $ok; |
443 |
joko |
1.4 |
} |
444 |
|
|
|
445 |
joko |
1.23 |
sub rebuildDb { |
446 |
joko |
1.4 |
my $self = shift; |
447 |
joko |
1.23 |
$logger->info( __PACKAGE__ . "->rebuildDb()" ); |
448 |
joko |
1.4 |
my @results; |
449 |
|
|
|
450 |
|
|
# sum up results (bool (0/1)) in array |
451 |
|
|
push @results, $self->retreatSchema(); |
452 |
|
|
push @results, $self->{dataStorageLayer}->dropDb(); |
453 |
|
|
push @results, $self->{dataStorageLayer}->createDb(); |
454 |
|
|
push @results, $self->deploySchema(); |
455 |
|
|
|
456 |
|
|
# scan array for "bad ones" |
457 |
|
|
my $res = 1; |
458 |
|
|
map { |
459 |
|
|
$res = 0 if (!$_); |
460 |
|
|
} @results; |
461 |
|
|
|
462 |
|
|
return $res; |
463 |
joko |
1.6 |
} |
464 |
|
|
|
465 |
|
|
sub getListUnfiltered { |
466 |
|
|
my $self = shift; |
467 |
|
|
my $nodename = shift; |
468 |
|
|
my @results; |
469 |
|
|
$logger->debug( __PACKAGE__ . "->getListUnfiltered( nodename => '" . $nodename . "' )" ); |
470 |
|
|
# get set of objects from odbms by object name |
471 |
joko |
1.13 |
my $object_set = $self->{_COREHANDLE}->remote($nodename); |
472 |
|
|
@results = $self->{_COREHANDLE}->select($object_set); |
473 |
joko |
1.6 |
return \@results; |
474 |
|
|
} |
475 |
|
|
|
476 |
|
|
sub getListFiltered { |
477 |
|
|
my $self = shift; |
478 |
|
|
|
479 |
|
|
# redirect to unfiltered mode |
480 |
|
|
#return $self->getListUnfiltered(@_); |
481 |
|
|
|
482 |
|
|
my $nodename = shift; |
483 |
|
|
my $filters = shift; |
484 |
|
|
my @results; |
485 |
|
|
$logger->debug( __PACKAGE__ . "->getListFiltered( nodename => '" . $nodename . "' )" ); |
486 |
|
|
|
487 |
joko |
1.27 |
#print Dumper($filters); |
488 |
joko |
1.6 |
|
489 |
|
|
my @tfilters; |
490 |
|
|
|
491 |
|
|
foreach my $filter (@$filters) { |
492 |
|
|
|
493 |
|
|
# get filter - TODO: for each filter |
494 |
|
|
#my $filter = $filters->[0]; |
495 |
|
|
|
496 |
|
|
# build filter |
497 |
|
|
my $lexpr = $filter->{key}; |
498 |
|
|
#my $op = $filter->{op}; |
499 |
|
|
my $op = '='; |
500 |
|
|
my $rexpr = $filter->{val}; |
501 |
|
|
my $tight = 100; |
502 |
|
|
|
503 |
|
|
# my $tfilter = Tangram::Filter->new( |
504 |
|
|
# expr => "t1.$lexpr $op '$rexpr'", |
505 |
|
|
# tight => $tight, |
506 |
|
|
# objects => $objects, |
507 |
|
|
# ); |
508 |
|
|
|
509 |
jonen |
1.35 |
# TODO: is_op? |
510 |
|
|
# dispatch un-common operators if exists |
511 |
|
|
if($filter->{op} eq "ref") { |
512 |
|
|
push @tfilters, 'ref($remote->{' . $filter->{key} . '})' . " eq '$filter->{val}'"; |
513 |
|
|
} else { |
514 |
|
|
# HACK: build eval-string (sorry) to get filtered list - please give advice here |
515 |
|
|
push @tfilters, '$remote->{' . $filter->{key} . '}' . " $filter->{op} '$filter->{val}'"; |
516 |
|
|
} |
517 |
joko |
1.6 |
|
518 |
|
|
} |
519 |
|
|
|
520 |
|
|
my $tfilter = join(' & ', @tfilters); |
521 |
|
|
|
522 |
|
|
# get set of objects from odbms by object name |
523 |
joko |
1.13 |
my $remote = $self->{_COREHANDLE}->remote($nodename); |
524 |
joko |
1.6 |
|
525 |
|
|
# was: |
526 |
|
|
#@results = $self->{COREHANDLE}->select($object_set, $tfilter); |
527 |
|
|
|
528 |
|
|
# is: |
529 |
|
|
# HACK: build eval-string (sorry) to get filtered list - please give advice here |
530 |
joko |
1.13 |
my $evalstring = 'return $self->{_COREHANDLE}->select($remote, ' . $tfilter . ');'; |
531 |
joko |
1.6 |
|
532 |
joko |
1.27 |
#print "eval: $evalstring", "\n"; |
533 |
|
|
|
534 |
joko |
1.6 |
# get filtered list/set |
535 |
|
|
@results = eval($evalstring); |
536 |
|
|
die $@ if $@; |
537 |
|
|
|
538 |
|
|
return \@results; |
539 |
|
|
} |
540 |
|
|
|
541 |
|
|
sub createCursor { |
542 |
|
|
my $self = shift; |
543 |
|
|
my $node = shift; |
544 |
joko |
1.13 |
my $cmdHandle = $self->{_COREHANDLE}->cursor($node); |
545 |
joko |
1.6 |
my $result = Data::Storage::Result::Tangram->new( RESULTHANDLE => $cmdHandle ); |
546 |
|
|
return $result; |
547 |
|
|
} |
548 |
|
|
|
549 |
|
|
sub createSet { |
550 |
|
|
my $self = shift; |
551 |
joko |
1.18 |
#print "-" x 80, "\n"; |
552 |
|
|
#print Dumper(@_); |
553 |
joko |
1.6 |
my @objects = @_; |
554 |
|
|
my $rh = Set::Object->new(); |
555 |
|
|
foreach (@objects) { |
556 |
joko |
1.18 |
if (!isEmpty($_)) { |
557 |
|
|
#print Dumper($_); |
558 |
|
|
$rh->insert($_); |
559 |
|
|
} |
560 |
joko |
1.6 |
} |
561 |
|
|
#print Dumper($rh->members()); |
562 |
|
|
my $result = Data::Storage::Result::Tangram->new( RESULTHANDLE => $rh ); |
563 |
|
|
return $result; |
564 |
|
|
} |
565 |
|
|
|
566 |
|
|
sub sendQuery { |
567 |
|
|
my $self = shift; |
568 |
|
|
my $query = shift; |
569 |
|
|
|
570 |
|
|
#print Dumper($query); |
571 |
|
|
|
572 |
joko |
1.33 |
# type = ITEM|LIST|TRANSPARENT |
573 |
|
|
my $type = ''; |
574 |
|
|
# mode = OID|SPECIAL |
575 |
|
|
my $mode = ''; |
576 |
|
|
my $ident = ''; |
577 |
joko |
1.34 |
my $crud = ''; |
578 |
joko |
1.33 |
|
579 |
|
|
|
580 |
|
|
# dispatch type and mode |
581 |
|
|
|
582 |
|
|
# defaults - 1 |
583 |
|
|
if ($query->{options}) { |
584 |
joko |
1.34 |
$crud = $query->{options}->{crud}; |
585 |
|
|
$crud ||= $query->{options}->{action}; |
586 |
joko |
1.33 |
} |
587 |
|
|
|
588 |
|
|
# defaults - 2 |
589 |
|
|
$type ||= 'TRANSPARENT'; |
590 |
joko |
1.34 |
$crud ||= 'RETRIEVE'; |
591 |
joko |
1.33 |
|
592 |
|
|
if ($query->{options}->{OID}) { |
593 |
|
|
$type = 'ITEM'; |
594 |
|
|
$mode = 'OID'; |
595 |
|
|
$ident = $query->{options}->{OID}; |
596 |
|
|
|
597 |
|
|
} elsif (my $guid = $query->{options}->{GUID}) { |
598 |
|
|
$type = 'TRANSPARENT'; |
599 |
jonen |
1.35 |
$query->{criterias} = [ { key => 'guid', op => 'eq', val => $guid } ]; |
600 |
|
|
|
601 |
|
|
# if operator is different (dispatcher for 'getListFiltered') |
602 |
|
|
} elsif (my $op = $query->{options}->{op}) { |
603 |
|
|
$type = 'TRANSPARENT'; |
604 |
|
|
$query->{criterias} = [ { key => $query->{options}->{meta_label}, op => $op, val => $query->{options}->{meta_value} } ]; |
605 |
|
|
|
606 |
joko |
1.33 |
} |
607 |
|
|
|
608 |
|
|
# HACK: special case: querying by id does not translate into a common tangram query |
609 |
|
|
# just load the object by given identifier (OID) named 'id' - this is required by Data::Transfer::Sync! |
610 |
|
|
if ($query->{criterias} && ($query->{criterias}->[0]->{key} eq 'id' && $query->{criterias}->[0]->{op} eq 'eq')) { |
611 |
|
|
$type = 'ITEM'; |
612 |
|
|
$mode = 'SPECIAL.SYNC'; |
613 |
|
|
$ident = $query->{criterias}->[0]->{val}; |
614 |
|
|
} |
615 |
|
|
|
616 |
|
|
|
617 |
|
|
# execute query |
618 |
|
|
my $result; |
619 |
|
|
|
620 |
|
|
if ($type eq 'ITEM' && $ident) { |
621 |
joko |
1.27 |
|
622 |
joko |
1.33 |
if ($mode eq 'OID') { |
623 |
joko |
1.34 |
# TODO: review this case! |
624 |
joko |
1.33 |
$result = $self->getObject($ident, $query->{options}); |
625 |
|
|
|
626 |
|
|
} elsif ($mode eq 'SPECIAL.SYNC') { |
627 |
|
|
|
628 |
|
|
# V1 - failed |
629 |
|
|
#return Set::Object->new( $self->{COREHANDLE}->load($query->{criterias}->[0]->{val}) ); |
630 |
|
|
|
631 |
|
|
# hmm.... |
632 |
|
|
#return $self->createSet() if $ident == 5; |
633 |
|
|
|
634 |
|
|
# Unload single object before doing any further operations to |
635 |
|
|
# expect a "fresh" object from orm when performing the next calls. |
636 |
|
|
$self->{_COREHANDLE}->unload($ident); |
637 |
|
|
|
638 |
|
|
# Load object from orm. |
639 |
|
|
my $object = $self->{_COREHANDLE}->load($ident); |
640 |
|
|
|
641 |
|
|
# determine object identifier (OID) |
642 |
|
|
my $oid = $self->{_COREHANDLE}->id($object); |
643 |
|
|
|
644 |
|
|
# encapsulate into result/response container and return this one |
645 |
|
|
$result = $self->createSet($object); |
646 |
|
|
|
647 |
|
|
# debugging |
648 |
|
|
#$result = $self->createSet( $self->{COREHANDLE}->load('300090018') ); |
649 |
|
|
|
650 |
|
|
} |
651 |
|
|
|
652 |
|
|
|
653 |
|
|
} elsif ($type eq 'TRANSPARENT') { |
654 |
|
|
|
655 |
joko |
1.34 |
if ($crud eq 'RETRIEVE') { |
656 |
joko |
1.27 |
|
657 |
joko |
1.33 |
my $list = $self->getListFiltered($query->{node}, $query->{criterias}); |
658 |
|
|
#return $self->createSet($object); |
659 |
|
|
#return $self->createSet($list); |
660 |
|
|
return $self->createSet(@$list); |
661 |
|
|
|
662 |
|
|
#die("This should not be reached for now - redirect to \$self->getListFiltered() here!"); |
663 |
|
|
|
664 |
|
|
# try a generic tangram query here |
665 |
|
|
# TODO: try to place an oql on top of that (search.cpan.org!) |
666 |
|
|
my @crits; |
667 |
|
|
foreach (@{$query->{criterias}}) { |
668 |
|
|
my $op = ''; |
669 |
|
|
$op = '=' if lc $_->{op} eq 'eq'; |
670 |
|
|
push @crits, "$_->{key}$op'$_->{val}'"; |
671 |
|
|
} |
672 |
|
|
my $subnodes = {}; |
673 |
|
|
map { $subnodes->{$_}++ } @{$query->{subnodes}}; |
674 |
|
|
# HACK: this is hardcoded ;( expand possibilities! |
675 |
|
|
#my $crit = join(' AND ', @crits); |
676 |
|
|
#my $sql = hash2Sql($query->{node}, $subnodes, 'SELECT', $crit); |
677 |
|
|
#return $self->sendCommand($sql); |
678 |
|
|
#my $h = $self->{COREHANDLE}->remote($query->{node}); |
679 |
|
|
#my $res = $self->{COREHANDLE}->select($h, $h->{); |
680 |
|
|
$result = $self->createCursor($query->{node}); |
681 |
|
|
|
682 |
joko |
1.34 |
} elsif ($crud eq 'UPDATE') { |
683 |
joko |
1.33 |
|
684 |
|
|
# Patch current query to be a loader (e.g. change action, remove payload) ... |
685 |
|
|
my $childquery = deep_copy($query); |
686 |
joko |
1.34 |
$childquery->{options}->{crud} = 'RETRIEVE'; |
687 |
joko |
1.33 |
delete $childquery->{payload}; |
688 |
|
|
|
689 |
joko |
1.34 |
# ... to use it to fetch a fresh object using ourselves (sendQuery). |
690 |
joko |
1.33 |
my $cursor = $self->sendQuery($childquery); |
691 |
|
|
my $status = $cursor->getStatus(); |
692 |
|
|
my $object = $cursor->getNextEntry(); |
693 |
|
|
|
694 |
|
|
# Merge values and apply value modifiers. |
695 |
|
|
my $options = { utf8 => 1, php => 1 }; |
696 |
|
|
merge_to($object, $query->{payload}, $options); |
697 |
joko |
1.6 |
|
698 |
joko |
1.33 |
# Execute update operation at orm. |
699 |
|
|
$self->update($object); |
700 |
|
|
|
701 |
joko |
1.34 |
} elsif ($crud eq 'DELETE') { |
702 |
|
|
|
703 |
|
|
# Patch current query to be a loader (e.g. change action) ... |
704 |
|
|
my $childquery = deep_copy($query); |
705 |
|
|
$childquery->{options}->{crud} = 'RETRIEVE'; |
706 |
|
|
|
707 |
|
|
# ... to use it to fetch a fresh object using ourselves (sendQuery). |
708 |
|
|
my $cursor = $self->sendQuery($childquery); |
709 |
|
|
my $status = $cursor->getStatus(); |
710 |
|
|
my $object = $cursor->getNextEntry(); |
711 |
|
|
|
712 |
|
|
$self->erase($object); |
713 |
|
|
|
714 |
joko |
1.33 |
} |
715 |
|
|
|
716 |
|
|
} |
717 |
|
|
|
718 |
|
|
return $result; |
719 |
joko |
1.6 |
|
720 |
joko |
1.7 |
} |
721 |
|
|
|
722 |
|
|
sub eraseAll { |
723 |
|
|
my $self = shift; |
724 |
|
|
my $classname = shift; |
725 |
joko |
1.13 |
my $remote = $self->{_COREHANDLE}->remote($classname); |
726 |
|
|
my @objs = $self->{_COREHANDLE}->select($remote); |
727 |
|
|
$self->{_COREHANDLE}->erase(@objs); |
728 |
joko |
1.8 |
} |
729 |
|
|
|
730 |
|
|
sub createDb { |
731 |
|
|
my $self = shift; |
732 |
|
|
my $storage = $self->_getSubLayerHandle(); |
733 |
|
|
return $storage->createDb(); |
734 |
joko |
1.9 |
} |
735 |
|
|
|
736 |
|
|
sub getObject { |
737 |
|
|
my $self = shift; |
738 |
|
|
my $oid = shift; |
739 |
jonen |
1.14 |
my $options = shift; |
740 |
joko |
1.16 |
|
741 |
|
|
# TODO: create a deep_unload method (currently _all_ objects are unloaded) |
742 |
jonen |
1.14 |
# unload($oid) will only unload object, not deep object hashes |
743 |
joko |
1.17 |
$self->{_COREHANDLE}->unload() if ($options->{destroy}); |
744 |
joko |
1.16 |
|
745 |
joko |
1.9 |
# TODO: review this |
746 |
|
|
#if (!$self->{COREHANDLE}) { return; } |
747 |
joko |
1.16 |
|
748 |
|
|
# TODO: review this |
749 |
|
|
my $object = eval('$self->{_COREHANDLE}->load($oid);'); |
750 |
|
|
print $@, "\n" if $@; |
751 |
|
|
|
752 |
|
|
return $object if $object; |
753 |
joko |
1.9 |
} |
754 |
|
|
|
755 |
joko |
1.33 |
sub getObjectByGuid_old { |
756 |
jonen |
1.20 |
my $self = shift; |
757 |
|
|
my $guid = shift; |
758 |
|
|
my $options = shift; |
759 |
|
|
|
760 |
|
|
# Guid and Classname is needed |
761 |
|
|
if(!$guid || !$options->{classname}) { |
762 |
jonen |
1.22 |
$logger->error( __PACKAGE__ . "->getObjectByGuid: No 'guid' OR no Classname in options hash was given but needed!" ); |
763 |
jonen |
1.20 |
return; |
764 |
|
|
} |
765 |
|
|
|
766 |
|
|
# TODO: create a deep_unload method (currently _all_ objects are unloaded) |
767 |
|
|
# unload($oid) will only unload object, not deep object hashes |
768 |
|
|
$self->{_COREHANDLE}->unload() if ($options->{destroy}); |
769 |
|
|
|
770 |
|
|
# search for object with given Classname and Guid |
771 |
jonen |
1.21 |
my $obj_tmp = $self->{_COREHANDLE}->remote($options->{classname}); |
772 |
jonen |
1.20 |
my @result = $self->{_COREHANDLE}->select($obj_tmp, $obj_tmp->{guid} eq $guid); |
773 |
|
|
|
774 |
|
|
# we searched for global unique identifer of some object, |
775 |
jonen |
1.22 |
# so I think we can trust there would be only one result |
776 |
jonen |
1.20 |
if($result[0]) { |
777 |
|
|
return $result[0]; |
778 |
|
|
} else { |
779 |
jonen |
1.22 |
$logger->error( __PACKAGE__ . "->getObjectByGuid: No Object with Classname $options->{classname} and GUID $guid found!" ); |
780 |
|
|
return; |
781 |
jonen |
1.20 |
} |
782 |
|
|
|
783 |
|
|
} |
784 |
|
|
|
785 |
joko |
1.33 |
sub getObjectAsHash_old { |
786 |
joko |
1.9 |
my $self = shift; |
787 |
|
|
my $oid = shift; |
788 |
jonen |
1.20 |
my $options = shift; |
789 |
|
|
my $obj; |
790 |
|
|
|
791 |
|
|
if($options->{guid}) { |
792 |
|
|
$obj = $self->getObjectByGuid($oid, $options); |
793 |
|
|
} else { |
794 |
|
|
$obj = $self->getObject($oid, $options); |
795 |
|
|
} |
796 |
joko |
1.15 |
|
797 |
|
|
# build options (a callback to unload autovivified objects) for 'expand' |
798 |
|
|
# TODO: use $logger to write to debug here! |
799 |
|
|
my $cb; # = sub {}; |
800 |
joko |
1.29 |
|
801 |
|
|
# deactivated way to get rid of used instances, if requested |
802 |
joko |
1.15 |
=pod |
803 |
joko |
1.29 |
if ($options->{destroy}) { |
804 |
|
|
$options->{cb}->{destroy} = sub { |
805 |
|
|
print "================ DESTROY", "\n"; |
806 |
|
|
my $object = shift; |
807 |
|
|
#print Dumper($object); |
808 |
|
|
$self->{_COREHANDLE}->unload($object); |
809 |
|
|
#undef($object); |
810 |
|
|
}; |
811 |
|
|
} |
812 |
joko |
1.15 |
=cut |
813 |
|
|
|
814 |
joko |
1.28 |
my $hash = expand($obj, $options); |
815 |
joko |
1.29 |
|
816 |
|
|
# old (unsuccessful) attempts to get rid of used instances, if requested |
817 |
|
|
|
818 |
|
|
# V1: |
819 |
|
|
#$options->{cb}->{destroy}->($obj); |
820 |
|
|
#$self->{_COREHANDLE}->unload($obj); |
821 |
joko |
1.15 |
|
822 |
joko |
1.29 |
# V2: |
823 |
joko |
1.15 |
#$obj->clear_refs; |
824 |
|
|
#$self->{COREHANDLE}->unload($obj) if($options->{destroy}); |
825 |
|
|
#$obj->DESTROY; |
826 |
|
|
#undef($obj) if($options->{destroy}); |
827 |
|
|
|
828 |
|
|
return $hash; |
829 |
joko |
1.12 |
} |
830 |
|
|
|
831 |
|
|
sub getSchema { |
832 |
|
|
return $schema_tangram; |
833 |
joko |
1.13 |
} |
834 |
|
|
|
835 |
|
|
sub getCOREHANDLE { |
836 |
|
|
my $self = shift; |
837 |
|
|
return $self->{_COREHANDLE}; |
838 |
joko |
1.24 |
} |
839 |
|
|
|
840 |
|
|
sub dropDb { |
841 |
|
|
my $self = shift; |
842 |
|
|
my $storage = $self->_getSubLayerHandle(); |
843 |
|
|
return $storage->dropDb(); |
844 |
cvsjoko |
1.1 |
} |
845 |
|
|
|
846 |
joko |
1.26 |
sub testAvailability { |
847 |
|
|
my $self = shift; |
848 |
|
|
my $storage = $self->_getSubLayerHandle(); |
849 |
|
|
return $storage->testAvailability(); |
850 |
joko |
1.28 |
} |
851 |
|
|
|
852 |
|
|
sub disconnect2 { |
853 |
|
|
my $self = shift; |
854 |
|
|
my $storage = $self->_getSubLayerHandle(); |
855 |
|
|
print "DISC!", "\n"; |
856 |
|
|
|
857 |
|
|
my $storage_ll = $storage->{_COREHANDLE}; |
858 |
|
|
$storage_ll->disconnect(); |
859 |
|
|
|
860 |
|
|
print Dumper($storage); |
861 |
|
|
exit; |
862 |
|
|
|
863 |
|
|
#$self->{_COREHANDLE} |
864 |
|
|
#$storage->disconnect(); |
865 |
|
|
$self->{dataStorageLayer}->disconnect(); |
866 |
joko |
1.26 |
} |
867 |
|
|
|
868 |
cvsjoko |
1.1 |
1; |
869 |
joko |
1.26 |
__END__ |