-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 17/10/11 02:00, Jean-Christophe Deschamps wrote:
> That's an half-backed solution.  I know of no application which test
> error codes AND THEN test error message _content_ before selecting a
> way to deal with the error.

The application won't but the user the message is displayed to will then
diagnose based on the message and the SQL used.

> The current situation is way too vague and leaves you dry about the
> cause.

A solution is to have an error flag and diagnostics you store somewhere
(best per thread) and set when the error occurs in your code.  In your
wrapper around sqlite3_step you check on its return if the error flag is
set, and if so issue an error and diagnostics in whatever way makes sense.

Consequently you will get rich error information that makes best sense for
your code and will have a considerably easier time diagnosing it.

> I can think of no good reason why it shouldn't make it in the core
> code:

It will end up just as overloaded as SQLITE_ERROR is.

> it costs nothing,

It would have to have added to all the relevant test cases and
documentation.  Every developer using SQLite will have to consider if a
particular situation would result in SQLITE_ERROR being returned or
SQLITE_DOMAIN.  And once this is added every developer till SQLite 4 comes
out would have to go through that cognitive process.  Plus existing error
handling code would need to be looked at and updated in existing code bases.

> it doesn't eat any resource,

It makes switch statements larger, and requires

> it should need no change to the test harness,

Of course it does.  At the very least it would need to be ensured that the
error code passes through correctly, that default error text sticks should
the developer issuing the message not set one etc.

> it covers something that isn't covered yet and can only make life a bit
> less difficult at times.

It would make *your* life a little less difficult in the short term :-)
It incurs a cost on everyone else for no real benefit.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk6cUPkACgkQmOOfHg372QRLKQCfbhMT8J4ATKI7L/3udgrn1qu3
XU8AnRI5sHjdKy1VQTd+ETBjWes9QXBl
=9Wtn
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to