in reply to Re: DBI select ids to @list
in thread DBI select ids to @ids

Hmmm. Learning from your example it looks like I might be able to use selectcol_arrayref also:

@ids = @{ $dbh->selectcol_arrayref($stmt) }

Or am I wrong here? It looks like selectcol_arrayref has some magic to select multiple columns but the manual says it defaults to the first. But is it a reference to a an array of references to an array, or just a reference to an array?

-Andrew.


Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

Replies are listed 'Best First'.
Re^3: DBI select ids to @list
by ikegami (Patriarch) on Aug 10, 2005 at 05:52 UTC
    ah yes, selectcol_arrayref would do the trick. That's exactly why it was written, I bet. I had forgotten about that function
    use DBI; my $dbh = DBI->connect(...); my $stmt = 'select id from items where foo > 42'; my @ids = @{ $dbh->selectcol_arrayref($stmt) };