Re: SQLite function .import not working
by ikegami (Patriarch) on Oct 16, 2007 at 03:33 UTC
|
| [reply] [d/l] [select] |
Re: SQLite function .import not working
by Illuminatus (Curate) on Oct 16, 2007 at 13:57 UTC
|
First of all, just to be sure, the example you provided had an opening double-quote, but not a closing one. I am assuming that this is a typo. Did you RTFC :)? (I understand that having only one eye can make this kind of hard). I looked at dbdimp.c line 271. It looks to me like the DBD api for SQLite may not use the dot notation for commands. Did you try it without the leading dot? Also, from the code, it looks like it is possible to turn on message tracing. This might help you out as well.
Illuminatus | [reply] |
|
|
You monks are indeed wise. Thank you very much. I have it now. .import is not something the database understands. Therefore, I just tried
system "sqlite3 databasename \".import filename tablename\"";
and it worked! I think the same would work for all the other sqlite3 functions that begins with a dot (".").
| [reply] |
|
|
By the way, you can avoid escaping double-quotes by using
the qq operator, as follows:
system qq{sqlite3 databasename ".import filename tablename"};
| [reply] [d/l] |
|
|
sqlite3 dbname
.separator \t
.import filename tablename
How can I do that? (put 2 sqlite3 commands on the command line)? | [reply] [d/l] |
|
|
|
|
Yes, you are correct, it was just a typo in my post. I did have a closing quote in my code.
| [reply] |
Re: SQLite function .import not working
by Anonymous Monk on Feb 13, 2010 at 01:41 UTC
|
I was wondering if there is a way to use the .commands via DBI:: rather then resorting to a system call etc? | [reply] |
|
|
I believe it's possible to add driver-specific methods to DBI database handles, but no one has ported sqlite's functions.
| [reply] [d/l] |
|
|
They're not part of sqlite, they're part of the sqlite shell program
| [reply] |
|
|
|
|
|
|
No. Those are special commands for the sqlite shell. Yes, you could rewrite the program using perl with DBI.
| [reply] |