Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Working with DBI and DBD::SQLite2

by Taulmarill (Deacon)
on Oct 29, 2004 at 20:41 UTC ( #403902=note: print w/ replies, xml ) Need Help??


in reply to Re: Working with DBI and DBD::SQLite2
in thread Working with DBI and DBD::SQLite2

as supplement: this is definitely the problem, use always placeholders! some values have to be quoted so the db knows where the value ends. also you you can speed up the inserts by reuseing your statements and performing them all in one transaction.

$dbh->do('BEGIN TRANSACTION'); my $sta=$dbh->prepare("INSERT INTO ISP(Store,Date) VALUES(?, ?)"); my $stb=$dbh->prepare("INSERT INTO UnityPrimary(Store,Date) VALUES(?, +?)"); my $stc=$dbh->prepare("INSERT INTO UnitySecondary(Store,Date) VALUES(? + , ?)"); while (<CSV>){ chomp; my($store,$isp,$pri,$sec)=split /,/; $sta->execute($store,$isp); $stb->execute($store,$pri); $stc->execute($store,$sec); } $dbh->('END TRANSACTION');
oh yes, and definements like INTEGER or CHAR[9] mean nothing to SQLite2. the only column define which is usefull is PRIMARY KEY INTEGER for self generating unique keys.

update: just for your information, DBD::SQLite $VERSION >= 1 is actualy SQLite 3, DBD::SQLite2 was made to update the SQLite 2 path. just in case you want to benefit from the new features in v3 but didn't know how weird the modules are named.


Comment on Re^2: Working with DBI and DBD::SQLite2
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-10-23 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls