File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed
Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ class Database extends Config
6565 // 'failover' => [],
6666 // 'foreignKeys' => true,
6767 // 'busyTimeout' => 1000,
68+ // 'synchronous' => null,
6869 // 'dateFormat' => [
6970 // 'date' => 'Y-m-d',
7071 // 'datetime' => 'Y-m-d H:i:s',
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ class Connection extends BaseConnection
5656 */
5757 protected $ busyTimeout ;
5858
59+ /**
60+ * The setting of the "synchronous" flag
61+ *
62+ * @var int|null flag
63+ *
64+ * @see https://www.sqlite.org/pragma.html#pragma_synchronous
65+ */
66+ protected $ synchronous ;
67+
5968 /**
6069 * @return void
6170 */
@@ -70,6 +79,10 @@ public function initialize()
7079 if (is_int ($ this ->busyTimeout )) {
7180 $ this ->connID ->busyTimeout ($ this ->busyTimeout );
7281 }
82+
83+ if (is_int ($ this ->synchronous )) {
84+ $ this ->connID ->exec ('PRAGMA synchronous = ' . $ this ->synchronous );
85+ }
7386 }
7487
7588 /**
Original file line number Diff line number Diff line change @@ -208,6 +208,8 @@ Others
208208- Added a new configuration ``foundRows `` for MySQLi to use ``MYSQLI_CLIENT_FOUND_ROWS ``.
209209- Added the ``BaseConnection::resetTransStatus() `` method to reset the transaction
210210 status. See :ref: `transactions-resetting-transaction-status ` for details.
211+ - SQLite3 has a new Config item ``synchronous `` to adjust how strict SQLite is at flushing
212+ to disk during transactions. Modifying this can be useful if we use journal mode set to ``WAL ``.
211213
212214Model
213215=====
Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ Description of Values
178178 See `SQLite documentation <https://www.sqlite.org/pragma.html#pragma_foreign_keys >`_.
179179 To enforce Foreign Key constraint, set this config item to true.
180180**busyTimeout ** (``SQLite3 `` only) milliseconds (int) - Sleeps for a specified amount of time when a table is locked.
181+ **synchronous ** (``SQLite3 `` only) flag (int) - How strict SQLite will be at flushing to disk during transactions.
182+ Use `null ` to stay with the default setting. This can be used since v4.6.0.
181183**numberNative ** (``MySQLi `` only) true/false (boolean) - Whether to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE.
182184**foundRows ** (``MySQLi `` only) true/false (boolean) - Whether to enable MYSQLI_CLIENT_FOUND_ROWS.
183185**dateFormat ** The default date/time formats as PHP's `DateTime format `_.
You can’t perform that action at this time.
0 commit comments