On Jan 24, 2008 1:49 PM, Mike Blezien <[EMAIL PROTECTED]> wrote:
> Hello
>
> I've attached a sqlite db file and have been trying to find a way to read this
> type of file w/Perl. Is there a module or a way with Perl to read/extract data
> from this type of file ??
snip

Use the DBI module with DBD::SQLite:

#! /usr/bin/perl

use strict;
use warnings;

use DBI;

my $dbh = DBI->connect(
        "dbi:SQLite:dbname=sms.db",
        '',
        '',
        {
                ChopBlanks => 1,
                AutoCommit => 1,
                PrintError => 0,
                RaiseError => 1,
                FetchHashKeyName => 'NAME_lc'
        }
) or die DBI->errstr;

my $sth = $dbh->prepare("select * from message order by 1");
$sth->execute;
while (my $row = $sth->fetch) {
        print join(", ", @$row), "\n";
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to