-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 19/12/11 20:31, romtek wrote: > As you can see, isActive is declared as an integer in table2,
That declaration only does type coercion on the value stored in the database (if appropriate). > ... when I expect it to be activated ... Why would you expect it to be activated? You stored an integer and are comparing it to a string. They really aren't the same thing. > This type of thing worked for years with an older version of SQLite > library Are you sure? > .. 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. Anyway this shows that you definitely don't get strings and numbers being equal to each other: sqlite> select 1='1'; 0 sqlite> select '1'=1; 0 sqlite> create table foo(x); sqlite> insert into foo values(1); sqlite> select * from foo where x='1'; sqlite> select * from foo where x=1; 1 > I've always thought that because SQLite didn't enforce data types, It does. It just doesn't require that the value stored in a column has the same type for all rows. Some of the operators will do type coercion though. For example '+' will convert its operands to integers and if the conversion fails treat them as zero. String concatenation coerces to string etc. sqlite> select '1'+'1'+x'aa'; 2 sqlite> select 3 || 4; 34 Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk7wG+UACgkQmOOfHg372QQ3ywCgwr+5/I2IvpwgCsYRcq+hBJf2 NDgAoNSRYvYcioP+9fbf3DOPGVhUKERK =9llt -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users