Of course it is.

The function merely needs to store a value associated with a connection if the 
value does not exist (for that connection) when it is called and use a 
commit_hook and rollback_hook so that it knows when it needs to clear the value 
for the connection.  Then for every call on a connection where the a exists, 
return that value.

> -----Original Message-----
> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> bounces at mailinglists.sqlite.org] On Behalf Of Olivier Mascia
> Sent: Sunday, 21 February, 2016 10:10
> To: SQLite mailing list
> Subject: [sqlite] User-defined SQL functions
> 
> Dear all,
> 
> Is it possible to implement a SQL function
> (https://www.sqlite.org/c3ref/create_function.html), which implementation
> would be able to return the same value for the duration of the current
> transaction?
> 
> In other words, assume I'd like to implement some function which I could
> name 'now()' which would return the current_timestamp as julian day, but
> would return exactly the same value for any call made during the same
> transaction?
> 
> --
> Meilleures salutations, Met vriendelijke groeten, Best Regards,
> Olivier Mascia, integral.be/om




Reply via email to