On 3/26/07, Martin Jenkins <[EMAIL PROTECTED]> wrote:
Vivien Malerba wrote:
> Hi!
>
> I've got an error reporting problem when trying to insert a row which
> breaks a UNIQUE constraint in a table in a C program, I get the
> following error with sqlite3_errmsg():
> "SQL logic error or missing database"
>
> If I fire the sqlite3 program and run the same SQL query, I get the
> following error:
> "SQL error: column name is not unique"
> which is much more obvious to understand.
>
> Any idea how I could get that error message calling sqlite3_errmsg()?

The pysqlite wrapper has a bug which reports the same error message if
you try to nest transactions. I fixed the wrapper (locally) by adding an
sqlite_reset(). I think there's a new API (sqlite_prepare_v2()?) which
has the same effect. If you can't search (say) gmane then post a tiny
code snippet and someone who uses the C API more than I do will spot the
problem straight away.

Here is a sample test case, just uncompress, run "make" and "./test".
Here is what I get using SQLite 3.3.13 (On Linux):
SQL error (step): SQL logic error or missing database
SQL error (step): column name is not unique

It shows that calling sqlite3_reset() seems to be required (contrary
to what the doc says), or maybe I got something wrong...

Thanks,

Vivien

Attachment: test_case.tgz
Description: GNU Zip compressed data

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to