lib/DBD/XBase.pm untested

filter: Statementstmt 0.0% 0 / 354 Branchbran 0.0% 0 / 120 Conditioncond 0.0% 0 / 35 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 34 Podpod 0.0% 0 / 25 totaltotal 0.0% 0 / 568 CC 61 SCAR 54.5
CC
61
Cov
0%
execute
756.0
FETCH
90.0
fetch
56.0
CRAP 233.8
1  
2 =head1 NAME
3  
4 DBD::XBase - DBI driver for XBase compatible database files
5  
6 =cut
7  
8 # ##################################
9 # Here starts the DBD::XBase package
10  
11 package DBD::XBase;
12  
13 use strict;
14 use DBI (); # we want DBI
15 use XBase; # and we want the basic XBase handling modules
16 use XBase::SQL; # including the SQL parsing routines
17 use Exporter;
18  
19 use vars qw( $VERSION @ISA @EXPORT $err $errstr $drh $sqlstate );
20 # a couple of global variables that may come handy
21  
22 $VERSION = '1.05';
23  
24 $err = 0;
25 $errstr = '';
26 $sqlstate = '';
27 $drh = undef;
28  
29 # The driver method creates the drivers instance; we store it in the
30 # global $drh variable to only load the driver once
31 sub driver {
32 return $drh if $drh;
33 my ($class, $attr) = @_;
34 $class .= '::dr';
35 $drh = DBI::_new_drh($class, {
36 'Name' => 'XBase',
37 'Version' => $VERSION,
38 'Err' => \$DBD::XBase::err,
39 'Errstr' => \$DBD::XBase::errstr,
40 'State' => \$DBD::XBase::sqlstate,
41 'Attribution' => 'DBD::XBase by Jan Pazdziora',
42 });
43 }
44  
45 # The data_sources method should return list of possible "databases"
46 # for the driver. With DBD::XBase, the database is in fact a directory.
47 # So should we return all direcoties in current? Right now, we only
48 # return the current directory.
49 sub data_sources {
50 'dbi:XBase:.';
51 }
52  
53  
54 # ##################
55 # The driver package
56  
57 package DBD::XBase::dr;
58 use strict;
59 $DBD::XBase::dr::imp_data_size = 0;
60  
61 # The connect method returns a dbh; we require that the directory we
62 # want to search for tables exists.
63 sub connect {
64 my ($drh, $dsn) = @_;
65 $dsn = '.' if $dsn eq '';
66 if (not -d $dsn) {
67 $drh->DBI::set_err(1, "Connect failed: directory `$dsn' doesn't exist");
68 return;
69 }
70 DBI::_new_dbh($drh, { 'Name' => $dsn } );
71 }
72  
73 # We do not want to do anything upon disconnecting, but we might in
74 # the future (flush, close files)
75 sub disconnect_all {
76 1;
77 }
78  
79  
80 # ####################
81 # The database package
82  
83 package DBD::XBase::db;
84 use strict;
85 $DBD::XBase::db::imp_data_size = 0;
86  
87 # The prepare method takes dbh and a SQL query and should return
88 # statement handler
89 sub prepare {
90 my ($dbh, $statement) = @_;
91  
92 # we basically call XBase::SQL parsing and get an object
93 my $parsed_sql = parse XBase::SQL($statement);
94 ### use Data::Dumper; print Dumper $parsed_sql;
95
96 if (defined $parsed_sql->{'errstr'}) {
97 $dbh->DBI::set_err(2, $parsed_sql->{'errstr'});
98 return;
99 }
100  
101 # we create a new statement handler; the only thing the the
102 # specs requires us to do here (except parsing the query) is
103 # to se the number of bind parameters found, which we do;
104 # we do not set NUM_OF_FIELDS (which the specs doesn't require)
105 # since for select * we do not know the number yet, for example
106 DBI::_new_sth($dbh, {
107 'Statement' => $statement,
108 'xbase_parsed_sql' => $parsed_sql,
109 'NUM_OF_PARAMS' => scalar(keys %{$parsed_sql->{'binds'}}),
110 });
111 }
112  
113 # Storing and fetching attributes in the database handler
114 sub STORE {
115 my ($dbh, $attrib, $value) = @_;
116 if ($attrib eq 'AutoCommit') {
117 unless ($value) {
118 die "Can't disable AutoCommit";
119 }
120 return 1;
121 } elsif ($attrib =~ /^xbase_/) {
122 $dbh->{$attrib} = $value; return 1;
123 }
124 $dbh->DBD::_::db::STORE($attrib, $value);
125 }
126 sub FETCH {
127 my ($dbh, $attrib) = @_;
128 if ($attrib eq 'AutoCommit') {
129 return 1;
130 } elsif ($attrib =~ /^xbase_/) {
131 return $dbh->{$attrib};
132 }
133 $dbh->DBD::_::db::FETCH($attrib);
134 }
135  
136 # Method tables provides a list of tables in the directory
137 sub tables {
138 my $dbh = shift;
139 opendir DIR, $dbh->{'Name'} or return;
140 my @result = ();
141 while (defined(my $item = readdir DIR)) {
142 next unless $item =~ s/\.dbf$//i;
143 push @result, $item;
144 }
145 closedir DIR;
146 @result;
147 }
148  
149 # Quoting method
150 sub quote {
151 my $text = $_[1];
152 return 'NULL' unless defined $text;
153 $text =~ s/\\/\\\\/sg;
154 $text =~ s/\'/\\\'/sg;
155 return "'$text'";
156 ### return "'\Q$text\E'";
157 }
158  
159 # Commit and rollback do not do anything usefull
160 sub commit {
161 warn "Commit ineffective while AutoCommit is on"
162 if $_[0]->FETCH('Warn');
163 1;
164 }
165 sub rollback {
166 warn "Rollback ineffective while AutoCommit is on"
167 if $_[0]->FETCH('Warn');
168 0;
169 }
170  
171 # Upon disconnecting we close all tables
172 sub disconnect {
173 my $dbh = shift;
174 foreach my $table (keys %{$dbh->{'xbase_tables'}}) {
175 $dbh->{'xbase_tables'}->{$table}->close;
176 delete $dbh->{'xbase_tables'}{$table};
177 }
178 1;
179 }
180  
181 # Table_info is a strange method that returns information about
182 # tables. There is not much we could say about the files so we only
183 # return list of them.
184 sub table_info {
185 my $dbh = shift;
186 my $sth = DBI::_new_sth($dbh, { 'xbase_lines' =>
187 [ map { [ undef, undef, $_, 'TABLE', undef ] } $dbh->tables ]
188 } );
189 $sth->STORE('NUM_OF_FIELDS', 5);
190 $sth->{'xbase_nondata_name'} = [ qw! TABLE_QUALIFIER TABLE_OWNER
191 TABLE_NAME TABLE_TYPE REMARKS !];
192 $sth->execute and return $sth;
193 return;
194 }
195  
196 # Very unreadable structure that the specs requires us to keep. It
197 # summarizes information about various data types we support. I do not
198 # hide the fact that this is not polished and probably not correct.
199 my @TYPE_INFO_ALL = (
200 [ qw( TYPE_NAME DATA_TYPE PRECISION LITERAL_PREFIX LITERAL_SUFFIX CREATE_PARAMS NULLABLE CASE_SENSITIVE SEARCHABLE UNSIGNED_ATTRIBUTE MONEY AUTO_INCREMENT LOCAL_TYPE_NAME MINIMUM_SCALE MAXIMUM_SCALE ) ],
201 [ 'VARCHAR', DBI::SQL_VARCHAR, 65535, "'", "'", 'max length', 0, 1, 2, undef, 0, 0, undef, undef, undef ],
202 [ 'CHAR', DBI::SQL_CHAR, 65535, "'", "'", 'max length', 0, 1, 2, undef, 0, 0, undef, undef, undef ],
203 [ 'INTEGER', DBI::SQL_INTEGER, 0, '', '', 'number of digits', 1, 0, 2, 0, 0, 0, undef, 0, undef ],
204 [ 'FLOAT', DBI::SQL_FLOAT, 0, '', '', 'number of digits', 1, 0, 2, 0, 0, 0, undef, 0, undef ],
205 [ 'NUMERIC', DBI::SQL_NUMERIC, 0, '', '', 'number of digits', 1, 0, 2, 0, 0, 0, undef, 0, undef ],
206 [ 'BOOLEAN', DBI::SQL_BINARY, 0, '', '', undef, 1, 0, 2, 0, 0, 0, undef, 1, 1 ],
207 [ 'DATE', DBI::SQL_DATE, 0, '', '', 'number of digits', 1, 0, 2, 0, 0, 0, undef, 0, undef ],
208 [ 'TIME', DBI::SQL_TIME, 0, '', '', 'number of digits', 1, 0, 2, 0, 0, 0, undef, 0, undef ],
209 [ 'BLOB', DBI::SQL_LONGVARBINARY, 0, '', '', undef, 1, 0, 2, 0, 0, 0, undef, 0, undef ],
210 );
211  
212 my %TYPE_INFO_TYPES = map { ( $TYPE_INFO_ALL[$_][0] => $_ ) } ( 1 .. $#TYPE_INFO_ALL );
213 my %REVTYPES = qw( C char N numeric F float L boolean D date M blob T time );
214 my %REVSQLTYPES = map { ( $_ => $TYPE_INFO_ALL[ $TYPE_INFO_TYPES{ uc $REVTYPES{$_} } ][1] ) } keys %REVTYPES;
215  
216 ### use Data::Dumper; print STDERR Dumper \@TYPE_INFO_ALL, \%TYPE_INFO_TYPES, \%REVTYPES, \%REVSQLTYPES;
217  
218 sub type_info_all {
219 my $dbh = shift;
220 my $result = [ @TYPE_INFO_ALL ];
221 my $i = 0;
222 my $hash = { map { ( $_ => $i++) } @{$result->[0]} };
223 $result->[0] = $hash;
224 $result;
225 }
226 sub type_info {
227 my ($dbh, $type) = @_;
228 my @result = ();
229 for my $row ( 1 .. $#TYPE_INFO_ALL ) {
230 if ($type == DBI::SQL_ALL_TYPES or $type == $TYPE_INFO_ALL[$row][1])
231 { push @result, { map { ( $TYPE_INFO_ALL[0][$_] => $TYPE_INFO_ALL[$row][$_] ) } ( 0 .. $#{$TYPE_INFO_ALL[0]} ) } }
232 }
233 @result;
234 }
235  
236 sub DESTROY {
237 # To avoid autoloaded DESTROY
238 }
239  
240  
241 # #####################
242 # The statement package
243  
244 package DBD::XBase::st;
245 use strict;
246 $DBD::XBase::st::imp_data_size = 0;
247  
248 # Binding of parameters: numbers are converted to :pnumber form,
249 # values are stored in the sth->{'xbase_bind_values'}->name of the
250 # parameter hash
251 sub bind_param {
252 my ($sth, $parameter) = (shift, shift);
253 if ($parameter =~ /^\d+$/) { $parameter = ':p'.$parameter; }
254 $sth->{'xbase_bind_values'}{$parameter} = shift;
255 1;
256 }
257  
258 # Returns number of rows fetched until now
259 sub rows {
260 defined $_[0]->{'xbase_rows'} ? $_[0]->{'xbase_rows'} : -1;
261 }
262  
263 sub _set_rows {
264 my $sth = shift;
265 if (not @_ or not defined $_[0]) {
266 $sth->{'xbase_rows'} = undef; return -1;
267 }
268 $sth->{'xbase_rows'} = ( $_[0] ? $_[0] : '0E0' );
269 }
270 # Execute the current statement, possibly binding parameters. For
271 # nonselect commands the actions needs to be done here, for select we
272 # just create the cursor and wait for fetchrows
273 sub execute {
274 my $sth = shift;
275  
276 # the binds_order arrayref holds the conversion from the first
277 # occurence of the named parameter to its name;
278 # we bind the parameters here
279 my $parsed_sql = $sth->{'xbase_parsed_sql'};
280 for (my $i = 0; $i < @_; $i++) {
281 $sth->bind_param($parsed_sql->{'binds_order'}[$i], $_[$i]);
282 }
283  
284 # binded parameters
285 my $bind_values = $sth->{'xbase_bind_values'};
286  
287 ### the following code seems to somehow protect those "fixed"
288 ### statements but I do not understand it at the moment
289 ### if (defined $sth->{'xbase_lines'}) { return -1; }
290  
291 # cancel the count of rows done in the previous run, this is a
292 # new execute
293 $sth->{'xbase_rows'} = undef;
294
295 # we'll nee dbh, table name and to command to do with them
296 my $dbh = $sth->{'Database'};
297 my $table = $parsed_sql->{'table'}[0];
298 my $command = $parsed_sql->{'command'};
299
300 # create table first; we just create it and are done
301 if ($command eq 'create') {
302 my $filename = $dbh->{'Name'} . '/' . $table;
303 my %opts;
304 # get the name and the fields info
305 @opts{ qw( name field_names field_types field_lengths
306 field_decimals ) } =
307 ( $filename, @{$parsed_sql}{ qw( createfields
308 createtypes createlengths createdecimals ) } );
309 # try to create the table (and memo automatically)
310 my $xbase = XBase->create(%opts) or do {
311 $sth->DBI::set_err(10, XBase->errstr());
312 return;
313 };
314 # keep the table open
315 $dbh->{'xbase_tables'}->{$table} = $xbase;
316 return $sth->DBD::XBase::st::_set_rows(0); # return true
317 }
318  
319 # let's see if we've already opened the table
320 my $xbase = $dbh->{'xbase_tables'}->{$table};
321 if (not defined $xbase) {
322 # if not, open the table now
323 my $filename = $dbh->{'Name'} . '/' . $table;
324 my %opts = ('name' => $filename);
325 $opts{'ignorememo'} = 1 if $dbh->{'xbase_ignorememo'};
326 # try to open the table using XBase.pm
327 $xbase = new XBase(%opts) or do {
328 $sth->DBI::set_err(3, "Table $table not found: "
329 . XBase->errstr());
330 return;
331 };
332 $dbh->{'xbase_tables'}->{$table} = $xbase;
333 }
334  
335 # the following is not multiple-statements safe -- I'd overwrite
336 # the attribute here; but I do not think anybody needs
337 # ChopBlanks = 0 anyway
338 if (defined $parsed_sql->{'ChopBlanks'}) {
339 $xbase->{'ChopBlanks'} = $parsed_sql->{'ChopBlanks'};
340 }
341 $parsed_sql->{'ChopBlanks'} = \$xbase->{'ChopBlanks'};
342 # I cannot see what I meant by this line -- never mind
343  
344 # the array usedfields holds a list of field names that were
345 # explicitely mentioned somewhere in the SQL query -- select
346 # fields list, where clause, set clauses in update ...
347 # we'll try to make a list of those that do not exist in the table
348 my %nonexist;
349 for my $field (@{$parsed_sql->{'usedfields'}}) {
350 $nonexist{$field} = 1 unless defined $xbase->field_type($field);
351 }
352 if (keys %nonexist) {
353 $sth->DBI::set_err(4,
354 sprintf 'Field %s not found in table %s',
355 join(', ', sort keys %nonexist), $table);
356 return;
357 }
358  
359 # inserting values means appending a new row with reasonable
360 # values; the insertfn function expects the TABLE object and
361 # the BIND hash (it doesn' make use of them at the moment,
362 # AFAIK, because only constants are supported), it returns list
363 # of values
364 if ($command eq 'insert') {
365 my $last = $xbase->last_record;
366 my @values = &{$parsed_sql->{'insertfn'}}($xbase, $bind_values);
367
368 ### here, we'd really need a check for too many or too
369 ### few values
370 if (defined $parsed_sql->{'insertfields'}) {
371 my %newval;
372 @newval{ @{$parsed_sql->{'insertfields'} } } = @values;
373 @values = @newval{ $xbase->field_names };
374 }
375 $xbase->set_record($last + 1, @values) or do {
376 $sth->DBI::set_err(49,'Insert failed: '.$xbase->errstr);
377 return;
378 };
379 return $sth->DBD::XBase::st::_set_rows(1); # we've added one row
380 }
381  
382  
383 # rows? what do we need rows here for? never mind.
384 my $rows;
385  
386 # wherefn is defined if the statement had where clause; it
387 # should be called with $TABLE, $VALUES and $BIND parameters
388 my $wherefn = $parsed_sql->{'wherefn'};
389  
390 # we expand selectall to list of fields
391 if (defined $parsed_sql->{'selectall'}) {
392 $parsed_sql->{'selectnames'} = [ $xbase->field_names ];
393 push @{$parsed_sql->{'usedfields'}}, $xbase->field_names;
394 $parsed_sql->{'selectfieldscount'} = scalar $xbase->field_names;
395 }
396  
397 # we only set NUM_OF_FIELDS for select command -- which is
398 # exactly what selectfieldscount means
399 if (not $sth->FETCH('NUM_OF_FIELDS')) {
400 $sth->STORE('NUM_OF_FIELDS', $parsed_sql->{'selectfieldscount'});
401 }
402
403 # this cursor will be needed, because both select and update and
404 # delete with where clause need to fetch the data first
405 my $cursor = $xbase->prepare_select(@{$parsed_sql->{'usedfields'}});
406  
407
408 # select with order by clause will be done using "substatement"
409 if ($command eq 'select' and defined $parsed_sql->{'orderfields'}) {
410 my @orderfields = @{$parsed_sql->{'orderfields'}};
411  
412 # make a copy of the $parsed_sql hash, but delete the
413 # orderfields value
414 my $subparsed_sql = { %$parsed_sql };
415 delete $subparsed_sql->{'orderfields'};
416 delete $subparsed_sql->{'selectall'};
417  
418 my $selectfn = $parsed_sql->{'selectfn'};
419 $subparsed_sql->{'selectfn'} = sub {
420 my ($TABLE, $VALUES, $BINDS) = @_;
421 return map({ XBase::SQL::Expr->field($_, $TABLE, $VALUES)->value } @orderfields), &{$selectfn}($TABLE, $VALUES, $BINDS);
422 };
423 ### use Data::Dumper; print STDERR Dumper $subparsed_sql;
424 $subparsed_sql->{'selectfieldscount'} += scalar(@orderfields);
425  
426 # make new $sth
427 my $substh = DBI::_new_sth($dbh, {
428 'Statement' => $sth->{'Statement'},
429 'xbase_parsed_sql' => $subparsed_sql,
430 });
431
432 # bind all parameters in the substh
433 for my $key (keys %$bind_values) {
434 $substh->bind_param($key, $bind_values->{$key});
435 }
436
437 # execute and fetch all rows
438 $substh->execute;
439 ### use Data::Dumper; print STDERR Dumper $substh->{'xbase_parsed_sql'};
440 my $data = $substh->fetchall_arrayref;
441  
442 my $sortfn = '';
443 for (my $i = 0; $i < @orderfields; $i++) {
444 $sortfn .= ' or ' if $i > 0;
445 if ($xbase->field_type($orderfields[$i]) =~ /^[CML]$/) {
446 if (lc($parsed_sql->{'orderdescs'}[$i]) eq 'desc') {
447 $sortfn .= "\$_[1]->[$i] cmp \$_[0]->[$i]";
448 } else {
449 $sortfn .= "\$_[0]->[$i] cmp \$_[1]->[$i]";
450 }
451 } else {
452 if (lc($parsed_sql->{'orderdescs'}[$i]) eq 'desc') {
453 $sortfn .= "\$_[1]->[$i] <=> \$_[0]->[$i]";
454 } else {
455 $sortfn .= "\$_[0]->[$i] <=> \$_[1]->[$i]";
456 }
457 }
458 }
459 my $fn = eval "sub { $sortfn }";
460 # sort them and store in xbase_lines
461 $sth->{'xbase_lines'} =
462 [ map { [ @{$_}[scalar(@orderfields) .. scalar(@$_) - 1 ] ] }
463 sort { &{$fn}($a, $b) } @$data ];
464 } elsif ($command eq 'select') {
465 $sth->{'xbase_cursor'} = $cursor;
466 } elsif ($command eq 'delete') {
467 if (not defined $wherefn) {
468 my $last = $xbase->last_record;
469 for (my $i = 0; $i <= $last; $i++) {
470 if (not (($xbase->get_record_nf($i, 0))[0])) {
471 $xbase->delete_record($i);
472 $rows = 0 unless defined $rows;
473 $rows++;
474 }
475 }
476 } else {
477 my $values;
478 while (defined($values = $cursor->fetch_hashref)) {
479 next unless &{$wherefn}($xbase, $values,
480 $bind_values, 0);
481 $xbase->delete_record($cursor->last_fetched);
482 $rows = 0 unless defined $rows;
483 $rows++;
484 }
485 }
486 } elsif ($command eq 'update') {
487 my $values;
488 while (defined($values = $cursor->fetch_hashref)) {
489 next if defined $wherefn and not
490 &{$wherefn}($xbase, $values, $bind_values);
491 my %newval;
492 @newval{ @{$parsed_sql->{'updatefields'}} } =
493 &{$parsed_sql->{'updatefn'}}($xbase, $values,
494 $bind_values);
495 $xbase->update_record_hash($cursor->last_fetched, %newval);
496 $rows = 0 unless defined $rows;
497 $rows++;
498 }
499 } elsif ($command eq 'drop') {
500 # dropping the table is really easy
501 $xbase->drop or do {
502 $sth->DBI::set_err(60, "Dropping table $table failed: "
503 . $xbase->errstr);
504 return;
505 };
506 delete $dbh->{'xbase_tables'}{$table};
507 $rows = -1;
508 }
509
510 # finaly, set the number of rows (what if somebody will ask) and
511 # return it to curious crowds
512 return $sth->DBD::XBase::st::_set_rows($rows);
513 }
514  
515  
516  
517 sub fetch {
518 my $sth = shift;
519 my $retarray;
520 if (defined $sth->{'xbase_lines'}) {
521 $retarray = shift @{$sth->{'xbase_lines'}};
522 } elsif (defined $sth->{'xbase_cursor'}) {
523 my $cursor = $sth->{'xbase_cursor'};
524 my $wherefn = $sth->{'xbase_parsed_sql'}{'wherefn'};
525  
526 my $xbase = $cursor->table;
527 my $values;
528 while (defined($values = $cursor->fetch_hashref)) {
529 ### use Data::Dumper; print Dumper $sth->{'xbase_bind_values'};
530 next if defined $wherefn and not
531 &{$wherefn}($xbase, $values,
532 $sth->{'xbase_bind_values'});
533 last;
534 }
535 $retarray = [ &{$sth->{'xbase_parsed_sql'}{'selectfn'}}($xbase, $values, $sth->{'xbase_bind_values'}) ]
536 if defined $values;
537 }
538  
539 ### use Data::Dumper; print Dumper $retarray;
540  
541 return unless defined $retarray;
542  
543 ### print STDERR "sth->{'NUM_OF_FIELDS'}: $sth->{'NUM_OF_FIELDS'} sth->{'NUM_OF_PARAMS'}: $sth->{'NUM_OF_PARAMS'}\n";
544  
545  
546 $sth->_set_fbav($retarray); return $retarray;
547  
548 my $i = 0;
549 for my $ref ( @{$sth->{'xbase_bind_col'}} ) {
550 next unless defined $ref;
551 $$ref = $retarray->[$i];
552 } continue {
553 $i++;
554 }
555
556 return $retarray;
557 }
558 *fetchrow_arrayref = \&fetch;
559  
560 sub FETCH {
561 my ($sth, $attrib) = @_;
562 my $parsed_sql = $sth->{'xbase_parsed_sql'};
563 if ($attrib =~ /^xbase_/) {
564 return $sth->{$attrib};
565 }
566 if ($attrib eq 'NAME') {
567 if (defined $sth->{'xbase_nondata_name'}) {
568 return $sth->{'xbase_nondata_name'};
569 }
570 return [ @{$parsed_sql->{'selectnames'}} ];
571 } elsif ($attrib eq 'NULLABLE') {
572 return [ (1) x scalar(@{$parsed_sql->{'selectnames'}}) ];
573 } elsif ($attrib eq 'TYPE') {
574 return [ map { ( $REVSQLTYPES{$_} or undef ) }
575 map { ( $sth->{'Database'}->{'xbase_tables'}->{$parsed_sql->{'table'}[0]}->field_type($_) or undef ) }
576 @{$parsed_sql->{'selectnames'}} ];
577 } elsif ($attrib eq 'PRECISION') {
578 return [ map { $sth->{'Database'}->{'xbase_tables'}->{$parsed_sql->{'table'}[0]}->field_length($_) }
579 @{$parsed_sql->{'selectnames'}} ];
580 } elsif ($attrib eq 'SCALE') {
581 return [ map { $sth->{'Database'}->{'xbase_tables'}->{$parsed_sql->{'table'}[0]}->field_decimal($_) }
582 @{$parsed_sql->{'selectnames'}} ];
583 } elsif ($attrib eq 'ChopBlanks') {
584 return $parsed_sql->{'ChopBlanks'};
585 } else {
586 return $sth->DBD::_::st::FETCH($attrib);
587 }
588 }
589 sub STORE {
590 my ($sth, $attrib, $value) = @_;
591 if ($attrib =~ /^xbase_/) {
592 $sth->{$attrib} = $value;
593 }
594 if ($attrib eq 'ChopBlanks') {
595 $sth->{'xbase_parsed_sql'}->{'ChopBlanks'} = $value;
596 }
597 return $sth->DBD::_::st::STORE($attrib, $value);
598 }
599
600 sub finish { 1; }
601  
602 sub DESTROY { }
603  
604 1;
605  
606 __END__