Pavel Ivanov <[email protected]> wrote:
> The correct syntax is
>
> UPDATE sites SET createTime = DATETIME('NOW'), updateTime =
> DATETIME('NOW')
> WHERE rowid = new.rowid;
>
> So I wonder if you made a typo and actually only createTime were
> updated when updateTime remained unchanged.
The original statement is valid, it just doesn't mean what the OP thought it
meant:
UPDATE sites SET createTime =
(DATETIME('NOW') AND
(updateTime = DATETIME('NOW'))
WHERE rowid = new.rowid;
This says: set createTime to 1 if a) DATETIME('NOW') is logically true (always
the case, since it produces a non-empty string) and b) updateTime is equal to
DATETIME('NOW') (possible though unlikely). Otherwise, set createTime to 0 -
which is likely what happened most of the time.
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users