From 4ab48f193516239cd4d3fc42769d41c078990348 Mon Sep 17 00:00:00 2001 From: Gert-Jan Timmer Date: Tue, 29 May 2018 12:03:18 +0200 Subject: [PATCH] Update Recursive Triggers ADD: Multiple Key --- README.md | 2 +- sqlite3.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eec00d8..3086586 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Boolean values can be one of: | 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` \| `_fk` | `boolean` | For more information see [PRAGMA foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys) | | Mutex Locking | `_mutex` | | 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` \| `_rt` | `boolean` | For more information see [PRAGMA recursive_triggers](https://www.sqlite.org/pragma.html#pragma_recursive_triggers) | | Shared-Cache Mode | `cache` | | Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) | | Time Zone Location | `_loc` | auto | Specify location of time format. | | Transaction Lock | `_txlock` | | Specify locking behavior for transactions. | diff --git a/sqlite3.go b/sqlite3.go index b932305..4de18d6 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -961,7 +961,14 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { // // https://www.sqlite.org/pragma.html#pragma_recursive_triggers // - if val := params.Get("_recursive_triggers"); val != "" { + pkey = "" // Reset pkey + if _, ok := params["_recursive_triggers"]; ok { + pkey = "_recursive_triggers" + } + if _, ok := params["_rt"]; ok { + pkey = "_rt" + } + if val := params.Get(pkey); val != "" { switch strings.ToLower(val) { case "0", "no", "false", "off": recursiveTriggers = 0