diff options
author | drh <drh@noemail.net> | 2012-09-27 12:11:25 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2012-09-27 12:11:25 +0000 |
commit | cec320fb0e09e1b7f0bb1ecefb67066aa2d14095 (patch) | |
tree | 9066972047542eae935ced24bd0f2f07b4c69a36 /src | |
parent | 4d85fa760f28582b4482e98878f7777f8d1fa873 (diff) | |
parent | 50610df8ae1a03d971d732685549443c6a6c26d3 (diff) | |
download | sqlite-cec320fb0e09e1b7f0bb1ecefb67066aa2d14095.tar.gz sqlite-cec320fb0e09e1b7f0bb1ecefb67066aa2d14095.zip |
Merge the "PRAGMA busy_timeout" change into trunk.
FossilOrigin-Name: 1a679a1ef3b4f2d898c8cd83432d2b4c12bd93fa
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/pragma.c | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index 466dee551..66ef9fc4f 100644 --- a/src/main.c +++ b/src/main.c @@ -1121,6 +1121,7 @@ int sqlite3_busy_handler( db->busyHandler.xFunc = xBusy; db->busyHandler.pArg = pArg; db->busyHandler.nBusy = 0; + db->busyTimeout = 0; sqlite3_mutex_leave(db->mutex); return SQLITE_OK; } @@ -1158,8 +1159,8 @@ void sqlite3_progress_handler( */ int sqlite3_busy_timeout(sqlite3 *db, int ms){ if( ms>0 ){ - db->busyTimeout = ms; sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db); + db->busyTimeout = ms; }else{ sqlite3_busy_handler(db, 0, 0); } diff --git a/src/pragma.c b/src/pragma.c index bee62d871..f41f2db06 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1537,6 +1537,22 @@ void sqlite3Pragma( sqlite3_db_release_memory(db); }else + /* + ** PRAGMA busy_timeout + ** PRAGMA busy_timeout = N + ** + ** Call sqlite3_busy_timeout(db, N). Return the current timeout value + ** if one is set. If no busy handler or a different busy handler is set + ** then 0 is returned. Setting the busy_timeout to 0 or negative + ** disables the timeout. + */ + if( sqlite3StrICmp(zLeft, "busy_timeout")==0 ){ + if( zRight ){ + sqlite3_busy_timeout(db, sqlite3Atoi(zRight)); + } + returnSingleInt(pParse, "timeout", db->busyTimeout); + }else + #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) /* ** Report the current state of file logs for all databases |