On 27-11-2013 03:55, James K. Lowden wrote:
On Mon, 25 Nov 2013 19:44:15 +0100
Luuk <luu...@gmail.com> wrote:
On 25-11-2013 13:41, Simon Slavin wrote:
I'm wondering whether there's an argument that it should be
evaluated just once for a transaction.
I'm still thinking about this question,
i can think of some benefits if its evaluated just once per
transaction.
but i hope anyone has some examples why its better to evalutate it
once per statement.
The easy answer is: that's how SQL is defined.
A more complicated answer is that, inside a user-defined transaction,
you have control over the meaning of "now". You can insert "now" into
a table and re-use it as often as you like, without fear of it being
changed by another process. If, on the other hand, you'd like to
execute several statements in a transaction, you might also like to
know when "now" is for each one. The per-statement definition of "now"
supports that use.
There's actually nothing special about "now". Other functions, e.g.
changes(), may vary between statements in a transaction. (It happens
SQLite doesn't have many such.) You really just want to preserve the
function's defintion as "returns correct output each time it's
called".
HTH.
ok, thanks for the answer.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users