line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#############################################################################
|
2
|
|
|
|
|
|
|
## Name: HDB.pm
|
3
|
|
|
|
|
|
|
## Purpose: HDB - Hybrid database
|
4
|
|
|
|
|
|
|
## Author: Graciliano M. P.
|
5
|
|
|
|
|
|
|
## Modified by:
|
6
|
|
|
|
|
|
|
## Created: 06/01/2003
|
7
|
|
|
|
|
|
|
## RCS-ID:
|
8
|
|
|
|
|
|
|
## Copyright: (c) 2003 Graciliano M. P.
|
9
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or
|
10
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself
|
11
|
|
|
|
|
|
|
#############################################################################
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package HDB ;
|
14
|
1
|
|
|
1
|
|
85114
|
use 5.006 ;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
5
|
use strict qw(vars) ;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA $AUTOLOAD) ;
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
50
|
|
19
|
1
|
|
|
1
|
|
6
|
no warnings ;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
132
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our ($VERSION) ;
|
22
|
|
|
|
|
|
|
$VERSION = '1.05' ;
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $REQUIRED ;
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
###########
|
27
|
|
|
|
|
|
|
# REQUIRE #
|
28
|
|
|
|
|
|
|
###########
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub REQUIRE {
|
31
|
1
|
50
|
|
1
|
0
|
10
|
return if $REQUIRED ;
|
32
|
1
|
|
|
|
|
809
|
require HDB::CORE ;
|
33
|
1
|
|
|
|
|
1215
|
require HDB::CMDS ;
|
34
|
1
|
|
|
|
|
2124
|
require HDB::Encode ;
|
35
|
1
|
|
|
|
|
1279
|
require HDB::MOD ;
|
36
|
1
|
|
|
|
|
811
|
require HDB::Object ;
|
37
|
0
|
|
|
|
|
0
|
$REQUIRED = 1 ;
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
##########
|
41
|
|
|
|
|
|
|
# SCOPES #
|
42
|
|
|
|
|
|
|
##########
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
5
|
use vars qw($HPL_Run_MAIN $HPL_Run_NOW) ;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2150
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
*HPL_Run_MAIN = \$HPL::Run::MAIN ;
|
47
|
|
|
|
|
|
|
*HPL_Run_NOW = \$HPL::Run::NOW ;
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
############
|
50
|
|
|
|
|
|
|
# HPL_MAIN #
|
51
|
|
|
|
|
|
|
############
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub HPL_MAIN {
|
54
|
0
|
0
|
|
0
|
0
|
0
|
return $HPL_Run_MAIN if UNIVERSAL::isa($HPL_Run_MAIN,'UNIVERSAL') ;
|
55
|
0
|
0
|
|
|
|
0
|
return $main::HPL if UNIVERSAL::isa($main::HPL,'UNIVERSAL') ;
|
56
|
0
|
|
|
|
|
0
|
return ${"main::HPL"} ;
|
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
}
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
########
|
60
|
|
|
|
|
|
|
# VARS #
|
61
|
|
|
|
|
|
|
########
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my %args_types = (
|
64
|
|
|
|
|
|
|
file => [qw(file dbfile databasefile db database)] ,
|
65
|
|
|
|
|
|
|
db => [qw(db database)] ,
|
66
|
|
|
|
|
|
|
host => [[qw(host hostname)],localhost] ,
|
67
|
|
|
|
|
|
|
user => [qw(user username)] ,
|
68
|
|
|
|
|
|
|
pass => [qw(pass password)] ,
|
69
|
|
|
|
|
|
|
type => [[qw(type dbtype databasetype dbd)],auto] ,
|
70
|
|
|
|
|
|
|
cache => [[qw(cache)],1] ,
|
71
|
|
|
|
|
|
|
id => [qw(id ident)] ,
|
72
|
|
|
|
|
|
|
warning => [[qw(warning warnings error errors alert alerts carp)],1] ,
|
73
|
|
|
|
|
|
|
dynamic => [[qw(dynamic dyn)],1] ,
|
74
|
|
|
|
|
|
|
conf_hpl => [qw(confhpl hplconf)] ,
|
75
|
|
|
|
|
|
|
);
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my (%PASS , %DB , $WITH_HPL , %MOD_LOADED , $RESET_X) ;
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
##########
|
80
|
|
|
|
|
|
|
# IMPORT #
|
81
|
|
|
|
|
|
|
##########
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub import {
|
84
|
1
|
|
|
1
|
|
8
|
my $class = shift ;
|
85
|
1
|
50
|
|
|
|
461
|
if ($_[0] =~ /HPL/i) {
|
86
|
0
|
|
|
|
|
0
|
$WITH_HPL = 1 ;
|
87
|
0
|
|
|
|
|
0
|
&REQUIRE() ;
|
88
|
|
|
|
|
|
|
}
|
89
|
|
|
|
|
|
|
}
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
############
|
92
|
|
|
|
|
|
|
# AUTOLOAD #
|
93
|
|
|
|
|
|
|
############
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub AUTOLOAD {
|
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
0
|
0
|
|
0
|
if ( $#_ == 0 && ref($_[0]) && UNIVERSAL::isa($_[0],'HDB') ) {
|
|
|
|
0
|
|
|
|
|
98
|
0
|
0
|
|
|
|
0
|
if ( ref($_[0]) eq 'HDB' ) {
|
99
|
0
|
|
|
|
|
0
|
my $this = shift ;
|
100
|
0
|
|
|
|
|
0
|
my $type = $this->{MOD}{type} ;
|
101
|
0
|
|
|
|
|
0
|
bless($this , "HDB::MOD::$type") ;
|
102
|
0
|
|
|
|
|
0
|
$this->connect ;
|
103
|
0
|
|
|
|
|
0
|
my ($method) = ( $AUTOLOAD =~ /(\w+)$/s );
|
104
|
0
|
|
|
|
|
0
|
$this->$method(@_) ;
|
105
|
|
|
|
|
|
|
}
|
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
0
|
my ($table) = ( $AUTOLOAD =~ /(\w+)$/s ) ;
|
108
|
0
|
|
|
|
|
0
|
my $TABLE_OBJ = HDB::TABLE->new($_[0] , $table) ;
|
109
|
0
|
|
|
|
|
0
|
return $TABLE_OBJ ;
|
110
|
|
|
|
|
|
|
}
|
111
|
|
|
|
|
|
|
|
112
|
0
|
0
|
|
|
|
0
|
if (ref($_[0])) {
|
113
|
0
|
|
|
|
|
0
|
my @caller = caller ;
|
114
|
0
|
|
|
|
|
0
|
&HDB::Error(undef,qq`Can't find $AUTOLOAD at $caller[1] line $caller[2]!`) ;
|
115
|
0
|
|
|
|
|
0
|
return undef ;
|
116
|
|
|
|
|
|
|
}
|
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
0
|
my ($id0) = ( $AUTOLOAD =~ /(\w+)$/ ) ;
|
119
|
0
|
|
|
|
|
0
|
my $id = lc($id0) ;
|
120
|
|
|
|
|
|
|
|
121
|
0
|
0
|
0
|
|
|
0
|
if ( $WITH_HPL && $id ne '' ) {
|
122
|
0
|
|
|
|
|
0
|
my $hpl = &HPL_MAIN() ;
|
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
0
|
if ( $hpl ) {
|
125
|
0
|
|
|
|
|
0
|
my $hpl_root = $hpl->pack_root ;
|
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
0
|
|
|
0
|
if ( $id eq 'hploo' && !${"$hpl_root\::MYHDB::DB"}{$id} ) {
|
|
0
|
|
|
|
|
0
|
|
128
|
0
|
|
|
|
|
0
|
$id = (sort keys %{"$hpl_root\::MYHDB::DB"})[0] ;
|
|
0
|
|
|
|
|
0
|
|
129
|
0
|
0
|
|
|
|
0
|
if ( $id ) {
|
130
|
0
|
|
|
|
|
0
|
$hpl->warn(qq`HDB id HPLOO not defined, using 1st defined DB for HDB::Object persistence.` , 1) ;
|
131
|
0
|
|
|
|
|
0
|
${"$hpl_root\::MYHDB::DB"}{hploo} = ${"$hpl_root\::MYHDB::DB"}{$id} ;
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
132
|
|
|
|
|
|
|
}
|
133
|
|
|
|
|
|
|
}
|
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
0
|
my $obj = ${"$hpl_root\::MYHDB::DB"}{$id} ;
|
|
0
|
|
|
|
|
0
|
|
136
|
0
|
0
|
|
|
|
0
|
if (!$obj) { $hpl->warn(qq`Can't find HDB id "$id" for dynamic access $_[0]\->$id0 !`) ;}
|
|
0
|
|
|
|
|
0
|
|
137
|
0
|
|
|
|
|
0
|
return $obj ;
|
138
|
|
|
|
|
|
|
}
|
139
|
|
|
|
|
|
|
}
|
140
|
|
|
|
|
|
|
else {
|
141
|
0
|
0
|
|
|
|
0
|
if (! $DB{$id}) { &HDB::Error(undef,qq`Can't find HDB id "$id" for dynamic access $_[0]\->$id0 !`) ;}
|
|
0
|
|
|
|
|
0
|
|
142
|
0
|
|
|
|
|
0
|
return $DB{$id} ;
|
143
|
|
|
|
|
|
|
}
|
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
0
|
return undef ;
|
146
|
|
|
|
|
|
|
}
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
###########
|
149
|
|
|
|
|
|
|
# ALIASES #
|
150
|
|
|
|
|
|
|
###########
|
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
0
|
0
|
0
|
sub WITH_HPL { $WITH_HPL ;}
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub open {
|
155
|
0
|
0
|
0
|
0
|
1
|
0
|
if ( ref $_[0] && UNIVERSAL::isa($_[0],'HDB') ) {
|
156
|
0
|
|
|
|
|
0
|
$_[0]->connect ;
|
157
|
0
|
|
|
|
|
0
|
return $_[0] ;
|
158
|
|
|
|
|
|
|
}
|
159
|
0
|
|
|
|
|
0
|
else { return &new(@_) ;}
|
160
|
|
|
|
|
|
|
}
|
161
|
|
|
|
|
|
|
|
162
|
0
|
|
|
0
|
0
|
0
|
sub close { $_[0]->disconnect ;}
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
#######
|
165
|
|
|
|
|
|
|
# NEW #
|
166
|
|
|
|
|
|
|
#######
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub new {
|
169
|
0
|
|
|
0
|
1
|
0
|
&REQUIRE() ;
|
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
my $class = shift ;
|
172
|
0
|
|
|
|
|
0
|
my $this = {} ;
|
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
0
|
&HDB::CORE::parse_args($this , \%args_types , @_) ;
|
175
|
0
|
0
|
|
|
|
0
|
$this->{file} = &HDB::CORE::path($this->{file}) if defined $this->{file} ;
|
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
0
|
$this->{id} =~ s/\W//s ;
|
178
|
0
|
|
|
|
|
0
|
$this->{id} = lc( $this->{id} ) ;
|
179
|
|
|
|
|
|
|
|
180
|
0
|
0
|
|
|
|
0
|
if ( $this->{type} eq 'auto' ) {
|
181
|
0
|
0
|
|
|
|
0
|
if ( defined $this->{file} ) { $this->{type} = 'sqlite' ;}
|
|
0
|
|
|
|
|
0
|
|
182
|
0
|
|
|
|
|
0
|
else { $this->{type} = 'mysql' ;}
|
183
|
|
|
|
|
|
|
}
|
184
|
|
|
|
|
|
|
else {
|
185
|
0
|
|
|
|
|
0
|
my $type = $this->{type} ;
|
186
|
0
|
|
|
|
|
0
|
$this->{type} =~ s/\W//gs ;
|
187
|
0
|
|
|
|
|
0
|
$this->{type} = lc( $this->{type} ) ;
|
188
|
|
|
|
|
|
|
}
|
189
|
|
|
|
|
|
|
|
190
|
0
|
0
|
|
|
|
0
|
return Error($this,"Invalid type!") if $this->{type} eq '' ;
|
191
|
|
|
|
|
|
|
|
192
|
0
|
|
|
|
|
0
|
my $type = $this->{type} ;
|
193
|
|
|
|
|
|
|
|
194
|
0
|
0
|
|
|
|
0
|
if ( !&_require_module($type) ) { return Error($this,"Can't find HDB module for $type (HDB::MOD::$type)!") ;}
|
|
0
|
|
|
|
|
0
|
|
195
|
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
0
|
&{"HDB::MOD::$type\::new"}($this) ;
|
|
0
|
|
|
|
|
0
|
|
197
|
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
0
|
return $this->Error("Error on loanding HDB module $type (HDB::MOD::$type)!") if !$this ;
|
199
|
|
|
|
|
|
|
|
200
|
0
|
0
|
0
|
|
|
0
|
if ( ($this->{conf_hpl} || $WITH_HPL ) && $this->{file} ) {
|
|
|
|
0
|
|
|
|
|
201
|
0
|
|
|
|
|
0
|
my $hpl = &HPL_MAIN() ;
|
202
|
0
|
0
|
|
|
|
0
|
if ( defined $hpl->env->{DOCUMENT_ROOT} ) {
|
203
|
0
|
|
|
|
|
0
|
$this->{file} =~ s/^[\/\\][\/\\]/$hpl->env->{DOCUMENT_ROOT}/se ;
|
|
0
|
|
|
|
|
0
|
|
204
|
|
|
|
|
|
|
}
|
205
|
|
|
|
|
|
|
}
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
## "HIDDE" PASS:
|
208
|
0
|
|
|
|
|
0
|
$PASS{$this} = $this->{pass} ;
|
209
|
0
|
|
|
|
|
0
|
delete $this->{pass} ;
|
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
0
|
eval { $this->connect };
|
|
0
|
|
|
|
|
0
|
|
212
|
|
|
|
|
|
|
|
213
|
0
|
0
|
0
|
|
|
0
|
if ( !$this || !$this->connected || !$this->dbh ) { $this->Error("Can't connect to DB. Load error!") ; return ;}
|
|
0
|
|
0
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
214
|
|
|
|
|
|
|
|
215
|
0
|
0
|
0
|
|
|
0
|
if ($this->{dynamic} && $this->{id} ne '') {
|
216
|
0
|
0
|
|
|
|
0
|
if ( $WITH_HPL ) {
|
217
|
0
|
|
|
|
|
0
|
$this->{WITH_HPL} = 1 ;
|
218
|
0
|
|
|
|
|
0
|
my $hpl = &HPL_MAIN() ;
|
219
|
0
|
0
|
|
|
|
0
|
if ( $hpl ) {
|
220
|
0
|
|
|
|
|
0
|
my $hpl_root = $hpl->pack_root ;
|
221
|
0
|
|
|
|
|
0
|
${"$hpl_root\::MYHDB::DB"}{ $this->{id} } = $this ;
|
|
0
|
|
|
|
|
0
|
|
222
|
|
|
|
|
|
|
}
|
223
|
|
|
|
|
|
|
}
|
224
|
0
|
|
|
|
|
0
|
else { $DB{ $this->{id} } = $this ;}
|
225
|
|
|
|
|
|
|
}
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
0
|
0
|
|
|
|
0
|
if ( $WITH_HPL ) {
|
229
|
0
|
|
|
|
|
0
|
$this->dbh->{HandleError} = \&HPL_show_error ;
|
230
|
|
|
|
|
|
|
}
|
231
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
0
|
return $this ;
|
233
|
|
|
|
|
|
|
}
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
##################
|
236
|
|
|
|
|
|
|
# HPL_SHOW_ERROR #
|
237
|
|
|
|
|
|
|
##################
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub HPL_show_error {
|
240
|
0
|
|
|
0
|
0
|
0
|
my $hpl = &HPL_MAIN() ;
|
241
|
0
|
0
|
|
|
|
0
|
$hpl->warn($_[0]) if $hpl ;
|
242
|
0
|
|
|
|
|
0
|
return $_[2] ;
|
243
|
|
|
|
|
|
|
}
|
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
###########
|
246
|
|
|
|
|
|
|
# CONNECT #
|
247
|
|
|
|
|
|
|
###########
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub connect {
|
250
|
0
|
0
|
|
0
|
1
|
0
|
if ( $_[0]->{dbh} ) { return $_[0]->{dbh} ;}
|
|
0
|
|
|
|
|
0
|
|
251
|
0
|
|
|
|
|
0
|
$_[0]->MOD_connect( $PASS{$_[0]} ) ;
|
252
|
0
|
|
|
|
|
0
|
return $_[0]->{dbh} ;
|
253
|
|
|
|
|
|
|
}
|
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
#############
|
256
|
|
|
|
|
|
|
# RECONNECT #
|
257
|
|
|
|
|
|
|
#############
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
sub reconnect {
|
260
|
0
|
|
|
0
|
1
|
0
|
$_[0]->disconnect ;
|
261
|
0
|
|
|
|
|
0
|
$_[0]->connect ;
|
262
|
|
|
|
|
|
|
}
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
#########
|
265
|
|
|
|
|
|
|
# ERROR #
|
266
|
|
|
|
|
|
|
#########
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
sub Error {
|
269
|
|
|
|
|
|
|
|
270
|
0
|
0
|
|
0
|
0
|
0
|
if ( $_[0]->{sth} ) {
|
271
|
0
|
|
|
|
|
0
|
$_[0]->{sth}->finish ;
|
272
|
0
|
|
|
|
|
0
|
$_[0]->{sth} = undef ;
|
273
|
|
|
|
|
|
|
}
|
274
|
|
|
|
|
|
|
|
275
|
0
|
0
|
0
|
|
|
0
|
if ($_[0] && !$_[0]->{warning}) { return ;}
|
|
0
|
|
|
|
|
0
|
|
276
|
0
|
0
|
0
|
|
|
0
|
if ($_[0] && ref $_[0]->{warning} eq 'CODE') { &{$_[0]->{warning}}($_[1]) }
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
277
|
|
|
|
|
|
|
else {
|
278
|
0
|
0
|
|
|
|
0
|
if ($WITH_HPL) {
|
279
|
0
|
|
|
|
|
0
|
my $hpl = &HPL_MAIN() ;
|
280
|
0
|
0
|
|
|
|
0
|
$hpl->warn($_[1] , $_[2]) if $hpl ;
|
281
|
|
|
|
|
|
|
}
|
282
|
|
|
|
|
|
|
else {
|
283
|
0
|
|
|
|
|
0
|
eval {
|
284
|
0
|
|
|
|
|
0
|
require Carp ;
|
285
|
0
|
|
|
|
|
0
|
Carp::carp($_[1]) ;
|
286
|
|
|
|
|
|
|
};
|
287
|
|
|
|
|
|
|
}
|
288
|
|
|
|
|
|
|
}
|
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
0
|
return ;
|
291
|
|
|
|
|
|
|
}
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
###################
|
294
|
|
|
|
|
|
|
# _REQUIRE_MODULE #
|
295
|
|
|
|
|
|
|
###################
|
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub _require_module {
|
298
|
0
|
|
|
0
|
|
0
|
my ( $module ) = @_ ;
|
299
|
0
|
0
|
|
|
|
0
|
return 1 if $MOD_LOADED{$module} ;
|
300
|
0
|
|
|
|
|
0
|
eval("require HDB::MOD::$module ;") ;
|
301
|
0
|
0
|
|
|
|
0
|
return undef if $@ ;
|
302
|
0
|
|
|
|
|
0
|
return $MOD_LOADED{$module} = 1 ;
|
303
|
|
|
|
|
|
|
}
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
###########
|
306
|
|
|
|
|
|
|
# DESTROY #
|
307
|
|
|
|
|
|
|
###########
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub DESTROY {
|
310
|
0
|
|
|
0
|
|
0
|
delete $PASS{$_[0]} ;
|
311
|
0
|
|
|
|
|
0
|
$_[0]->disconnect ;
|
312
|
|
|
|
|
|
|
}
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
#########
|
315
|
|
|
|
|
|
|
# RESET #
|
316
|
|
|
|
|
|
|
#########
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub RESET {
|
319
|
1
|
|
|
1
|
0
|
5
|
++$RESET_X ;
|
320
|
|
|
|
|
|
|
|
321
|
1
|
0
|
0
|
|
|
6
|
HDB::Object::RESET() if defined &HDB::Object::RESET && (!$WITH_HPL || $RESET_X > 10) ;
|
|
|
|
33
|
|
|
|
|
322
|
|
|
|
|
|
|
|
323
|
1
|
50
|
|
|
|
4
|
if ( $WITH_HPL ) {
|
324
|
0
|
|
|
|
|
0
|
my $hpl = &HPL_MAIN() ;
|
325
|
0
|
0
|
|
|
|
0
|
if ( $hpl ) {
|
326
|
0
|
|
|
|
|
0
|
my $HDB_LINKED = \%{ $hpl->pack_root ."::MYHDB::DB"} ;
|
|
0
|
|
|
|
|
0
|
|
327
|
0
|
|
|
|
|
0
|
%$HDB_LINKED = () ;
|
328
|
0
|
|
|
|
|
0
|
undef %$HDB_LINKED ;
|
329
|
0
|
|
|
|
|
0
|
eval {
|
330
|
0
|
|
|
|
|
0
|
foreach my $Key ( keys %$HDB_LINKED ) { $$HDB_LINKED{$Key}->UNLINK ;}
|
|
0
|
|
|
|
|
0
|
|
331
|
|
|
|
|
|
|
};
|
332
|
|
|
|
|
|
|
}
|
333
|
|
|
|
|
|
|
}
|
334
|
|
|
|
|
|
|
|
335
|
1
|
|
|
|
|
2
|
%DB = () ;
|
336
|
|
|
|
|
|
|
|
337
|
1
|
50
|
33
|
|
|
12
|
HDB::Parser::RESET() if defined &HDB::Parser::RESET && (!$WITH_HPL || $RESET_X > 10) ;
|
|
|
|
33
|
|
|
|
|
338
|
|
|
|
|
|
|
|
339
|
1
|
50
|
|
|
|
8
|
$RESET_X = 0 if $RESET_X > 10 ;
|
340
|
|
|
|
|
|
|
|
341
|
1
|
|
|
|
|
7
|
return 1 ;
|
342
|
|
|
|
|
|
|
}
|
343
|
|
|
|
|
|
|
|
344
|
1
|
|
|
1
|
|
67
|
sub END { &RESET }
|
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
#########
|
347
|
|
|
|
|
|
|
# TABLE #
|
348
|
|
|
|
|
|
|
#########
|
349
|
|
|
|
|
|
|
|
350
|
0
|
|
|
0
|
0
|
|
sub TABLE { HDB::TABLE->new(@_) ;}
|
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
##############
|
353
|
|
|
|
|
|
|
# HDB::TABLE #
|
354
|
|
|
|
|
|
|
##############
|
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
package HDB::TABLE ;
|
357
|
|
|
|
|
|
|
|
358
|
1
|
|
|
1
|
|
70
|
use vars qw($AUTOLOAD) ;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
272
|
|
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
#######
|
361
|
|
|
|
|
|
|
# NEW #
|
362
|
|
|
|
|
|
|
#######
|
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub new {
|
365
|
0
|
|
|
0
|
|
|
bless({
|
366
|
|
|
|
|
|
|
hdb => $_[1] ,
|
367
|
|
|
|
|
|
|
table => $_[2] ,
|
368
|
|
|
|
|
|
|
},$_[0]) ;
|
369
|
|
|
|
|
|
|
}
|
370
|
|
|
|
|
|
|
|
371
|
0
|
|
|
0
|
|
|
sub DESTROY {
|
372
|
|
|
|
|
|
|
##print main::STDOUT "DESTROY>> @_\n" ;
|
373
|
|
|
|
|
|
|
}
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub AUTOLOAD {
|
376
|
0
|
|
|
0
|
|
|
my $obj = shift ;
|
377
|
0
|
|
|
|
|
|
my ($method) = ( $AUTOLOAD =~ /(\w+)$/s ) ;
|
378
|
0
|
|
|
|
|
|
my $class = ref $obj->{hdb} ;
|
379
|
0
|
|
|
|
|
|
return ($obj->{hdb})->$method($obj->{table} , @_) ;
|
380
|
|
|
|
|
|
|
}
|
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
#############
|
383
|
|
|
|
|
|
|
# HDB::CMDS #
|
384
|
|
|
|
|
|
|
#############
|
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
package HDB::CMDS ;
|
387
|
|
|
|
|
|
|
|
388
|
0
|
|
|
0
|
0
|
|
sub default_types { require HDB::CMDS ; &default_types ;}
|
|
0
|
|
|
|
|
|
|
389
|
0
|
|
|
0
|
0
|
|
sub predefined_columns { require HDB::CMDS ; &predefined_columns ;}
|
|
0
|
|
|
|
|
|
|
390
|
0
|
|
|
0
|
0
|
|
sub default_mod { require HDB::CMDS ; &default_mod ;}
|
|
0
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
#######
|
393
|
|
|
|
|
|
|
# END #
|
394
|
|
|
|
|
|
|
#######
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
1;
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
__END__
|