Debian Codegraph @

sqlite3_sql.go

raw
1 // Copyright (C) 2019 Yasuhiro Matsumoto <[email protected]>.
2 //
3 // Use of this source code is governed by an MIT-style
4 // license that can be found in the LICENSE file.
5
6 //go:build cgo
7
8 package sqlite3
9
10 import (
11 "context"
12 "database/sql/driver"
13 )
14
15 // Ping implement Pinger.
16 func (c *SQLiteConn) Ping(ctx context.Context) error {
17 if c.db == nil {
18 // must be ErrBadConn for sql to close the database
19 return driver.ErrBadConn
20 }
21 return nil
22 }
23
24 // QueryContext implement QueryerContext.
25 func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
26 return c.query(ctx, query, args)
27 }
28
29 // ExecContext implement ExecerContext.
30 func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
31 return c.exec(ctx, query, args)
32 }
33
34 // PrepareContext implement ConnPrepareContext.
35 func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
36 return c.prepare(ctx, query)
37 }
38
39 // BeginTx implement ConnBeginTx.
40 func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
41 return c.begin(ctx)
42 }
43
44 // QueryContext implement QueryerContext.
45 func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
46 return s.query(ctx, args)
47 }
48
49 // ExecContext implement ExecerContext.
50 func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
51 return s.exec(ctx, args)
52 }