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

Reply via email to