Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DB SQL Result Order

by flocto (Pilgrim)
on Jul 22, 2002 at 09:51 UTC ( [id://183994]=note: print w/replies, xml ) Need Help??


in reply to DB SQL Result Order

In case you're using the DBI (which you should) you can do this rather simple:

my @columns = qw#A B#; foreach (@columns) { my $rows = $DBH->selectcol_arrayref ("SELECT $_ FROM $table") or d +ie $DBH->errstr (); print STDOUT join ('|', @$rows), "\n"; }

You can use a statement handle instead of the sql-query-string, but I don't know if placeholders are supported.. Maybe somebody else knows?! But I guess you can trust your hand-build array. This method has a lot of overhead so for performance-relevant tasks I would seek some other solution..

Regards,
-octo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-19 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found