mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
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
This commit is contained in:
parent
c2ea961909
commit
c1bca95adb
24 changed files with 199 additions and 22 deletions
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
||||
// Import the postgres database driver.
|
||||
|
@ -62,7 +63,7 @@ type SyncServerDatasource struct {
|
|||
func NewSyncServerDatasource(dbDataSourceName string) (*SyncServerDatasource, error) {
|
||||
var d SyncServerDatasource
|
||||
var err error
|
||||
if d.db, err = sql.Open("postgres", dbDataSourceName); err != nil {
|
||||
if d.db, err = sqlutil.Open("postgres", dbDataSourceName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = d.PartitionOffsetStatements.Prepare(d.db, "syncapi"); err != nil {
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
||||
// Import the sqlite3 package
|
||||
|
@ -78,7 +79,7 @@ func NewSyncServerDatasource(dataSourceName string) (*SyncServerDatasource, erro
|
|||
} 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
|
||||
}
|
||||
if err = d.prepare(); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue