Re: [sqlite] Detecting multiple CHECK failures

2014-10-09 Thread Peter Haworth
On Thu, Oct 9, 2014 at 9:00 AM, <sqlite-users-requ...@sqlite.org> wrote: > Message: 6 > Date: Wed, 8 Oct 2014 14:40:57 -0500 > From: Nico Williams <n...@cryptonector.com> > To: General Discussion of SQLite Database <sqlite-users@sqlite.org> > Subject: Re:

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread James K. Lowden
On Wed, 08 Oct 2014 15:01:39 +0200 Clemens Ladisch wrote: > SQL constraints were designed to catch _programming_ errors, not > _user_ errors. Neither and both, actually. Database theory doesn't distinguish between different sources of invalid input. Constraints enforce

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread Nico Williams
On Wed, Oct 8, 2014 at 8:01 AM, Clemens Ladisch wrote: > Peter Haworth wrote: >> I'm a great believer in using CHECK constraints to do as much validation as >> possible within the database rather than code it in my application. >> >> However, I think I'm right in saying that

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread Nico Williams
On Wed, Oct 8, 2014 at 12:23 PM, Peter Haworth wrote: > Actually, I do get the CHECK constraint name returned to me in the error > message otherwise, as you say, it would be impossible to find out what > failed. > > I use a translation table in my application to reformat the

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread Peter Haworth
Hi Simon, Actually, I do get the CHECK constraint name returned to me in the error message otherwise, as you say, it would be impossible to find out what failed. I use a translation table in my application to reformat the SQLite error message to a more suitable format to present to my users based

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread Clemens Ladisch
Peter Haworth wrote: > I'm a great believer in using CHECK constraints to do as much validation as > possible within the database rather than code it in my application. > > However, I think I'm right in saying that as soon as a CHECK constraint > fails, an error is returned to my application so no

Re: [sqlite] Detecting multiple CHECK failures

2014-10-08 Thread gwenn
Hello, I think that SQLite reports the first constraint which fails: http://sqlite.org/changes.html 2012-05-14 (3.7.12) Report the name of specific CHECK constraints that fail. sqlite> CREATE TABLE test (data TEXT CONSTRAINT notEmpty CHECK (length(data) > 0)); sqlite> INSERT INTO test VALUES

Re: [sqlite] Detecting multiple CHECK failures

2014-10-07 Thread Simon Slavin
On 7 Oct 2014, at 10:00pm, Peter Haworth wrote: > I'm a great believer in using CHECK constraints to do as much validation as > possible within the database rather than code it in my application. > > However, I think I'm right in saying that as soon as a CHECK constraint >

[sqlite] Detecting multiple CHECK failures

2014-10-07 Thread Peter Haworth
I'm a great believer in using CHECK constraints to do as much validation as possible within the database rather than code it in my application. However, I think I'm right in saying that as soon as a CHECK constraint fails, an error is returned to my application so no other CHECK constraints are