On 12 Dec 2009, at 5:09am, FrankLane wrote:
Thank you for pasting your code fragment. It makes it easier to help you.
If you have your code check the results of '->errorCode' (and depending on that
'->errorInfo') you will get information about whether each command executed
correctly and what went wrong.
> $sqlcmd = '.mode tabs';
The '.mode' command (and all commands which start with a dot) is not a SQLite
command. It's understood by the sqlite3 command-line application, and is
interpreted by that specific application, not the SQLite database library. You
cannot use these commands in a mundane use of the SQLite library. If you want
to do the equivalent of '.import' you have two options:
A) Do the .import yourself, using the command-line tool, as a first step in
setting up your database file. This works well if after the initial .import
you will never need to do it again.
B) Write some code in your preferred programming language which reads the text
file and executes the appropriate INSERT commands.
Doing (B) in PHP shouldn't be hard and is a good test of whether you understand
a PHP interface to SQLite correctly. Lastly
$dbHandle = new PDO('sqlite:'."/Users/me/junk.txt");
although having a database with a .txt extension will work, I would not
recommend it. If a text file is associated with a SQL database it normally
contains the SQL commands needed to create that database. There is no
standardised extension for SQLite files but you might use '.db' or '.sqlite'
instead.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users