[yunqa.de] Descriptive Constraint error message for prepare/step

  • From: Clyde England <clyde@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 1 Jun 2010 14:25:08 +0800

Hi,

I have many columns in my database that have the "Not null" constraint.

I find it unhelpful when an update of one of these columns tries to replace
it with Null and then I just get the very generic error:

"Sqlite error 19 - constraint failed"

However, there does seem to be an inconsistency with error reporting in
DiSqlite3 (Via TDISQLite3Database)

That is, take the following simple query: "Update MyTable set Myfield =
Null"

If we use Prepare and Step to execute this query we get the non descriptive
error above.

However, if we use TDISQLite3Database.execute to execute the query we get a
much better descriptive error:

"SQLite Error 19 -MyTable.MyField may not be NULL."

Is there some setting I am missing to get the more descriptive error when
using prepare/step?

Or perhaps this is a limitation/quirk of using prepare/step and the
underlying Sqlite engine?

Thanks
Clyde

Other related posts: