gemini-search

A simple search engine for Geminispace
git clone git://git.laack.co/gemini-search.git
Log | Files | Refs | README

sqlite3_sql.go (1531B)


      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
      7 // +build cgo
      8 
      9 package sqlite3
     10 
     11 import (
     12 	"context"
     13 	"database/sql/driver"
     14 )
     15 
     16 // Ping implement Pinger.
     17 func (c *SQLiteConn) Ping(ctx context.Context) error {
     18 	if c.db == nil {
     19 		// must be ErrBadConn for sql to close the database
     20 		return driver.ErrBadConn
     21 	}
     22 	return nil
     23 }
     24 
     25 // QueryContext implement QueryerContext.
     26 func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
     27 	return c.query(ctx, query, args)
     28 }
     29 
     30 // ExecContext implement ExecerContext.
     31 func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
     32 	return c.exec(ctx, query, args)
     33 }
     34 
     35 // PrepareContext implement ConnPrepareContext.
     36 func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
     37 	return c.prepare(ctx, query)
     38 }
     39 
     40 // BeginTx implement ConnBeginTx.
     41 func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
     42 	return c.begin(ctx)
     43 }
     44 
     45 // QueryContext implement QueryerContext.
     46 func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
     47 	return s.query(ctx, args)
     48 }
     49 
     50 // ExecContext implement ExecerContext.
     51 func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
     52 	return s.exec(ctx, args)
     53 }