ios - SQLStatement is getting rejected -


i'm trying insert user note sqlitedb through method reason, not passing if statement...

if(sqlite3_prepare_v2(database, sqlstatement, -1, &compiledstatement, null) == sqlite_ok){} 

i'm not sure think sqlstatement getting rejected or reason.

(void) insertquicknoteindatabase:(nsstring *)name :(nsstring *)note{ sqlite3 * database;  if(sqlite3_open([databasepath utf8string], &database) == sqlite_ok) {     const char *sqlstatement = "insert detail(quicknote) values (?), name = ?";     sqlite3_stmt *compiledstatement;     if(sqlite3_prepare_v2(database, sqlstatement, -1, &compiledstatement, null) == sqlite_ok) {          sqlite3_bind_text(compiledstatement, 8, [note utf8string], -1, sqlite_transient);         sqlite3_bind_text(compiledstatement, 2, [name utf8string], -1, sqlite_transient);          if(sqlite_done != sqlite3_step(compiledstatement))             nsassert1(0, @"error while inserting data. '%s'", sqlite3_errmsg(database));     }     sqlite3_finalize(compiledstatement); } sqlite3_close(database); } 

you need log error using sqlite3_errmsg. problem comma in query where clause. insert statements should not have where clause. perhaps mean use update:

"update detail set quicknote = ? name = ?" 

also, calls sqlite3_bind_xxx need have proper indexes. bind indexes start @ 1 , go up. using 8 2. want 1 2.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -