Folks
I have a C program that creates in-memory database with unique column.
My code basically inserts row in database and if it gets duplicate row it
selects the duplicate row from database and prints information.
The problem is that when I select the row it says row not found.
I simplified the code as follows:
sqlite3_prepare("insert statement")
sqlite3_bind columns
sqlite3_step
sqlite3_finalize
sqlite3_exec COMMIT
When I insert the row I get following error message:
column MD5Sum is not unique
So I immediately do a select as follows:
sqlite3_prepare("select statement")
sqlite3_bind column
sqlite3_step
sqlite3_finalize
But I do not get SQLITE_ROW return code. Here is my code.
sqlite3_prepare(select statement)
sqlite3_bind_text(SelectStmtHandle, 1, MD5Sum, strlen(MD5Sum),
SQLITE_TRANSIENT);
ReturnCode = sqlite3_step(SelectStmtHandle);
if (ReturnCode != SQLITE_ROW)
{
sqlite3_reset(SelectStmtHandle);
printf("Row not found. %s\n", sqlite3_errmsg(DbHandle));
return(2);
}
Here is the message it prints:
Row not found. not an error
I am new to sqlite, what am I doing wrong?
What return code should I get if there is only one row in result set?
I print the columns before I do insert and I can see that I have duplicate row.
Sixth column (MD5SUM) is the unique column.
1219 10.136.28.112 44376 239.56.112.112 8146
dd5b8911bf377682d8963a859b8c2055 2010-09-24 14.11.07.545436
1219 10.136.28.112 44376 239.56.112.112 8146
dd5b8911bf377682d8963a859b8c2055 2010-09-24 14.11.07.545855
Hemant Shah
E-mail: [email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users