SQLITE basic syntax
Posted
by Doori Bar
on Stack Overflow
See other posts from Stack Overflow
or by Doori Bar
Published on 2010-06-14T15:34:11Z
Indexed on
2010/06/14
15:42 UTC
Read the original article
Hit count: 297
I seem to misunderstand a basic syntax, why this sample works:
sqlite3_prepare_v2(db, "insert into test values('boo','boo',0);", strlen(querystring)+1 , &stmt, NULL);
if ((rc = sqlite3_step(stmt)) != SQLITE_DONE)
fprintf(stderr, "Error: sqlite3_step() %d. Error Message %s;\n",rc,sqlite3_errmsg(db));
But when I try this query: "insert into test(strtest) values('boo');"
I get an error: Error: sqlite3_step() 19. Error Message constraint failed;
What am I missing?
table test is: "create table test (blobtest BLOB(4) NOT NULL, strtest VARCHAR NOT NULL, inttest INTEGER NOT NULL );"
Thanks, Doori Bar
© Stack Overflow or respective owner