Doesn't update return wrong code while there isn't record in table?
Is it normal action?
_____code______________________________________________
#include <stdio.h>
#include <sqlite3.h>
void create_db (void);
int main (void)
{
int ret = -1;
create_db ();
sqlite3 *db = NULL;
ret = sqlite3_open ("test.db", &db);
sqlite3_stmt *p_stmt = NULL;
ret = sqlite3_prepare_v2 (db, "UPDATE t1 SET id=12, d111='hello'", -1,
&p_stmt, NULL);
printf ("sqlite3_prepare_v2(): %d, %s\n", ret, sqlite3_errmsg(db));
ret = sqlite3_step (p_stmt);
printf ("sqlite3_step(): %d, %s\n", ret, sqlite3_errmsg(db));
ret = sqlite3_finalize (p_stmt);
printf ("sqlite3_finalize(): %d, %s\n", ret, sqlite3_errmsg(db));
ret = sqlite3_close (db);
return 0;
}
void create_db (void)
{
int ret = -1;
sqlite3 *db = NULL;
ret = sqlite3_open ("test.db", &db);
ret = sqlite3_exec (db, "CREATE TABLE t1 (id INTEGER PRIMARY KEY, d111
TEXT)", NULL,NULL,NULL);
ret = sqlite3_close (db);
}
____run result_______________________________________
In Fedora-7.0, SQLite version 3.4.2, the result is:
[t...@localhost sqlite3]$ ./sqlite3update
sqlite3_prepare_v2(): 0, not an error
sqlite3_step(): 101, not an error
sqlite3_finalize(): 0, not an error
[t...@localhost sqlite3]$
In my dev-board, SQLite version 3.6.23.1, the result is:
[/usr1/bin]# ./sqlite3update
sqlite3_prepare_v2(): 0, not an error
sqlite3_step(): 101, unknown error
sqlite3_finalize(): 0, not an error
[/usr1/bin]#
--
View this message in context:
http://old.nabble.com/Doesn%27t-update-return-wrong-code-while-there-isn%27t-record-in-table--tp28654671p28654671.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users