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

Re: selectrow_array() confusion

by Anonymous Monk
on Nov 25, 2008 at 20:51 UTC ( [id://725946]=note: print w/replies, xml ) Need Help??


in reply to selectrow_array() confusion

Works under SQLite.
Are you sure you are connecting to the same database in both test cases?
What happens if you change from selectrow_array to selectrow_hashref, and dump the output?
#!/usr/bin/perl use strict; use warnings; use DBI; use Data::Dumper; $Data::Dumper::Useqq=1; my $db_file = 'pm725924.sqlite'; unlink $db_file; my $dbh = DBI->connect("dbi:SQLite:dbname=$db_file") or die; $dbh->{PrintError} = 1; $dbh->{PrintWarn } = 1; $dbh->do($_) or die for split "\n", <<'END_OF_SQL'; create table images( id smallint, foo varchar(10) ); insert into images values( 61893, 'bar-man' ); insert into images values( 62437, 'baretta' ); insert into images values( 50000, 'a' ); insert into images values( 70000, 'c' ); END_OF_SQL #print Dumper $dbh->selectrow_array( print Dumper $dbh->selectrow_hashref( "SELECT min(id),max(id) from images where foo like 'bar%'" ); $dbh->disconnect or die;
Produces:
$VAR1 = { "min(id)" => 61893, "max(id)" => 62437 };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found