Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Using placeholders in selectall_arrayref

by Fang (Pilgrim)
on Jan 11, 2006 at 13:01 UTC ( #522429=note: print w/replies, xml ) Need Help??


in reply to Using placeholders in selectall_arrayref

From the DBI doc:

$ary_ref = $dbh->selectall_arrayref($statement, \%attr, @bind_values);

Update: thanks to Happy-the-monk for clarifying what the notation actually means. I thought the OP would understand it, seeing how he used an anonymous hash himself. What the docs actually say is:

$ary_ref = $dbh->selectall_arrayref($statement); $ary_ref = $dbh->selectall_arrayref($statement, \%attr); $ary_ref = $dbh->selectall_arrayref($statement, \%attr, @bind_values);

This means that the selectall_arrayref method takes either one, two, or any number of arguments. The first two have to be scalars, a string (SQL query) and a reference to a hash (attributes). After that, you can supply a list of values for the placeholders in your query, if any.

Replies are listed 'Best First'.
Re^2: Using placeholders in selectall_arrayref
by Happy-the-monk (Abbot) on Jan 11, 2006 at 13:30 UTC

    So to speak...

    my $employees_loh = $dbh->selectall_arrayref($query2, {Slice => {}}, $employer);

    (This was not missing in Fang's reply, but this might be clearer to both DBI and perlreferences newbees.
    It would sureley have confused me when I was one.)

    Cheers, Sören

      Thanks Happy-the-monk! I didn't understand that the {Slice => {}} was the \%att as shown in the doc. Nice to see an example. Perfect.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
      Awesome example.
      Faced the same problem as newbee and found enlightenment here.
      Many thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://522429]
help
Chatterbox?
[thezip]: I've got to go to meetings now. If anyone has further comments regarding Spreadsheet::XLSX deployment to Strawberry Perl 5.24.1, please /msg me -- thanks!
LanX has to go ... plans to crash with a car into a group of pythonistas while screaming "LARRY IS THE GREATEST"
LanX ... darn ... where is my car?
[choroba]: Haven't you crashed into a boar recently?
[1nickt]: TCLion how is that going?
[LanX]: could someone lend me a car?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (15)
As of 2017-03-23 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (291 votes). Check out past polls.