Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Output results from a DBI select query in one line

by merlyn (Sage)
on Apr 11, 2006 at 16:12 UTC ( [id://542588]=note: print w/replies, xml ) Need Help??


in reply to Output results from a DBI select query in one line

Why not just:
$_->execute(4, 5), $_->dump_results for $dbh->prepare(q{ SELECT one, two FROM three WHERE four = ? AND five = ? });

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Output results from a DBI select query in one line
by jZed (Prior) on Apr 11, 2006 at 18:09 UTC
    Or, a couple of characters shorter than that (if we don't count loading Dumper):
    print Dumper $dbh->selectall_arrayref("SELECT one, two FROM three WHER +E four=? AND five=?",{},4,5);
      Either merlyn's or jZed's examples are fine for diagnostics. The original, however:
      • won't truncate values as dump_results does
      • provides more human-readable output than Data::Dumper's structures
      But feel free to use whatever works for you. Mine was just more appropriate for my project.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-23 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found