Hello
I'm using sqlite3.51.0 under windows.
I read a png-file in binary mode and get:
set c1
?PNG
^Z...
After write and read with database:
$d eval {create table t1(i integer, c BLOB);}
$d eval {insert into t1(1,$c1)}
set c2 [$d eval {select c from t1 where i=1}]
I get the following:
set c2
PNG\r\n^Z\n
How could this happen?
As you didn't post a complete working code segment that messes the PNG
up, we have nothing to go on to suggest which possible alternative may
be the most probable.
...
Here is a working script. The problem is the same.
::sqlite3 ::d :memory:
set f [::open t.png r]
::fconfigure $f -translation binary
set c1 [::read $f]
::close $f
::d eval {create table t1(i integer, c BLOB);}
::d eval {insert into t1 values(1,$c1)}
set c2 [::d eval {select c from t1 where i=1}]
* rene <user4652@newsgrouper.org.invalid>
| Could you please try to confirm with "@c1" instead of "$c1" in the insert statement?
| It was an advice from Richard Hipp, but it was not working on my side.
Same result, it does not make a difference whether I use $c1 or @c1 in
the sql.
If I store the database in a file (instead of memory) I can see the
correct binary PNG content in the disk file. So I guess it is the
readback which does the transformation.
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,105 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492344:34:11 |
| Calls: | 14,158 |
| Calls today: | 2 |
| Files: | 186,284 |
| D/L today: |
2,076 files (822M bytes) |
| Messages: | 2,502,674 |