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
65
65
// 'failover' => [],
66
66
// 'foreignKeys' => true,
67
67
// 'busyTimeout' => 1000,
68
+ // 'synchronous' => null,
68
69
// 'dateFormat' => [
69
70
// 'date' => 'Y-m-d',
70
71
// '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
56
56
*/
57
57
protected $ busyTimeout ;
58
58
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
+
59
68
/**
60
69
* @return void
61
70
*/
@@ -70,6 +79,10 @@ public function initialize()
70
79
if (is_int ($ this ->busyTimeout )) {
71
80
$ this ->connID ->busyTimeout ($ this ->busyTimeout );
72
81
}
82
+
83
+ if (is_int ($ this ->synchronous )) {
84
+ $ this ->connID ->exec ('PRAGMA synchronous = ' . $ this ->synchronous );
85
+ }
73
86
}
74
87
75
88
/**
Original file line number Diff line number Diff line change @@ -208,6 +208,8 @@ Others
208
208
- Added a new configuration ``foundRows `` for MySQLi to use ``MYSQLI_CLIENT_FOUND_ROWS ``.
209
209
- Added the ``BaseConnection::resetTransStatus() `` method to reset the transaction
210
210
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 ``.
211
213
212
214
Model
213
215
=====
Original file line number Diff line number Diff line change @@ -178,6 +178,8 @@ Description of Values
178
178
See `SQLite documentation <https://www.sqlite.org/pragma.html#pragma_foreign_keys >`_.
179
179
To enforce Foreign Key constraint, set this config item to true.
180
180
**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.
181
183
**numberNative ** (``MySQLi `` only) true/false (boolean) - Whether to enable MYSQLI_OPT_INT_AND_FLOAT_NATIVE.
182
184
**foundRows ** (``MySQLi `` only) true/false (boolean) - Whether to enable MYSQLI_CLIENT_FOUND_ROWS.
183
185
**dateFormat ** The default date/time formats as PHP's `DateTime format `_.
You can’t perform that action at this time.
0 commit comments