mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Move every db.Prepare
to sqlutil.Statementlist
, remove trace driver (#3026)
Doesn't buy us much, but makes everything a bit more consistent. Also removes the SQL trace driver, as it is unused and the output is hard to read anyway.
This commit is contained in:
parent
cb18ba0230
commit
234ed603e6
33 changed files with 127 additions and 451 deletions
|
@ -13,8 +13,7 @@ import (
|
|||
var skipSanityChecks = flag.Bool("skip-db-sanity", false, "Ignore sanity checks on the database connections (NOT RECOMMENDED!)")
|
||||
|
||||
// Open opens a database specified by its database driver name and a driver-specific data source name,
|
||||
// usually consisting of at least a database name and connection information. Includes tracing driver
|
||||
// if DENDRITE_TRACE_SQL=1
|
||||
// usually consisting of at least a database name and connection information.
|
||||
func Open(dbProperties *config.DatabaseOptions, writer Writer) (*sql.DB, error) {
|
||||
var err error
|
||||
var driverName, dsn string
|
||||
|
@ -32,10 +31,6 @@ func Open(dbProperties *config.DatabaseOptions, writer Writer) (*sql.DB, error)
|
|||
default:
|
||||
return nil, fmt.Errorf("invalid database connection string %q", dbProperties.ConnectionString)
|
||||
}
|
||||
if tracingEnabled {
|
||||
// install the wrapped driver
|
||||
driverName += "-trace"
|
||||
}
|
||||
db, err := sql.Open(driverName, dsn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue