----- Original Message ----- 
From: "Matt Sergeant" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 19, 2002 4:29 AM
Subject: DBD::SQLite


> I've finished my first stab at DBD::SQLite.
> 
> It's a simple driver for small needs databases, such as when you want
> something to ship with a product to demo it, or when DBD::CSV isn't fast
> enough, or when MySQL is too much.
(snip)
> So, please if you get chance, download it from
> http://axkit.org/download/DBD-SQLite-0.01.tar.gz, and compile it and play
> with it. No docs, just a few tests. Let me know how you get on!
GREAT! COOL!! WONDERFUL!!!
#sorry for my poor English.

It works fine on my Linux box.
It seems that has no problem with Japanese string :-).

But have these functions not implemented?
- Place holders
- Transaction support with $dbh->commit(), $dbh->rollback()
I could not find out how to work these functions.

[Script]
use strict;
use DBI;
my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "",
  {AutoCommit => 0, RaiseError => 1});

$dbh->do("CREATE TABLE MST (id, lbl)");
$dbh->do("CREATE TABLE TRN (no, id, qty)");

$dbh->commit; #not work?
$dbh->do("INSERT INTO MST VALUES(1, 'ITEM1')");
$dbh->do("INSERT INTO MST VALUES(2, 'ITEM2')");
$dbh->do("INSERT INTO MST VALUES(3, 'ITEM3')");
$dbh->do("INSERT INTO TRN VALUES('A', 1, 5)");
$dbh->do("INSERT INTO TRN VALUES('B', 2, 2)");
$dbh->do("INSERT INTO TRN VALUES('C', 1, 4)");
$dbh->do("INSERT INTO TRN VALUES('D', 3, 3)");
$dbh->rollback; #not work?

my $sth = $dbh->prepare(
"SELECT TRN.id AS ID, MST.LBL AS TITLE,
        SUM(qty) AS TOTAL FROM TRN,MST
WHERE TRN.ID = MST.ID
GROUP BY TRN.ID ORDER BY TRN.ID DESC");
$sth->execute();
my $names = $sth->{NAME};
print(join(', ', @$names), "\n");
while(my $raD = $sth->fetchrow_arrayref()) {
    print join(":", @$raD), "\n";
}
$sth->finish;
$dbh->disconnect;

[Result]
ID, TITLE, TOTAL
3:ITEM3:3
2:ITEM2:2
1:ITEM1:9

==============================================
Kawai, Takanori(Hippo2000)
   Mail: [EMAIL PROTECTED] [EMAIL PROTECTED]
   http://member.nifty.ne.jp/hippo2000
==============================================

Reply via email to