Fork of github.com/mattn/go-sqlite3 v1.14.47, rebranded to package csqlite and vendored in-tree (SQLite amalgamation sqlite3-binding.c/.h + cgo driver + callback trampolines + optional-feature files) so the Hanzo stack depends on no external go-sqlite3 module. Registers the "sqlite3" database/sql driver name from this repo. SQLCipher at-rest encryption unchanged: link system libsqlcipher via -tags libsqlite3. Preserves upstream MIT license (LICENSE) with Hanzo-first NOTICE attribution. Verified: CGO_ENABLED=1 build+test (amalgamation) green; -tags libsqlite3 + libsqlcipher build+test green; CGO_ENABLED=0 build green; zero mattn in deps.
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
// Copyright (C) 2019 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
|
//
|
|
// Use of this source code is governed by an MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build cgo
|
|
// +build cgo
|
|
|
|
package csqlite
|
|
|
|
import (
|
|
"context"
|
|
"database/sql/driver"
|
|
)
|
|
|
|
// Ping implement Pinger.
|
|
func (c *SQLiteConn) Ping(ctx context.Context) error {
|
|
if c.db == nil {
|
|
// must be ErrBadConn for sql to close the database
|
|
return driver.ErrBadConn
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// QueryContext implement QueryerContext.
|
|
func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) {
|
|
return c.query(ctx, query, args)
|
|
}
|
|
|
|
// ExecContext implement ExecerContext.
|
|
func (c *SQLiteConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error) {
|
|
return c.exec(ctx, query, args)
|
|
}
|
|
|
|
// PrepareContext implement ConnPrepareContext.
|
|
func (c *SQLiteConn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error) {
|
|
return c.prepare(ctx, query)
|
|
}
|
|
|
|
// BeginTx implement ConnBeginTx.
|
|
func (c *SQLiteConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) {
|
|
return c.begin(ctx)
|
|
}
|
|
|
|
// QueryContext implement QueryerContext.
|
|
func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
|
|
return s.query(ctx, args)
|
|
}
|
|
|
|
// ExecContext implement ExecerContext.
|
|
func (s *SQLiteStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
|
|
return s.exec(ctx, args)
|
|
}
|