|
3 | 3 | ** Purpose: wxWidgets wrapper around the SQLite3 embedded database library. |
4 | 4 | ** Author: Ulrich Telle |
5 | 5 | ** Created: 2005-07-14 |
6 | | -** Copyright: (c) 2005-2024 Ulrich Telle |
| 6 | +** Copyright: (c) 2005-2025 Ulrich Telle |
7 | 7 | ** License: LGPL-3.0+ WITH WxWindows-exception-3.1 |
8 | 8 | */ |
9 | 9 |
|
@@ -3487,6 +3487,33 @@ class WXDLLIMPEXP_SQLITE3 wxSQLite3Database |
3487 | 3487 | */ |
3488 | 3488 | void SetBusyTimeout(int milliSeconds); |
3489 | 3489 |
|
| 3490 | + /// Set the setlk timeout |
| 3491 | + /** |
| 3492 | + * This method sets a setlk timeout in ms used by eligible locks taken on wal mode databases |
| 3493 | + * by the specified database handle, if the VFS supports blocking locks. If the VFS does not |
| 3494 | + * support blocking locks, this function is a no-op. |
| 3495 | + * |
| 3496 | + * Passing 0 to this function disables blocking locks altogether. Passing -1 to this function |
| 3497 | + * requests that the VFS blocks for a long time - indefinitely if possible. The results of |
| 3498 | + * passing any other negative value are undefined. |
| 3499 | + * |
| 3500 | + * Internally, each SQLite database handle stores two timeout values - the busy-timeout |
| 3501 | + * (used for rollback mode databases, or if the VFS does not support blocking locks) and |
| 3502 | + * the setlk-timeout (used for blocking locks on wal-mode databases). The method |
| 3503 | + * SetBusyTimeout() sets both values, while this method sets only the setlk-timeout value. |
| 3504 | + * Therefore, to configure separate busy-timeout and setlk-timeout values for a single database |
| 3505 | + * handle, call SetBusyTimeout() followed by this method. |
| 3506 | + * |
| 3507 | + * Whenever the number of connections to a wal mode database falls from 1 to 0, the last |
| 3508 | + * connection takes an exclusive lock on the database, then checkpoints and deletes the wal file. |
| 3509 | + * While it is doing this, any new connection that tries to read from the database fails with an |
| 3510 | + * SQLITE_BUSY error. Or, if the blockOnConnect flag is true, the new connection blocks until |
| 3511 | + * the exclusive lock has been released. |
| 3512 | + * \param milliSeconds timeout in milliseconds |
| 3513 | + * \param blockOnConnect flag whether new connections should block until exclusive lock has been released |
| 3514 | + */ |
| 3515 | + void SetLockTimeout(int milliSeconds, bool blockOnConnect = false); |
| 3516 | + |
3490 | 3517 | /// Set a database configuration option |
3491 | 3518 | /** |
3492 | 3519 | * This method allows to configure several database settings. Most settings can be changed |
@@ -4027,7 +4054,7 @@ class WXDLLIMPEXP_SQLITE3 wxSQLite3Database |
4027 | 4054 |
|
4028 | 4055 | wxSQLite3DatabaseReference* m_db; ///< associated SQLite3 database |
4029 | 4056 | bool m_isOpen; ///< Flag whether the database is opened or not |
4030 | | - int m_busyTimeoutMs; ///< Timeout in milli seconds |
| 4057 | + int m_busyTimeoutMs; ///< Busy timeout in milli seconds |
4031 | 4058 | bool m_isEncrypted; ///< Flag whether the database is encrypted or not |
4032 | 4059 | int m_lastRollbackRC; ///< The return code of the last executed rollback operation |
4033 | 4060 | int m_backupPageCount; ///< Number of pages per slice for backup and restore operations |
|
0 commit comments