Tom Shaw wrote:
Using PHP 5 and SQLite 2.8.14 (This also occurs when commanding SQLite
directly)
I create a table:
CREATE TABLE dnsbl (ip INTEGER PRIMARY KEY, flags VARCHAR(8), ctime
INTEGER, mtime INTEGER, cnt INTEGER, ptr TEXT, refcon INTEGER);
Then I insert a record:
INSERT INTO dnsbl VALUES(-596248527,"IP", 1120286944, 1120286944, 1,
"", 0);
Note the value of flags="IP". Now I update the record updating flags
and ctime because I did keep track if they changed:
UPDATE dnsbl SET flags="IP", ctime=1120286944, mtime=1120311794,
cnt=2, refcon=0 WHERE ip=-596248527;
After the update I check the update by
SELECT * FROM dnsbl WHERE ip=-596248527;
Flags somehow change from "IP" to -596248527. Note that the value
-596248527 now appears in the DB variable ip as well as the flags
variable.
Now there should be nothing wrong with the above that I can see BUT if
I change the DB variable name from ip to ip_num all works OK
Help and understanding is appreciated.
Tom
"IP" is a column 'IP' is a string.
In sql, double quotes indicates an identifier, such as a column name or
table name. If sqlite is unable to find a column by that name, then it
assumes you meant a string. But if you really mean a string, you should
use single ticks.
UPDATE dnsbl SET flags='IP', ctime=1120286944, mtime=1120311794, cnt=2,
refcon=0 WHERE ip=-596248527;
John LeSueur