From 9e7b6bb8eac21117715250014cdb98209e02b9cf Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Thu, 25 May 2023 11:14:18 +0100 Subject: [PATCH] Improve connection setup. --- driver/driver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/driver/driver.go b/driver/driver.go index 8775d0f..a3c2bd6 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -19,6 +19,9 @@ // If no PRAGMAs are specified, a busy timeout of 1 minute // and normal locking mode are used. // +// Order matters: +// busy timeout and locking mode should be the first PRAGMAs set, in that order. +// // [URI]: https://www.sqlite.org/uri.html // [PRAGMA]: https://www.sqlite.org/pragma.html // [TRANSACTION]: https://www.sqlite.org/lang_transaction.html#deferred_immediate_and_exclusive_transactions @@ -71,8 +74,8 @@ func (sqlite) Open(name string) (_ driver.Conn, err error) { } if len(pragmas) == 0 { err := c.conn.Exec(` - PRAGMA locking_mode=normal; PRAGMA busy_timeout=60000; + PRAGMA locking_mode=normal; `) if err != nil { c.Close()