diff options
author | Charlie Vieth <charlie.vieth@gmail.com> | 2023-02-11 17:14:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-11 17:14:42 -0500 |
commit | 7ce62b2ade0b712c46b1ecc6a0ee179dc417816c (patch) | |
tree | fd245337c8854f0f096f36e6cdf7f6b573340fb2 /sqlite3_go18.go | |
parent | Add Serialize and Deserialize support (#1089) (diff) | |
download | golite-7ce62b2ade0b712c46b1ecc6a0ee179dc417816c.tar.gz golite-7ce62b2ade0b712c46b1ecc6a0ee179dc417816c.tar.xz |
Replace namedValue with driver.NamedValue to avoid copying exec/query args (#1128)
Diffstat (limited to 'sqlite3_go18.go')
-rw-r--r-- | sqlite3_go18.go | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/sqlite3_go18.go b/sqlite3_go18.go index bd97cb8..514fd7e 100644 --- a/sqlite3_go18.go +++ b/sqlite3_go18.go @@ -25,20 +25,12 @@ func (c *SQLiteConn) Ping(ctx context.Context) error { // QueryContext implement QueryerContext. func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { - list := make([]namedValue, len(args)) - for i, nv := range args { - list[i] = namedValue(nv) - } - return c.query(ctx, query, list) + return c.query(ctx, query, args) } // ExecContext implement ExecerContext. func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) { - list := make([]namedValue, len(args)) - for i, nv := range args { - list[i] = namedValue(nv) - } - return c.exec(ctx, query, list) + return c.exec(ctx, query, args) } // PrepareContext implement ConnPrepareContext. @@ -53,18 +45,10 @@ func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver // QueryContext implement QueryerContext. func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { - list := make([]namedValue, len(args)) - for i, nv := range args { - list[i] = namedValue(nv) - } - return s.query(ctx, list) + return s.query(ctx, args) } // ExecContext implement ExecerContext. func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) { - list := make([]namedValue, len(args)) - for i, nv := range args { - list[i] = namedValue(nv) - } - return s.exec(ctx, list) + return s.exec(ctx, args) } |