2 |
## $Id$ |
## $Id$ |
3 |
## ------------------------------------------------------------------------ |
## ------------------------------------------------------------------------ |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.15 2003/02/20 20:19:13 joko |
6 |
|
## tried to get auto-disconnect working again - failed with that |
7 |
|
## |
8 |
|
## Revision 1.14 2003/02/09 05:12:28 joko |
9 |
|
## + quoting of strings used in sql-queries! |
10 |
|
## |
11 |
|
## Revision 1.13 2003/01/30 22:27:05 joko |
12 |
|
## + added new abstract methods |
13 |
|
## |
14 |
|
## Revision 1.12 2003/01/30 21:46:32 joko |
15 |
|
## + fixed behaviour of AUTOLOAD-method |
16 |
|
## |
17 |
## Revision 1.11 2003/01/20 16:43:18 joko |
## Revision 1.11 2003/01/20 16:43:18 joko |
18 |
## + better argument-property merging |
## + better argument-property merging |
19 |
## + debugging-output !!! |
## + debugging-output !!! |
64 |
use Data::Dumper; |
use Data::Dumper; |
65 |
use Tie::SecureHash; |
use Tie::SecureHash; |
66 |
#use Data::Storage::Handler; |
#use Data::Storage::Handler; |
67 |
use Data::Transform::Deep qw( merge ); |
use Hash::Merge qw( merge ); |
68 |
|
|
69 |
|
|
70 |
# get logger instance |
# get logger instance |
187 |
# this is to prevent deep recursion's |
# this is to prevent deep recursion's |
188 |
return if lc $methodname eq 'exists'; |
return if lc $methodname eq 'exists'; |
189 |
|
|
190 |
print "$methodname - 1", "\n"; |
#print "$methodname - 1", "\n"; |
191 |
|
|
192 |
# TODO: enhance logging/debugging |
# TODO: enhance logging/debugging |
193 |
#if (!$self->exists('COREHANDLE')) { return; } |
#if (!$self->exists('COREHANDLE')) { return; } |
200 |
} |
} |
201 |
$self->{lock_info}->{last_method} = $methodname; |
$self->{lock_info}->{last_method} = $methodname; |
202 |
|
|
203 |
print "$methodname - 2", "\n"; |
#print "$methodname - 2", "\n"; |
204 |
|
|
205 |
#print Dumper($self); |
#print Dumper($self); |
206 |
#exit; |
#exit; |
222 |
$handlertype ||= ''; |
$handlertype ||= ''; |
223 |
|
|
224 |
my $err_msg_core = __PACKAGE__ . "[$handlertype]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\""; |
my $err_msg_core = __PACKAGE__ . "[$handlertype]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\""; |
225 |
print $err_msg_core, "\n"; |
|
226 |
if ($self->exists('lock_info') && !$self->{lock_info}->{log_lock}) { |
#print $err_msg_core, "\n"; |
227 |
|
|
228 |
|
#if ($self->exists('lock_info') && !$self->{lock_info}->{log_lock}) { |
229 |
$logger->error( $err_msg_core ); |
$logger->error( $err_msg_core ); |
230 |
} |
#} |
231 |
|
|
232 |
return; |
return; |
233 |
|
|
234 |
} |
} |
235 |
#=cut |
#=cut |
236 |
|
|
283 |
|
|
284 |
sub DESTROY { |
sub DESTROY { |
285 |
my $self = shift; |
my $self = shift; |
286 |
#if ($self->{COREHANDLE}) { |
|
287 |
if ($self->exists('_COREHANDLE')) { |
return; |
288 |
|
|
289 |
|
$logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" ); |
290 |
|
|
291 |
|
my $disconnectMethod = $self->{metainfo}->{disconnectMethod}; |
292 |
|
print "meth: ", $disconnectMethod, "\n"; |
293 |
|
|
294 |
|
#$disconnectMethod && $self->{_COREHANDLE} && ( $self->{_COREHANDLE}->$disconnectMethod() ); |
295 |
|
$self->{_COREHANDLE}->$disconnectMethod(); |
296 |
|
#$self->$disconnectMethod(); |
297 |
|
|
298 |
|
#my $core1 = $self->getCOREHANDLE() if $self->can('getCOREHANDLE'); |
299 |
|
#$core1->$disconnectMethod(); |
300 |
|
|
301 |
|
return; |
302 |
|
|
303 |
|
print "DESTROY-1", "\n"; |
304 |
|
#if ($self->{__COREHANDLE}) { |
305 |
|
#if ($self->exists('_COREHANDLE')) { |
306 |
|
|
307 |
|
# get corehandle instance from underlying handler |
308 |
|
my $core; |
309 |
|
$core = $self->getCOREHANDLE() if $self->can('getCOREHANDLE'); |
310 |
|
|
311 |
|
#if ($self->{STORAGEHANDLE}) { |
312 |
|
if ($core) { |
313 |
|
print "DESTROY-2", "\n"; |
314 |
$logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" ); |
$logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" ); |
315 |
|
|
316 |
my $disconnectMethod = $self->{metainfo}->{disconnectMethod}; |
my $disconnectMethod = $self->{metainfo}->{disconnectMethod}; |
337 |
sub existsChildNode { |
sub existsChildNode { |
338 |
my $self = shift; |
my $self = shift; |
339 |
my $nodename = shift; |
my $nodename = shift; |
340 |
#$nodename = 'TransactionRoutingTable'; |
|
341 |
$logger->debug( __PACKAGE__ . "->existsChildNode( nodename $nodename )" ); |
# TODO: don't use $self->{meta}->{childnodes} directly in here |
342 |
|
# get it returned from $self->getChildNodes()!!! |
343 |
|
|
344 |
|
$logger->debug( __PACKAGE__ . "->existsChildNode( nodename=$nodename )" ); |
345 |
$self->getChildNodes() unless $self->{meta}->{childnodes}; |
$self->getChildNodes() unless $self->{meta}->{childnodes}; |
346 |
my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}}); # TODO: use "/i" only on win32-systems! |
|
347 |
|
# quote this, it might contain meta characters which don't work in a regex |
348 |
|
$nodename = quotemeta($nodename); |
349 |
|
|
350 |
|
# trace |
351 |
|
#print Dumper($self->{meta}); |
352 |
|
#print "nodename: $nodename", "\n"; |
353 |
|
|
354 |
|
# FIXME: use "/i" only on win32-systems! |
355 |
|
my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}}); |
356 |
|
|
357 |
return $result; |
return $result; |
358 |
} |
} |
359 |
|
|
474 |
return; |
return; |
475 |
} |
} |
476 |
|
|
477 |
|
sub getDbName { |
478 |
|
my $self = shift; |
479 |
|
$self->_abstract_function('getDbName'); |
480 |
|
return; |
481 |
|
} |
482 |
|
|
483 |
|
sub testAvailability { |
484 |
|
my $self = shift; |
485 |
|
$self->_abstract_function('testAvailability'); |
486 |
|
return; |
487 |
|
} |
488 |
|
|
489 |
|
sub isConnected { |
490 |
|
my $self = shift; |
491 |
|
$self->_abstract_function('isConnected'); |
492 |
|
return; |
493 |
|
} |
494 |
|
|
495 |
|
sub testDsn { |
496 |
|
my $self = shift; |
497 |
|
$self->_abstract_function('testDsn'); |
498 |
|
return; |
499 |
|
} |
500 |
|
|
501 |
1; |
1; |