forked from mirror/go-sqlite3
parent
f087cd79b2
commit
afd179bd93
|
@ -77,7 +77,7 @@ Boolean values can be one of:
|
||||||
| Auto Vacuum | `_vacuum` | <ul><li>`0` \| `none`</li><li>`1` \| `full`</li><li>`2` \| `incremental`</li></ul> | For more information see [PRAGMA auto_vacuum](https://www.sqlite.org/pragma.html#pragma_auto_vacuum) |
|
| Auto Vacuum | `_vacuum` | <ul><li>`0` \| `none`</li><li>`1` \| `full`</li><li>`2` \| `incremental`</li></ul> | For more information see [PRAGMA auto_vacuum](https://www.sqlite.org/pragma.html#pragma_auto_vacuum) |
|
||||||
| Busy Timeout | `_busy_timeout` \| `_timeout` | `int` | Specify value for sqlite3_busy_timeout. For more information see [PRAGMA busy_timeout](https://www.sqlite.org/pragma.html#pragma_busy_timeout) |
|
| Busy Timeout | `_busy_timeout` \| `_timeout` | `int` | Specify value for sqlite3_busy_timeout. For more information see [PRAGMA busy_timeout](https://www.sqlite.org/pragma.html#pragma_busy_timeout) |
|
||||||
| Case Sensitive LIKE | `_cslike` | `boolean` | For more information see [PRAGMA case_sensitive_like](https://www.sqlite.org/pragma.html#pragma_case_sensitive_like) |
|
| Case Sensitive LIKE | `_cslike` | `boolean` | For more information see [PRAGMA case_sensitive_like](https://www.sqlite.org/pragma.html#pragma_case_sensitive_like) |
|
||||||
| Foreign Keys | `_foreign_keys` | `boolean` | For more information see [PRAGMA foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys) |
|
| Foreign Keys | `_foreign_keys` \| `_fk` | `boolean` | For more information see [PRAGMA foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys) |
|
||||||
| Mutex Locking | `_mutex` | <ul><li>no</li><li>full</li></ul> | Specify mutex mode. |
|
| Mutex Locking | `_mutex` | <ul><li>no</li><li>full</li></ul> | Specify mutex mode. |
|
||||||
| Recursive Triggers | `_recursive_triggers` | `boolean` | For more information see [PRAGMA recursive_triggers](https://www.sqlite.org/pragma.html#pragma_recursive_triggers) |
|
| Recursive Triggers | `_recursive_triggers` | `boolean` | For more information see [PRAGMA recursive_triggers](https://www.sqlite.org/pragma.html#pragma_recursive_triggers) |
|
||||||
| Shared-Cache Mode | `cache` | <ul><li>shared</li><li>private</li></ul> | Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) |
|
| Shared-Cache Mode | `cache` | <ul><li>shared</li><li>private</li></ul> | Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) |
|
||||||
|
|
13
sqlite3.go
13
sqlite3.go
|
@ -803,14 +803,14 @@ func errorString(err Error) string {
|
||||||
// Specify locking behavior for transactions. XXX can be "immediate",
|
// Specify locking behavior for transactions. XXX can be "immediate",
|
||||||
// "deferred", "exclusive".
|
// "deferred", "exclusive".
|
||||||
//
|
//
|
||||||
// _busy_timeout=XXX
|
// _busy_timeout=XXX"| _timeout=XXX
|
||||||
// Specify value for sqlite3_busy_timeout.
|
// Specify value for sqlite3_busy_timeout.
|
||||||
//
|
//
|
||||||
// _cslike=Boolean
|
// _cslike=Boolean
|
||||||
// Default or disabled the LIKE operation is case-insensitive.
|
// Default or disabled the LIKE operation is case-insensitive.
|
||||||
// When enabling this options behaviour of LIKE will become case-sensitive.
|
// When enabling this options behaviour of LIKE will become case-sensitive.
|
||||||
//
|
//
|
||||||
// _foreign_keys=Boolean
|
// _foreign_keys=Boolean | _fk=Boolean
|
||||||
// Enable or disable enforcement of foreign keys. X can be 1 or 0.
|
// Enable or disable enforcement of foreign keys. X can be 1 or 0.
|
||||||
//
|
//
|
||||||
// _recursive_triggers=Boolean
|
// _recursive_triggers=Boolean
|
||||||
|
@ -938,8 +938,13 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
||||||
//
|
//
|
||||||
// https://www.sqlite.org/pragma.html#pragma_foreign_keys
|
// https://www.sqlite.org/pragma.html#pragma_foreign_keys
|
||||||
//
|
//
|
||||||
|
if _, ok := params["_foreign_keys"]; ok {
|
||||||
if val := params.Get("_foreign_keys"); val != "" {
|
pkey = "_foreign_keys"
|
||||||
|
}
|
||||||
|
if _, ok := params["_fk"]; ok {
|
||||||
|
pkey = "_fk"
|
||||||
|
}
|
||||||
|
if val := params.Get(pkey); val != "" {
|
||||||
switch strings.ToLower(val) {
|
switch strings.ToLower(val) {
|
||||||
case "0", "no", "false", "off":
|
case "0", "no", "false", "off":
|
||||||
foreignKeys = 0
|
foreignKeys = 0
|
||||||
|
|
Loading…
Reference in New Issue