On Mon, Sep 21, 2015 at 6:49 PM, Richard Hipp <drh at sqlite.org> wrote:

> On 9/21/15, Hugues Bruant <hugues at aerofs.com> wrote:
> > Table schema:
> >
> > CREATE TABLE cv (cv_s integer not null, cv_o blob not null, cv_t integer
> > not null, primary key(cv_s, cv_o));
> >
> > Prepared statement:
> >
> > UPDATE cv SET cv_t=? where cv_s=? and cv_o=?;
>
> My guess is that the WHERE clause matches no rows.  So it isn't
> silently failing, it is doing exactly what it is suppose to do:
> Update only those rows you have specified.
>
I wish it where that simple.

The where clause should match, as evidenced by the fact that:

SELECT cv_t from cv where cv_s=? and cv_o=?;

returns the correct value both before and after the failing UPDATE.

If that's not convincing enough, I should mention that the code checks the
change count and falls back to an INSERT if the UPDATE reports that no
rows where updated. This results in a SQLITE_CONSTRAINT error, which
is how we discovered that the update was failing in the first place.

Reply via email to