gitlab.com/CoiaPrant/sqlite3@v1.19.1/sqlite_go18.go (about)

     1  // Copyright 2017 The Sqlite Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build go1.8
     6  // +build go1.8
     7  
     8  package sqlite // import "gitlab.com/CoiaPrant/sqlite3"
     9  
    10  import (
    11  	"context"
    12  	"database/sql/driver"
    13  )
    14  
    15  // Ping implements driver.Pinger
    16  func (c *conn) Ping(ctx context.Context) error {
    17  	_, err := c.ExecContext(ctx, "select 1", nil)
    18  	return err
    19  }
    20  
    21  // BeginTx implements driver.ConnBeginTx
    22  func (c *conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
    23  	return c.begin(ctx, opts)
    24  }
    25  
    26  // PrepareContext implements driver.ConnPrepareContext
    27  func (c *conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
    28  	return c.prepare(ctx, query)
    29  }
    30  
    31  // ExecContext implements driver.ExecerContext
    32  func (c *conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
    33  	return c.exec(ctx, query, args)
    34  }
    35  
    36  // QueryContext implements driver.QueryerContext
    37  func (c *conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
    38  	return c.query(ctx, query, args)
    39  }
    40  
    41  // ExecContext implements driver.StmtExecContext
    42  func (s *stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
    43  	return s.exec(ctx, args)
    44  }
    45  
    46  // QueryContext implements driver.StmtQueryContext
    47  func (s *stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
    48  	return s.query(ctx, args)
    49  }