Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: dbi:csv how to

by ptum (Priest)
on Oct 27, 2006 at 22:48 UTC ( [id://581039]=note: print w/replies, xml ) Need Help??


in reply to dbi:csv how to

It may be worth your time to read the documentation associated with DBD::CSV a little more thoroughly.

I've never used DBD::CSV as a driver, but the use of the DBI module is pretty much the same everywhere -- you create a database handle, you prepare a statement on that handle, you execute the handle and you retrieve the result set.

In your example, it looks as though you are creating a new table with the not very interesting name of 'a' and storing it in the /base directory on your file system. To use an existing CSV file, I think you want the third example in the documentation:

$dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;}); $dbh->{'csv_tables'}->{'info'} = { 'file' => 'info.csv'}; $sth = $dbh->prepare("SELECT * FROM info");

Also, don't forget about Super Search; there seem to be lots of nodes on this topic, including this randomly selected one: Problem parsing semicolon delimited file with DBD::CSV.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found