Re: [Vala] Problems retrieving binary data from a sqlite3 database BLOB column

On So, 2011-06-26 at 00:24 +0200, Iñigo Serna wrote:

I have problems retrieving binary data from a sqlite3 DB.

One of the columns of the database (f.e., number 3) is a BLOB with png images.

Using FileUtils.set_data("test.png", (uint8[]) smtm.column_blob(3));
writes a 8-bytes file with the first bytes of the image ("PNG" header
and some other numbers)

I'm sure the query is ok as I also retrieve other fields in the same
query and even stmt.column_bytes(3) returns the correct size of the

Documentation explains "smtm.column_blob()" returns a void * so I
guess I have to cast to uint8[] to use FileUtils.set_data.

What am I doing wrong?

var data = (uint8[]) smtm.column_blob(3);
data.length = smtm.column_bytes(3);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]