Hi all,
I'm trying to dump a single line into an SQLite database, however the line
is UTF8 text, and the operation fails.
Here's what the text file looks like when using head:
$ head -n 1 test1.txt
Type Time User Description
And here it is again when less (which doesn't translate the UTF8 text):
t...@y^@p...@e^@ ^@ ^@ ^@ ^@ ^@ ^...@t^@i...@m^@e^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@
^@ ^@
^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^...@u^@s...@e^@r^@ ^@ ^@ ^@ ^@ ^@ ^@
^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@
^...@d^@e...@s^@c...@r^@i...@p^@t...@i^@o...@n^@
^@ ^@ ^@ ^@ ^@ ^@ ^@ ^@ ^...@^m^@
Here is how I'm trying to insert the line into the database (perl):
$insert_sql = "insert into data (filename, line) values (" .
$dbh->quote($file) . "," . $dbh->quote($line) . ")";
$dbh->do( $insert_sql );
And here's the error I'm seeing:
SQL Insert: insert into data (filename, line) values
('/tmp/test1.txt','Type Time') User
Description
DBD::SQLite::db do failed: unrecognized token: "'T" at /tmp/test.pl line
643, <FILE> line 1.
unrecognized token: "'T"
It looks like one of the characters is breaking out of the quote, which I
didn't think was likely since I"m using $dbh->quote().
Another think that crossed my mind is that maybe I haven't set up the
database properly to accept UTF8 or UTF16 data, but I figured this was a
default in SQLite3.
Any assistance you can provide would be greatly appreciated. Thanks!
Bobby
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users