diff options
author | Kegsay <kegan@matrix.org> | 2020-04-16 10:06:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 10:06:55 +0100 |
commit | c1bca95adbe04a17d8feb91aa24dde9c4cffb1fb (patch) | |
tree | fca3ee9732ef93a9f8c664956c06de8b4c2c4058 /roomserver | |
parent | c2ea96190944d8e39b0c200e43b1eedfeeeb49a6 (diff) |
Add SQL tracing via DENDRITE_TRACE_SQL (#968)
* Add SQL tracing via DENDRITE_TRACE_SQL
Add this to `internal/sqlutil` in preparation for #897
* Not entirely
Diffstat (limited to 'roomserver')
-rw-r--r-- | roomserver/storage/postgres/storage.go | 3 | ||||
-rw-r--r-- | roomserver/storage/sqlite3/storage.go | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/roomserver/storage/postgres/storage.go b/roomserver/storage/postgres/storage.go index c91c59eb..a33bed8f 100644 --- a/roomserver/storage/postgres/storage.go +++ b/roomserver/storage/postgres/storage.go @@ -20,6 +20,7 @@ import ( "database/sql" "encoding/json" + "github.com/matrix-org/dendrite/internal/sqlutil" roomserverVersion "github.com/matrix-org/dendrite/roomserver/version" // Import the postgres database driver. @@ -39,7 +40,7 @@ type Database struct { func Open(dataSourceName string) (*Database, error) { var d Database var err error - if d.db, err = sql.Open("postgres", dataSourceName); err != nil { + if d.db, err = sqlutil.Open("postgres", dataSourceName); err != nil { return nil, err } if err = d.statements.prepare(d.db); err != nil { diff --git a/roomserver/storage/sqlite3/storage.go b/roomserver/storage/sqlite3/storage.go index f6c692fd..6f594430 100644 --- a/roomserver/storage/sqlite3/storage.go +++ b/roomserver/storage/sqlite3/storage.go @@ -22,6 +22,7 @@ import ( "errors" "net/url" + "github.com/matrix-org/dendrite/internal/sqlutil" roomserverVersion "github.com/matrix-org/dendrite/roomserver/version" "github.com/matrix-org/dendrite/common" @@ -52,7 +53,7 @@ func Open(dataSourceName string) (*Database, error) { } else { return nil, errors.New("no filename or path in connect string") } - if d.db, err = sql.Open(common.SQLiteDriverName(), cs); err != nil { + if d.db, err = sqlutil.Open(common.SQLiteDriverName(), cs); err != nil { return nil, err } //d.db.Exec("PRAGMA journal_mode=WAL;") |