Fork github.com/mattn/go-sqlite3 with adjustment for go1.16.2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

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