Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: returning rows using SQL + Perl DBI

by Win (Novice)
on Nov 22, 2010 at 10:58 UTC ( [id://872940]=note: print w/replies, xml ) Need Help??


in reply to Re: returning rows using SQL + Perl DBI
in thread returning rows using SQL + Perl DBI

You mean the mistake is in that bit of code?
  • Comment on Re^2: returning rows using SQL + Perl DBI

Replies are listed 'Best First'.
Re^3: returning rows using SQL + Perl DBI
by fisher (Priest) on Nov 22, 2010 at 11:30 UTC
    I mean, quoting perldoc DBI,
    If called in a scalar context for a statement handle that has more than one column, it is undefined whether the driver will return the value of the first column or the last. So don't do that. Also, in a scalar context, an "undef" is returned if there are no more rows or if an error occurred. That "undef" can't be distinguished from an "undef" returned because the first field value was NULL. For these reasons you should exercise some caution if you use "selectrow_array" in a scalar context, or just don't do that.
Re^3: returning rows using SQL + Perl DBI
by mje (Curate) on Nov 22, 2010 at 11:28 UTC

    Yes. fetchrow_array returns an array not a scalar. Use @row = $sth->fetchrow_array.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2025-07-07 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.