Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBI column_info question

by runrig (Abbot)
on Mar 20, 2015 at 19:39 UTC ( [id://1120796]=note: print w/replies, xml ) Need Help??


in reply to DBI column_info question

It's a bug in DBD::mysql. If you got column info on the whole table, it would correctly return the position of each column. But since you are only getting info on one column at a time, the count starts with '1' each time. In the code, the ordinal position is a simple incremented variable for each column returned.

Replies are listed 'Best First'.
Re^2: DBI column_info question
by FryingFinn (Beadle) on Mar 26, 2015 at 16:54 UTC
    thanks for pointing me in right direction. changed my code to...
    my $sth = $dbh->column_info(undef, undef, 'table1', "%"); my $col_info = $sth->fetchall_hashref('ORDINAL_POSITION');
    which gives exactly what I wanted.

    "thx" x 100

Log In?
Username:
Password:

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

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

    No recent polls found