aboutsummaryrefslogtreecommitdiff
path: root/publicroomsapi
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 /publicroomsapi
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 'publicroomsapi')
-rw-r--r--publicroomsapi/storage/postgres/storage.go3
-rw-r--r--publicroomsapi/storage/sqlite3/storage.go3
2 files changed, 4 insertions, 2 deletions
diff --git a/publicroomsapi/storage/postgres/storage.go b/publicroomsapi/storage/postgres/storage.go
index 5a4bc8f9..8c4660cc 100644
--- a/publicroomsapi/storage/postgres/storage.go
+++ b/publicroomsapi/storage/postgres/storage.go
@@ -21,6 +21,7 @@ import (
"encoding/json"
"github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -38,7 +39,7 @@ type attributeValue interface{}
func NewPublicRoomsServerDatabase(dataSourceName string) (*PublicRoomsServerDatabase, error) {
var db *sql.DB
var err error
- if db, err = sql.Open("postgres", dataSourceName); err != nil {
+ if db, err = sqlutil.Open("postgres", dataSourceName); err != nil {
return nil, err
}
storage := PublicRoomsServerDatabase{
diff --git a/publicroomsapi/storage/sqlite3/storage.go b/publicroomsapi/storage/sqlite3/storage.go
index 80c04cab..12160162 100644
--- a/publicroomsapi/storage/sqlite3/storage.go
+++ b/publicroomsapi/storage/sqlite3/storage.go
@@ -23,6 +23,7 @@ import (
_ "github.com/mattn/go-sqlite3"
"github.com/matrix-org/dendrite/common"
+ "github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/gomatrixserverlib"
)
@@ -40,7 +41,7 @@ type attributeValue interface{}
func NewPublicRoomsServerDatabase(dataSourceName string) (*PublicRoomsServerDatabase, error) {
var db *sql.DB
var err error
- if db, err = sql.Open(common.SQLiteDriverName(), dataSourceName); err != nil {
+ if db, err = sqlutil.Open(common.SQLiteDriverName(), dataSourceName); err != nil {
return nil, err
}
storage := PublicRoomsServerDatabase{