On 8/26/15, Igor Tandetnik <igor at tandetnik.org> wrote:
>>
>> <http://www.sqlite.org/releaselog/3_8_1.html> says:
>> | the current time (ex: julianday('now')) is always the same for multiple
>> | function invocations within the same sqlite3_step() call.
>
> This only says that the time "stands still" for all the calculations
> necessary to produce a single row - not for the whole SELECT statement,
> as you seem to have previously implied.

Time stands still for multiple rows, as long as they are within the
same sqlite3_step() call.  For example, if you run:

    CREATE TABLE t1(a DATETIME);
    WITH RECURSIVE
       c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000000000)
    INSERT INTO t1(a) SELECT datetime('now') FROM c;

The entire INSERT statement will be a single sqlite3_step() call, and
so all billion rows of t1 will get set to the same time.

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to