C S <[EMAIL PROTECTED]> wrote:
> thanks for all your help too man. here is what is in
> the table images so far when i do a select. its 3
> blobs:
>
> sqlite> select imageID, hex(imageData) from Images;
> 1|00 0003 0006 0009 000C 000F 0012 0015 0018 001B 00
> 2|00 0001 0002 0003 0004 0005 0006 0007 0008 0009 00
> 3|00 0001 0002 0003 0004 0005 0006 0007 0008 0009 00
> *****************************************************
I bet you are running on a little-endian machine. On such a machine, the
low-order byte comes first. So the correct breakdown is
1|0000 0300 0600 0900 0C00 0F00 1200 1500 1800 1B00
For example, two bytes 0300 represent a two-byte integer 3 in
little-endian (least-significant byte first, most-significant last).
> while ((status = sqlite3_step(statement)) ==
> SQLITE_ROW)
> {
> i++
>
> num_bytes = sqlite3_column_bytes(statement, i);
'i' refers to the row index, and is incremented with each step. The last
parameter to sqlite3_column_bytes is a _column_ index: it doesn't change
as you scan through rows. You always pass 0 to retrieve the first column
(from the current row, whatever it happens to be), 1 to retrieve the
second column and so on.
Your code just accidentally happens to pass a correct column index for
the first row, but wrong index for all subsequent rows.
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users