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



Wow, this works perfectly!!!

On 27 June 2011 09:11, Luca Bruno <lethalman88 gmail com> wrote:
Use unowned arrays to avoid copies:

unowned uint8[] data = (uint8[]) stmt.column_blob(4);
data.length = whatever...
var copied_data = data; // now you can copy the data

So we need to set the "data" variable length before using the returned
data, and the only way to use the returned data without copying is
marking it as unowned.
Is this correct?

We could use unowned uint8[] in the vapi anyway.
Also, we should report an error when trying to copy an array with no known
length.

Yes, it would avoid these unexpected crashes.
Anyway, I'm beginning with vala so maybe I am to new to notice these
little issues.


Thanks Luca and everyone,
Iñigo Serna



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