On Sun, Jan 9, 2011 at 7:21 PM, BareFeetWare <[email protected]>wrote:

> On 9 Jan 2011, at 2:48pm, BareFeetWare wrote:
>
> >> When I run this via C, using sqlite3_errmsg(), I get the error message:
> >>
> >> constraint failed
> >>
> >> but when I run it via the sqlite3 command line I get a more descriptive:
> >>
> >> SQL error: columns First, Last are not unique
> >>
> >> How can I get the more descriptive error via sqlite3_*() routines?
>
> On 10/01/2011, at 3:01 AM, Simon Slavin wrote:
>
> > http://www.sqlite.org/c3ref/errcode.html
> >
> > I'm guessing your 'constraint failed' is just the numeric result 19.
>  Using sqlite3_errmsg() or sqlite3_errmsg16() should get you the long text
> version.
>
> No. sqlite3_errmsg() is what I'm using, which is giving me the string
> "constraint failed".
>
> Where does the sqlite3 command line tool get the more descriptive error?
>
>

Tom, it seems it's related to this issue:
http://www.sqlite.org/cvstrac/tktview?tn=1640. So you have to call
sqlite3_errmsg after sqlite3_finalize() or sqlite3_reset().

Occasionally I had to fix this in order for user functions to supply error
strings (without this it's just simple default error). I checked two recent
versions of my admin with this fix and without and they supply exactly two
different errors as you described

Max Vlasov
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to