podman
54 строки · 1.5 Кб
1// Copyright (C) 2019 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
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 && go1.8
7// +build cgo,go1.8
8
9package sqlite310
11import (12"database/sql/driver"13
14"context"15)
16
17// Ping implement Pinger.
18func (c *SQLiteConn) Ping(ctx context.Context) error {19if c.db == nil {20// must be ErrBadConn for sql to close the database21return driver.ErrBadConn22}23return nil24}
25
26// QueryContext implement QueryerContext.
27func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {28return c.query(ctx, query, args)29}
30
31// ExecContext implement ExecerContext.
32func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {33return c.exec(ctx, query, args)34}
35
36// PrepareContext implement ConnPrepareContext.
37func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {38return c.prepare(ctx, query)39}
40
41// BeginTx implement ConnBeginTx.
42func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {43return c.begin(ctx)44}
45
46// QueryContext implement QueryerContext.
47func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {48return s.query(ctx, args)49}
50
51// ExecContext implement ExecerContext.
52func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {53return s.exec(ctx, args)54}
55