Re: [Vala] Problems retrieving binary data from a sqlite3 database BLOB column
- From: Jens Georg <mail jensge org>
- To: Iñigo Serna <inigoserna gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Problems retrieving binary data from a sqlite3 database BLOB column
- Date: Sat, 09 Jul 2011 12:42:46 +0200
On So, 2011-06-26 at 00:24 +0200, Iñigo Serna wrote:
Hi,
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
image.
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?
Try
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]