Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DBD::AnyData completely broken (or is it just me?)

by bmann (Priest)
on Jun 29, 2005 at 07:49 UTC ( [id://470914]=note: print w/replies, xml ) Need Help??


in reply to DBD::AnyData completely broken (or is it just me?)

It's just you ;) (just kidding, it looks like a documentation bug at the very least.)

Change the name of your table from 'import' to 'mytable', and it works.

It isn't documented, but using 'import' as the table name causes SQL::Statement to try to call SQL::Statement::Functions::SQL_FUNCTION_IMPORT() with the wrong parameters - it expects a statement handle, which it doesn't get. Using the debugger, I verified that SQL_FUNCTION_IMPORT is not called wrongly when the table is named differently.

Here's an example using ad_catalog (I get the same results with ad_import):

#!/usr/bin/perl use warnings; use strict; # to prevent silly errors use DBI; my $addbh = DBI->connect('dbi:AnyData(RaiseError => 1):'); $addbh->func('mytable', 'CSV', [ <DATA> ], 'ad_catalog'); my $sth = $addbh->prepare( 'select foo, bar, baz from mytable' ); $sth->execute; DBI::dump_results($sth); #$sth->finish; #$addbh->disconnect; __DATA__ foo,bar,baz 1,2,3 4,5,6 7,8,9
Results:
$ perl anydata.pl '1', '2', '3' '4', '5', '6' '7', '8', '9' 3 rows DBI handle 0x85cecf8 cleared whilst still active, <DATA> line 4. dbih_clearcom (sth 0x85cecf8, com 0x85d1c58, imp DBD::AnyData::st) +: FLAGS 0x182195: COMSET Active Warn RaiseError PrintError PrintW +arn ShowErrorStatement PARENT DBI::db=HASH(0x85cebfc) KIDS 0 (0 Active) IMP_DATA undef NUM_OF_FIELDS 3 NUM_OF_PARAMS 0
I can't seem to suppress or fix the "DBI handle cleared whilst still active" message

Hopefully, jZed can shed more light when he gets a chance.

Update: I am using Debian unstable, all packages up-to-date

Replies are listed 'Best First'.
Re^2: DBD::AnyData completely broken (or is it just me?)
by avarus (Novice) on Jul 12, 2005 at 16:21 UTC
    Thankyou so much! That was one slippery bug.

    For anyone who finds this thread and wants to know how to suppress the warnings, here is one solution:

    #!/usr/bin/perl #/home/tbooth/perl/testanydata.perl - created Mon Jun 27 13:57:06 2005 use strict; use warnings; use Data::Dumper; use Carp; $Carp::Verbose = 1; $SIG{__DIE__} = \&croak; # I was having issues with DBD::AnyData. Here is a test. use DBI; require DBD::AnyData; if(DBD::AnyData->VERSION eq '0.08') { eval ' package DBD::AnyData::st; no warnings; sub DESTROY ($) { $_[0]->SUPER::DESTROY(@_) } sub finish ($) { $_[0]->SUPER::finish(@_) } '; } my $addbh = DBI->connect('dbi:AnyData(RaiseError=>1):'); $addbh->func('myimport', 'CSV', [<DATA>], 'ad_import'); print Dumper($addbh->selectall_hashref("SELECT * FROM myimport", 'foo' +)); print "\n"; __DATA__ foo,bar,baz 1,2,3 4,5,6

    --
    #Tip: use 'no strict' to make those nasty errors vanish.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://470914]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-23 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found