diff --git a/db_go18.go b/context.go similarity index 99% rename from db_go18.go rename to context.go index 72cb390..e24f103 100644 --- a/db_go18.go +++ b/context.go @@ -1,5 +1,3 @@ -//go:build go1.8 - package txdb import ( diff --git a/db.go b/db.go index bd08198..e561b97 100644 --- a/db.go +++ b/db.go @@ -367,6 +367,20 @@ func (c *conn) Query(query string, args []driver.Value) (driver.Rows, error) { return buildRows(rs) } +// Implement the NamedValueChecker interface +func (c *conn) CheckNamedValue(nv *driver.NamedValue) error { + if nvc, ok := c.drv.realConn.(driver.NamedValueChecker); ok { + return nvc.CheckNamedValue(nv) + } + + switch nv.Value.(type) { + case sql.Out: + return nil + default: + return driver.ErrSkip + } +} + type stmt struct { mu sync.Mutex st *sql.Stmt diff --git a/db_before_go18.go b/db_before_go18.go deleted file mode 100644 index 291e240..0000000 --- a/db_before_go18.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build !go1.8 - -package txdb - -import ( - "database/sql" - "database/sql/driver" -) - -func buildRows(r *sql.Rows) (driver.Rows, error) { - rows := &rows{} - err := rows.read(r) - return rows, err -} diff --git a/db_go19.go b/db_go19.go deleted file mode 100644 index 3c2f529..0000000 --- a/db_go19.go +++ /dev/null @@ -1,22 +0,0 @@ -// +build go1.9 - -package txdb - -import ( - "database/sql" - "database/sql/driver" -) - -// Implement the NamedValueChecker interface -func (c *conn) CheckNamedValue(nv *driver.NamedValue) error { - if nvc, ok := c.drv.realConn.(driver.NamedValueChecker); ok { - return nvc.CheckNamedValue(nv) - } - - switch nv.Value.(type) { - case sql.Out: - return nil - default: - return driver.ErrSkip - } -}