Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Query Language with Flat Files

by planetscape (Chancellor)
on Sep 18, 2009 at 18:46 UTC ( #796177=note: print w/replies, xml ) Need Help??


in reply to Query Language with Flat Files

You may want to have a look at DBD::AnyData.

HTH,

planetscape

Replies are listed 'Best First'.
Re^2: Query Language with Flat Files
by GertMT (Hermit) on Sep 20, 2009 at 05:30 UTC
    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"; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2021-12-05 20:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (31 votes). Check out past polls.

    Notices?