support named params

This commit is contained in:
Yasuhiro Matsumoto
2016-11-04 15:00:29 +09:00
parent c95a77965c
commit b23526fb3c
3 changed files with 39 additions and 31 deletions

View File

@@ -23,6 +23,14 @@ func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driv
return c.query(ctx, query, list)
}
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)
}
func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
list := make([]namedValue, len(args))
for i, nv := range args {
@@ -30,3 +38,11 @@ func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue)
}
return s.query(ctx, list)
}
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)
}