Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Query Language with Flat Files

by GertMT (Friar)
on Sep 20, 2009 at 05:30 UTC ( #796356=note: print w/ replies, xml ) Need Help??


in reply to Re: Query Language with Flat Files
in thread Query Language with Flat Files

Using DBD::AnyData

#!/usr/bin/perl -w use strict; use diagnostics; use DBI; my $dbh = DBI->connect( 'dbi:AnyData(RaiseError=>1):' or die $DBI::err +str ); $dbh->func( 'example', 'CSV', 'DEMO.db', { sep_char => ',', # eol => "\015", col_names => 'name,username,time,num1,num2' }, 'ad_catalog' ); my $sth = $dbh->prepare("SELECT time, name, username, num1, num2 FROM +example"); $sth->execute() || die "can't fetch all usernames"; while ( my $row = $sth->fetch ) { print "@$row\n"; } $sth = $dbh->prepare("SELECT username FROM example"); $sth->execute() || die "can't fetch all usernames"; while ( my $row = $sth->fetch ) { print "@$row\n"; }


Comment on Re^2: Query Language with Flat Files
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (21)
As of 2014-07-23 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (150 votes), past polls