Skip to content

Commit 9e79299

Browse files
committed
Add: Documentation for opening as Immutable
1 parent f14a756 commit 9e79299

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Boolean values can be one of:
8080
| Defer Foreign Keys | `_defer_foreign_keys` \| `_defer_fk` | `boolean` | For more information see [PRAGMA defer_foreign_keys](https://www.sqlite.org/pragma.html#pragma_defer_foreign_keys) |
8181
| Foreign Keys | `_foreign_keys` \| `_fk` | `boolean` | For more information see [PRAGMA foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys) |
8282
| Ignore CHECK Constraints | `_ignore_check_constraints` | `boolean` | For more information see [PRAGMA ignore_check_constraints](https://www.sqlite.org/pragma.html#pragma_ignore_check_constraints) |
83+
| Immutable | `immutable` | `boolean` | For more information see [Immutable](https://www.sqlite.org/c3ref/open.html) |
8384
| Journal Mode | `_journal` | <ul><li>DELETE</li><li>TRUNCATE</li><li>PERSIST</li><li>MEMORY</li><li>WAL</li><li>OFF</li></ul> | For more information see [PRAGMA journal_mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) |
8485
| Locking Mode | `_locking` | <ul><li>NORMAL</li><li>EXCLUSIVE</li></ul> | For more information see [PRAGMA locking_mode](https://www.sqlite.org/pragma.html#pragma_locking_mode) |
8586
| Mode | `mode` | <ul><li>ro</li><li>rw</li><li>rwc</li><li>memory</li></ul> | Access Mode of the database. For more information see [SQLite Open](https://www.sqlite.org/c3ref/open.html) |

sqlite3.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,15 @@ func errorString(err Error) string {
810810
// - shared
811811
// - private
812812
//
813+
// immutable=Boolean
814+
// The immutable parameter is a boolean query parameter that indicates
815+
// that the database file is stored on read-only media. When immutable is set,
816+
// SQLite assumes that the database file cannot be changed,
817+
// even by a process with higher privilege,
818+
// and so the database is opened read-only and all locking and change detection is disabled.
819+
// Caution: Setting the immutable property on a database file that
820+
// does in fact change can result in incorrect query results and/or SQLITE_CORRUPT errors.
821+
//
813822
// go-sqlite3 adds the following query parameters to those used by SQLite:
814823
// _loc=XXX
815824
// Specify location of time format. It's possible to specify "auto".

0 commit comments

Comments
 (0)