If the item contains a NUL character, or if it begins with a character whose ordinal value is 0x01, PHP will apply a binary encoding scheme so that you can safely store and retrieve binary data.
and that's why you don't need to convert manually your data. This function does all the job. But in other API, not PHP, there is not such function sqlite_escape_string to escape binary data. And there everone can do what they want with their data.
Encode with self made functions or use function sqlite_encode_binary, which can be found in sqlite source code.
Lay ï wrote:
Hello!
I don't understand why do some people have a bad time with conversions, if they want to store BLOB in SQLite. The official FAQ also recommends that one should use any kind of conversion to convert binary data to a format that is suitable for SQLite:
http://www.sqlite.org/faq.html#q12
In my opinion, this is completely unnecessary. I'm using it via PHP, putting the binary data into the sqlite_escape_string function and it may go into the query:
<? dl("sqlite.so"); $conn=sqlite_open(":memory:"); sqlite_query($conn,"create table bindata(data blob)"); $bin=str_repeat(chr(0),5).chr(255).chr(0).chr(255).str_repeat(chr(0),5); sqlite_query($conn,"insert into bindata(data)values('".sqlite_escape_string($bin)."')"); $handle=sqlite_query($conn,"select * from bindata"); $result=sqlite_fetch_array($handle); echo "<pre>".bin2hex($result["data"])."</pre>"; ?>
Does anybody know about this solution?
Bye!
Lay
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- MÄrtiÅÅ MoÅeiko
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

