Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

dbi: selectrow_arrayref

by perlthirst (Scribe)
on Dec 31, 2008 at 12:46 UTC ( #733455=perlquestion: print w/replies, xml ) Need Help??
perlthirst has asked for the wisdom of the Perl Monks concerning the following question:

As per my understanding we can pass statements (select) to a selectrow_arrayref which will return the first row of data from the statement. But in the manual page there is a statement

"The $statement parameter can be a previously prepared statement handle, in which case the "prepare" is skipped"

Is it giving a meaning that we can pass statement handle to selectrow_arrayref? Is this understanding correct? But if we pass the statement handle to selectrow_arrayref it is throwing error. then what is the meaning of the above quoted string?

Kindly clarify.

Replies are listed 'Best First'.
Re: dbi: selectrow_arrayref
by tinita (Parson) on Dec 31, 2008 at 13:34 UTC
    But if we pass the statement handle to selectrow_arrayref it is throwing error.
    Which error? Please post the code which produces the error and the exact error message.
    The following code works for me:
    my $dbh = DBI->connect("dbi:...", $user, $pass); my $sql= "select ... from ..."; my $sth = $dbh->prepare($sql); my $row = $dbh->selectrow_arrayref($sth);
Re: dbi: selectrow_arrayref
by Seqi (Acolyte) on Dec 31, 2008 at 13:03 UTC
    you are using:
    instead of:
    right? edit: corrected the calls(?) what I use in a program of mine:
    hope this manages to give a hint in the right direction
Re: dbi: selectrow_arrayref
by bradcathey (Prior) on Dec 31, 2008 at 13:34 UTC

    Required reading--you'll want to bookmark this one.

    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://733455]
Approved by andreas1234567
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2018-05-27 22:07 GMT
Find Nodes?
    Voting Booth?