# MyDBI subclasses DBI to make execute more friendly # to users who have to pass strange options to bind_param use strict; package MyDBI; use DBI; use vars qw(@ISA); @ISA = qw(DBI); package MyDBI::db; use vars qw(@ISA); @ISA = qw(DBI::db); package MyDBI::st; use vars qw(@ISA); @ISA = qw(DBI::st); sub execute { my ($sth, @args) = @_; my $paramspot = 1; while(@args) { my $p = shift @args; my $n = (@args)?$args[0]:''; if (ref($p) eq 'ARRAY') { $sth->bind_param($paramspot++, @$p) or return; } elsif (!ref($p) and ref($n) eq 'HASH') { shift @args; $sth->bind_param($paramspot++, $p, $n) or return; } else { $sth->bind_param($paramspot++, $p) or return; } } $sth->SUPER::execute(); } #### my $sth = $dbh->prepare(<<''); INSERT INTO sometable (x, y, z, blobby) VALUES (?, ?, ?, ?) $sth->execute('x', 'y', 'z', $blobdata, { ora_type => ORA_BLOB }); #### $sth->execute('x', 'y', 'z', [$blobdata, { ora_type => ORA_BLOB }] ); #### -- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/