On Mon, Dec 19, 2011 at 11:23 PM, Roger Binns <rog...@rogerbinns.com> wrote:
>
>
> On 19/12/11 20:31, romtek wrote:
> > As you can see, isActive is declared as an integer in table2,
>
> > This type of thing worked for years with an older version of SQLite
> > library
>
> Are you sure?

Absolutely. I have the same DB file (same schema but different data)
on my dev server and production server. Both were using PHP 5.2.x
until several days ago, and everything was working fine on both of
them. For years! When I switched to PHP 5.3.8 on my dev server, the
trigger was no longer working, and as soon as I switched to PHP 5.3.8
on the production server, the same thing happened. The fix was to
change the comparison to an int instead of to a string in the WHEN
clause.


> > .. that is used in PHP 5.2.17 ..
>
> PHP used to use SQLite 2.  The internals of SQLite 2 were that everything
> was stored as a string where this kind of comparison would work.

Old versions -- yes, but the PDO SQLite extension I was using was
using version 3.x. PHP 5.2.17 was using exactly SQLite lib 3.3.7. So,
maybe that version also stored everything as a string?


> Anyway this shows that you definitely don't get strings and numbers being
> equal to each other:

I do in SELECT statements. Consider this working example:

CREATE TABLE [table3] (
  [name] VARCHAR(20),
  [age] INTEGER);

The following two queries produce the same results in SQLite version 3.7.9:

SELECT * FROM table3 WHERE age=10;
SELECT * FROM table3 WHERE age='10';

So, comparisons in SELECT statements aren't performed the same way
they are in triggers. Triggers apparently use stricter type checking.
This has changed in some version in the 3.x line, and I am concerned
that this change was yelled about.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to