Igor Tandetnik wrote:
> 
> StyveA <styve.at...@technicolor.com> wrote:
>> I'm a newbie using sqlite3, and i'm trying to save in a database some
>> blob
>> datas (just string and integer),
>> but I can't get my data back.. I just obtain a segfault..
>> I have searched in forums, but did'nt find anything that could help me..
>>
>> int *blob;
>> blob = 1990;
>> sqlite3_bind_blob(ppStmt, 1, blob, sizeof(blob), SQLITE_TRANSIENT);
> 
> You are aksing SQLite to read some bytes from address 1990. This address
> is likely invalid, hence the segfault. I suspect you meant
> 
> int blob;
> blob = 1990;
> sqlite3_bind_blob(ppStmt, 1, &blob, sizeof(blob), SQLITE_TRANSIENT);
> 
> Though it's not clear why you want to store a simple integer as a blob,
> and not as an integer. I assume it's just a toy example.
> 
> 
>> sqlite3_exec(db, "COMMIT", NULL, NULL, NULL);
>> sqlite3_exec(db, "END", NULL, NULL, NULL);
> 
> First, COMMIT and END are synonyms, they do the same thing. Second, you've
> never executed BEGIN, so you shouldn't run COMMIT (or END) either. If you
> check the return code of these sqlite3_exec calls, you'll see they have in
> fact failed.
> -- 
> Igor Tandetnik
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

Thanks for answer and the advises,

In fact, I'm storing an integer just 'cause my goal is to store data without
knowing their type, it can be integer or text..
So here I'm just trying with integer as a starting point.

For the COMMIT/END point,  I though that sqlite_prepare(..) was sufficient
to do it, so Begin is mandatory?

Regards,

Styve
-- 
View this message in context: 
http://old.nabble.com/Blob-newbie-problem-tp31602374p31602513.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to