Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: perl DBI & SQLite

by Anonymous Monk
on Oct 15, 2007 at 23:22 UTC ( [id://645064]=note: print w/replies, xml ) Need Help??


in reply to perl DBI & SQLite

Hello monks, I'm a newbie to Perl and I've been trying to write a script that will import a data file (XXX.out) into a table (XXX) in a SQLite databse, and
I would be very appreciative if someone could enlighten me please!
Everything was going great until I used

$db->do(".import XXX.out XXX);

which gave me this error:

DBD::SQLite::db do failed: near ".": syntax error(1) at dbdimp.c line 271 at ./new.pl line 13.

I tried using single quotes too, and backslashing the period, but nothing worked. The

$db->do("create table XXX (@colnames)");

line earlier in the code worked just fine. It also worked when rather than
using the .import function I instead used the INSERT function to just insert a few lines.
But somehow the .import function won't seem to work. (In fact
the .separator function also gave me the same problem, but I changed the data file so that I wouldn't have to use .separator). In fact, when I just go to sqlite myself and try .import XXX.out XXX it imports the XXX.out file into the XXX table just fine!
So the problem can't be with the XXX.out data file or the XXX table. But
somehow I just can't get it to work in my Perl script.
Can someone please shed some light on this? Thank you!

Replies are listed 'Best First'.
Re^2: perl DBI & SQLite
by perrin (Chancellor) on Oct 15, 2007 at 23:33 UTC
    Please post this as a top-level question, not as a response to a really old question.
      OK. Sorry and thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-29 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found