1 // Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
3 // Use of this source code is governed by an MIT-style
4 // license that can be found in the LICENSE file.
18 // Ping implement Pinger.
19 func (c *SQLiteConn) Ping(ctx context.Context) error {
21 return errors.New("Connection was closed")
26 // QueryContext implement QueryerContext.
27 func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
28 list := make([]namedValue, len(args))
29 for i, nv := range args {
30 list[i] = namedValue(nv)
32 return c.query(ctx, query, list)
35 // ExecContext implement ExecerContext.
36 func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
37 list := make([]namedValue, len(args))
38 for i, nv := range args {
39 list[i] = namedValue(nv)
41 return c.exec(ctx, query, list)
44 // PrepareContext implement ConnPrepareContext.
45 func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
46 return c.prepare(ctx, query)
49 // BeginTx implement ConnBeginTx.
50 func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
54 // QueryContext implement QueryerContext.
55 func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
56 list := make([]namedValue, len(args))
57 for i, nv := range args {
58 list[i] = namedValue(nv)
60 return s.query(ctx, list)
63 // ExecContext implement ExecerContext.
64 func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
65 list := make([]namedValue, len(args))
66 for i, nv := range args {
67 list[i] = namedValue(nv)
69 return s.exec(ctx, list)