1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Back out the 'txn' enhancement to date/time functions. The duration of a

"transaction" is confused and needs to be straightened out prior to moving
forward with this change.

FossilOrigin-Name: 4a145f07322d768a07619bed27e0390d50f3a01d07787b9296234a5ceb6f1218
This commit is contained in:
drh
2023-02-08 20:29:48 +00:00
parent 03b30b7abe
commit 601e4d4a0f
7 changed files with 40 additions and 124 deletions

View File

@@ -970,27 +970,18 @@ int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut){
** statement, the exact same time is returned for each invocation regardless
** of the amount of time that elapses between invocations. In other words,
** the time returned is always the time of the first call.
**
** Or, if bTxn, return the transaction time. The transaction time is the
** same for all calls within the same transaction.
**
** bTxn is 0 for SQL like datetime('now') and is 1 for datetime('txn').
*/
sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p, int bTxn){
sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){
int rc;
#ifndef SQLITE_ENABLE_STAT4
sqlite3_int64 *piTime;
sqlite3 *db = p->pOut->db;
sqlite3_int64 *piTime = &p->pVdbe->iCurrentTime;
assert( p->pVdbe!=0 );
piTime = bTxn ? &db->txnTime : &p->pVdbe->iCurrentTime;
#else
sqlite3_int64 iTime = 0;
sqlite3_int64 *piTime;
sqlite3 *db = p->pOut->db;
piTime = bTxn ? &db->txnTime : p->pVdbe!=0 ? &p->pVdbe->iCurrentTime : &iTime;
sqlite3_int64 *piTime = p->pVdbe!=0 ? &p->pVdbe->iCurrentTime : &iTime;
#endif
if( *piTime==0 ){
rc = sqlite3OsCurrentTimeInt64(db->pVfs, piTime);
rc = sqlite3OsCurrentTimeInt64(p->pOut->db->pVfs, piTime);
if( rc ) *piTime = 0;
}
return *piTime;