Please help me refine the following SQL. I have pretty much all the C code in place, table creation & detection works, then.. brick wall.


I cannot add a single small text string into the table. What am I doing wrong? Trying with the
"UPDATE '%q' SET val=?2 WHERE key=?1;" string, where ?1 and ?2 and bound to text strings.


SQLite says SQLITE_DONE, but so does reading the table (= no data). Also sqlite3 cmdline tool confirms the emptiness.

What I'm trying to accomplish, is an INI-file like SQLite system, where keys map to values. Keys can be "a.b.c" style subpaths, for which the 'like' functions below exist.

If you'd be so kind :) to also check the rest of these strings. Otherwise, I'll be back on list, I'm sure! >;)

rc= Loc_PrepareSql( db, &ud->sql_set, "UPDATE '%q' SET val=?2 WHERE key=?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_get, "SELECT val FROM '%q' WHERE key=?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_del_key, "DELETE FROM '%q' WHERE key=?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_del_like_keys, "DELETE FROM '%q' WHERE key LIKE ?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_all_keys, "SELECT key FROM '%q';", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_like_keys, "SELECT key FROM '%q' WHERE key LIKE ?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_like_dump, "SELECT key,val FROM '%q' WHERE key LIKE ?1;", section );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_transaction_begin, "BEGIN;", NULL );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_transaction_commit, "COMMIT;", NULL );
if (!rc) rc= Loc_PrepareSql( db, &ud->sql_transaction_rollback, "ROLLBACK;", NULL );
//...


Reply via email to