aboutsummaryrefslogtreecommitdiff
path: root/mediaapi
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-04-16 10:06:55 +0100
committerGitHub <noreply@github.com>2020-04-16 10:06:55 +0100
commitc1bca95adbe04a17d8feb91aa24dde9c4cffb1fb (patch)
treefca3ee9732ef93a9f8c664956c06de8b4c2c4058 /mediaapi
parentc2ea96190944d8e39b0c200e43b1eedfeeeb49a6 (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 'mediaapi')
-rw-r--r--mediaapi/storage/postgres/storage.go3
-rw-r--r--mediaapi/storage/sqlite3/storage.go3
2 files changed, 4 insertions, 2 deletions
diff --git a/mediaapi/storage/postgres/storage.go b/mediaapi/storage/postgres/storage.go
index 6259f4a1..18126b15 100644
--- a/mediaapi/storage/postgres/storage.go
+++ b/mediaapi/storage/postgres/storage.go
@@ -21,6 +21,7 @@ import (
// Import the postgres database driver.
_ "github.com/lib/pq"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -35,7 +36,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/mediaapi/storage/sqlite3/storage.go b/mediaapi/storage/sqlite3/storage.go
index cfa5bb98..abafecf2 100644
--- a/mediaapi/storage/sqlite3/storage.go
+++ b/mediaapi/storage/sqlite3/storage.go
@@ -21,6 +21,7 @@ import (
// Import the postgres database driver.
"github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/mediaapi/types"
"github.com/matrix-org/gomatrixserverlib"
_ "github.com/mattn/go-sqlite3"
@@ -36,7 +37,7 @@ type Database struct {
func Open(dataSourceName string) (*Database, error) {
var d Database
var err error
- if d.db, err = sql.Open(common.SQLiteDriverName(), dataSourceName); err != nil {
+ if d.db, err = sqlutil.Open(common.SQLiteDriverName(), dataSourceName); err != nil {
return nil, err
}
if err = d.statements.prepare(d.db); err != nil {