mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
mattn/go-sqlite3 v1.6.0 to v1.7.0
This commit is contained in:
parent
7d508df1b4
commit
c0830e9cde
6
Gopkg.lock
generated
6
Gopkg.lock
generated
@ -331,8 +331,8 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/mattn/go-sqlite3"
|
name = "github.com/mattn/go-sqlite3"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
revision = "6c771bb9887719704b210e87e934f08be014bdb1"
|
revision = "323a32be5a2421b8c7087225079c6c900ec397cd"
|
||||||
version = "v1.6.0"
|
version = "v1.7.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/matttproud/golang_protobuf_extensions"
|
name = "github.com/matttproud/golang_protobuf_extensions"
|
||||||
@ -670,6 +670,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "08b97771990365d506af4788acb33cdf283ce89856669262ecb84860ad45bfcb"
|
inputs-digest = "85cc057e0cc074ab5b43bd620772d63d51e07b04e8782fcfe55e6929d2fc40f7"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -129,7 +129,7 @@ ignored = [
|
|||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/mattn/go-sqlite3"
|
name = "github.com/mattn/go-sqlite3"
|
||||||
version = "1.6.0"
|
version = "1.7.0"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/opentracing/opentracing-go"
|
name = "github.com/opentracing/opentracing-go"
|
||||||
|
12299
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
generated
vendored
12299
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c
generated
vendored
File diff suppressed because it is too large
Load Diff
658
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h
generated
vendored
658
vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h
generated
vendored
File diff suppressed because it is too large
Load Diff
92
vendor/github.com/mattn/go-sqlite3/sqlite3.go
generated
vendored
92
vendor/github.com/mattn/go-sqlite3/sqlite3.go
generated
vendored
@ -1,3 +1,5 @@
|
|||||||
|
// +build cgo
|
||||||
|
|
||||||
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
||||||
//
|
//
|
||||||
// Use of this source code is governed by an MIT-style
|
// Use of this source code is governed by an MIT-style
|
||||||
@ -7,10 +9,13 @@ package sqlite3
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#cgo CFLAGS: -std=gnu99
|
#cgo CFLAGS: -std=gnu99
|
||||||
#cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE=1
|
#cgo CFLAGS: -DSQLITE_ENABLE_RTREE -DSQLITE_THREADSAFE=1 -DHAVE_USLEEP=1
|
||||||
|
#cgo linux,!android CFLAGS: -DHAVE_PREAD64=1 -DHAVE_PWRITE64=1
|
||||||
#cgo CFLAGS: -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4_UNICODE61
|
#cgo CFLAGS: -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4_UNICODE61
|
||||||
#cgo CFLAGS: -DSQLITE_TRACE_SIZE_LIMIT=15
|
#cgo CFLAGS: -DSQLITE_TRACE_SIZE_LIMIT=15
|
||||||
|
#cgo CFLAGS: -DSQLITE_OMIT_DEPRECATED
|
||||||
#cgo CFLAGS: -DSQLITE_DISABLE_INTRINSIC
|
#cgo CFLAGS: -DSQLITE_DISABLE_INTRINSIC
|
||||||
|
#cgo CFLAGS: -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT
|
||||||
#cgo CFLAGS: -Wno-deprecated-declarations
|
#cgo CFLAGS: -Wno-deprecated-declarations
|
||||||
#ifndef USE_LIBSQLITE3
|
#ifndef USE_LIBSQLITE3
|
||||||
#include <sqlite3-binding.h>
|
#include <sqlite3-binding.h>
|
||||||
@ -170,6 +175,12 @@ var SQLiteTimestampFormats = []string{
|
|||||||
"2006-01-02",
|
"2006-01-02",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
columnDate string = "date"
|
||||||
|
columnDatetime string = "datetime"
|
||||||
|
columnTimestamp string = "timestamp"
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
sql.Register("sqlite3", &SQLiteDriver{})
|
sql.Register("sqlite3", &SQLiteDriver{})
|
||||||
}
|
}
|
||||||
@ -389,7 +400,7 @@ func (c *SQLiteConn) RegisterCommitHook(callback func() int) {
|
|||||||
if callback == nil {
|
if callback == nil {
|
||||||
C.sqlite3_commit_hook(c.db, nil, nil)
|
C.sqlite3_commit_hook(c.db, nil, nil)
|
||||||
} else {
|
} else {
|
||||||
C.sqlite3_commit_hook(c.db, (*[0]byte)(unsafe.Pointer(C.commitHookTrampoline)), unsafe.Pointer(newHandle(c, callback)))
|
C.sqlite3_commit_hook(c.db, (*[0]byte)(C.commitHookTrampoline), unsafe.Pointer(newHandle(c, callback)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +413,7 @@ func (c *SQLiteConn) RegisterRollbackHook(callback func()) {
|
|||||||
if callback == nil {
|
if callback == nil {
|
||||||
C.sqlite3_rollback_hook(c.db, nil, nil)
|
C.sqlite3_rollback_hook(c.db, nil, nil)
|
||||||
} else {
|
} else {
|
||||||
C.sqlite3_rollback_hook(c.db, (*[0]byte)(unsafe.Pointer(C.rollbackHookTrampoline)), unsafe.Pointer(newHandle(c, callback)))
|
C.sqlite3_rollback_hook(c.db, (*[0]byte)(C.rollbackHookTrampoline), unsafe.Pointer(newHandle(c, callback)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +430,7 @@ func (c *SQLiteConn) RegisterUpdateHook(callback func(int, string, string, int64
|
|||||||
if callback == nil {
|
if callback == nil {
|
||||||
C.sqlite3_update_hook(c.db, nil, nil)
|
C.sqlite3_update_hook(c.db, nil, nil)
|
||||||
} else {
|
} else {
|
||||||
C.sqlite3_update_hook(c.db, (*[0]byte)(unsafe.Pointer(C.updateHookTrampoline)), unsafe.Pointer(newHandle(c, callback)))
|
C.sqlite3_update_hook(c.db, (*[0]byte)(C.updateHookTrampoline), unsafe.Pointer(newHandle(c, callback)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +512,7 @@ func (c *SQLiteConn) RegisterFunc(name string, impl interface{}, pure bool) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sqlite3CreateFunction(db *C.sqlite3, zFunctionName *C.char, nArg C.int, eTextRep C.int, pApp uintptr, xFunc unsafe.Pointer, xStep unsafe.Pointer, xFinal unsafe.Pointer) C.int {
|
func sqlite3CreateFunction(db *C.sqlite3, zFunctionName *C.char, nArg C.int, eTextRep C.int, pApp uintptr, xFunc unsafe.Pointer, xStep unsafe.Pointer, xFinal unsafe.Pointer) C.int {
|
||||||
return C._sqlite3_create_function(db, zFunctionName, nArg, eTextRep, C.uintptr_t(pApp), (*[0]byte)(unsafe.Pointer(xFunc)), (*[0]byte)(unsafe.Pointer(xStep)), (*[0]byte)(unsafe.Pointer(xFinal)))
|
return C._sqlite3_create_function(db, zFunctionName, nArg, eTextRep, C.uintptr_t(pApp), (*[0]byte)(xFunc), (*[0]byte)(xStep), (*[0]byte)(xFinal))
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterAggregator makes a Go type available as a SQLite aggregation function.
|
// RegisterAggregator makes a Go type available as a SQLite aggregation function.
|
||||||
@ -780,6 +791,8 @@ func errorString(err Error) string {
|
|||||||
// Enable or disable enforcement of foreign keys. X can be 1 or 0.
|
// Enable or disable enforcement of foreign keys. X can be 1 or 0.
|
||||||
// _recursive_triggers=X
|
// _recursive_triggers=X
|
||||||
// Enable or disable recursive triggers. X can be 1 or 0.
|
// Enable or disable recursive triggers. X can be 1 or 0.
|
||||||
|
// _mutex=XXX
|
||||||
|
// Specify mutex mode. XXX can be "no", "full".
|
||||||
func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
||||||
if C.sqlite3_threadsafe() == 0 {
|
if C.sqlite3_threadsafe() == 0 {
|
||||||
return nil, errors.New("sqlite library was not compiled for thread-safe operation")
|
return nil, errors.New("sqlite library was not compiled for thread-safe operation")
|
||||||
@ -790,6 +803,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||||||
busyTimeout := 5000
|
busyTimeout := 5000
|
||||||
foreignKeys := -1
|
foreignKeys := -1
|
||||||
recursiveTriggers := -1
|
recursiveTriggers := -1
|
||||||
|
mutex := C.int(C.SQLITE_OPEN_FULLMUTEX)
|
||||||
pos := strings.IndexRune(dsn, '?')
|
pos := strings.IndexRune(dsn, '?')
|
||||||
if pos >= 1 {
|
if pos >= 1 {
|
||||||
params, err := url.ParseQuery(dsn[pos+1:])
|
params, err := url.ParseQuery(dsn[pos+1:])
|
||||||
@ -856,6 +870,18 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _mutex
|
||||||
|
if val := params.Get("_mutex"); val != "" {
|
||||||
|
switch val {
|
||||||
|
case "no":
|
||||||
|
mutex = C.SQLITE_OPEN_NOMUTEX
|
||||||
|
case "full":
|
||||||
|
mutex = C.SQLITE_OPEN_FULLMUTEX
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("Invalid _mutex: %v", val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !strings.HasPrefix(dsn, "file:") {
|
if !strings.HasPrefix(dsn, "file:") {
|
||||||
dsn = dsn[:pos]
|
dsn = dsn[:pos]
|
||||||
}
|
}
|
||||||
@ -865,9 +891,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
|||||||
name := C.CString(dsn)
|
name := C.CString(dsn)
|
||||||
defer C.free(unsafe.Pointer(name))
|
defer C.free(unsafe.Pointer(name))
|
||||||
rv := C._sqlite3_open_v2(name, &db,
|
rv := C._sqlite3_open_v2(name, &db,
|
||||||
C.SQLITE_OPEN_FULLMUTEX|
|
mutex|C.SQLITE_OPEN_READWRITE|C.SQLITE_OPEN_CREATE,
|
||||||
C.SQLITE_OPEN_READWRITE|
|
|
||||||
C.SQLITE_OPEN_CREATE,
|
|
||||||
nil)
|
nil)
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
return nil, Error{Code: ErrNo(rv)}
|
return nil, Error{Code: ErrNo(rv)}
|
||||||
@ -1070,7 +1094,7 @@ func (s *SQLiteStmt) bind(args []namedValue) error {
|
|||||||
case int64:
|
case int64:
|
||||||
rv = C.sqlite3_bind_int64(s.s, n, C.sqlite3_int64(v))
|
rv = C.sqlite3_bind_int64(s.s, n, C.sqlite3_int64(v))
|
||||||
case bool:
|
case bool:
|
||||||
if bool(v) {
|
if v {
|
||||||
rv = C.sqlite3_bind_int(s.s, n, 1)
|
rv = C.sqlite3_bind_int(s.s, n, 1)
|
||||||
} else {
|
} else {
|
||||||
rv = C.sqlite3_bind_int(s.s, n, 0)
|
rv = C.sqlite3_bind_int(s.s, n, 0)
|
||||||
@ -1121,18 +1145,20 @@ func (s *SQLiteStmt) query(ctx context.Context, args []namedValue) (driver.Rows,
|
|||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
go func(db *C.sqlite3) {
|
if ctxdone := ctx.Done(); ctxdone != nil {
|
||||||
select {
|
go func(db *C.sqlite3) {
|
||||||
case <-ctx.Done():
|
|
||||||
select {
|
select {
|
||||||
|
case <-ctxdone:
|
||||||
|
select {
|
||||||
|
case <-rows.done:
|
||||||
|
default:
|
||||||
|
C.sqlite3_interrupt(db)
|
||||||
|
rows.Close()
|
||||||
|
}
|
||||||
case <-rows.done:
|
case <-rows.done:
|
||||||
default:
|
|
||||||
C.sqlite3_interrupt(db)
|
|
||||||
rows.Close()
|
|
||||||
}
|
}
|
||||||
case <-rows.done:
|
}(s.c.db)
|
||||||
}
|
}
|
||||||
}(s.c.db)
|
|
||||||
|
|
||||||
return rows, nil
|
return rows, nil
|
||||||
}
|
}
|
||||||
@ -1166,19 +1192,21 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
done := make(chan struct{})
|
if ctxdone := ctx.Done(); ctxdone != nil {
|
||||||
defer close(done)
|
done := make(chan struct{})
|
||||||
go func(db *C.sqlite3) {
|
defer close(done)
|
||||||
select {
|
go func(db *C.sqlite3) {
|
||||||
case <-done:
|
|
||||||
case <-ctx.Done():
|
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
default:
|
case <-ctxdone:
|
||||||
C.sqlite3_interrupt(db)
|
select {
|
||||||
|
case <-done:
|
||||||
|
default:
|
||||||
|
C.sqlite3_interrupt(db)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}(s.c.db)
|
||||||
}(s.c.db)
|
}
|
||||||
|
|
||||||
var rowid, changes C.longlong
|
var rowid, changes C.longlong
|
||||||
rv := C._sqlite3_step(s.s, &rowid, &changes)
|
rv := C._sqlite3_step(s.s, &rowid, &changes)
|
||||||
@ -1272,7 +1300,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||||||
case C.SQLITE_INTEGER:
|
case C.SQLITE_INTEGER:
|
||||||
val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i)))
|
val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i)))
|
||||||
switch rc.decltype[i] {
|
switch rc.decltype[i] {
|
||||||
case "timestamp", "datetime", "date":
|
case columnTimestamp, columnDatetime, columnDate:
|
||||||
var t time.Time
|
var t time.Time
|
||||||
// Assume a millisecond unix timestamp if it's 13 digits -- too
|
// Assume a millisecond unix timestamp if it's 13 digits -- too
|
||||||
// large to be a reasonable timestamp in seconds.
|
// large to be a reasonable timestamp in seconds.
|
||||||
@ -1303,10 +1331,10 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||||||
n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
|
n := int(C.sqlite3_column_bytes(rc.s.s, C.int(i)))
|
||||||
switch dest[i].(type) {
|
switch dest[i].(type) {
|
||||||
case sql.RawBytes:
|
case sql.RawBytes:
|
||||||
dest[i] = (*[1 << 30]byte)(unsafe.Pointer(p))[0:n]
|
dest[i] = (*[1 << 30]byte)(p)[0:n]
|
||||||
default:
|
default:
|
||||||
slice := make([]byte, n)
|
slice := make([]byte, n)
|
||||||
copy(slice[:], (*[1 << 30]byte)(unsafe.Pointer(p))[0:n])
|
copy(slice[:], (*[1 << 30]byte)(p)[0:n])
|
||||||
dest[i] = slice
|
dest[i] = slice
|
||||||
}
|
}
|
||||||
case C.SQLITE_NULL:
|
case C.SQLITE_NULL:
|
||||||
@ -1319,7 +1347,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
|||||||
s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n))
|
s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n))
|
||||||
|
|
||||||
switch rc.decltype[i] {
|
switch rc.decltype[i] {
|
||||||
case "timestamp", "datetime", "date":
|
case columnTimestamp, columnDatetime, columnDate:
|
||||||
var t time.Time
|
var t time.Time
|
||||||
s = strings.TrimSuffix(s, "Z")
|
s = strings.TrimSuffix(s, "Z")
|
||||||
for _, format := range SQLiteTimestampFormats {
|
for _, format := range SQLiteTimestampFormats {
|
||||||
|
2
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go
generated
vendored
2
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go
generated
vendored
@ -1,3 +1,5 @@
|
|||||||
|
// +build cgo
|
||||||
|
|
||||||
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
||||||
//
|
//
|
||||||
// Use of this source code is governed by an MIT-style
|
// Use of this source code is governed by an MIT-style
|
||||||
|
12
vendor/github.com/mattn/go-sqlite3/sqlite3_solaris.go
generated
vendored
Normal file
12
vendor/github.com/mattn/go-sqlite3/sqlite3_solaris.go
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (C) 2018 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.
|
||||||
|
// +build solaris
|
||||||
|
|
||||||
|
package sqlite3
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo CFLAGS: -D__EXTENSIONS__=1
|
||||||
|
*/
|
||||||
|
import "C"
|
22
vendor/github.com/mattn/go-sqlite3/sqlite3_trace.go
generated
vendored
22
vendor/github.com/mattn/go-sqlite3/sqlite3_trace.go
generated
vendored
@ -28,10 +28,10 @@ import (
|
|||||||
// Trace... constants identify the possible events causing callback invocation.
|
// Trace... constants identify the possible events causing callback invocation.
|
||||||
// Values are same as the corresponding SQLite Trace Event Codes.
|
// Values are same as the corresponding SQLite Trace Event Codes.
|
||||||
const (
|
const (
|
||||||
TraceStmt = C.SQLITE_TRACE_STMT
|
TraceStmt = uint32(C.SQLITE_TRACE_STMT)
|
||||||
TraceProfile = C.SQLITE_TRACE_PROFILE
|
TraceProfile = uint32(C.SQLITE_TRACE_PROFILE)
|
||||||
TraceRow = C.SQLITE_TRACE_ROW
|
TraceRow = uint32(C.SQLITE_TRACE_ROW)
|
||||||
TraceClose = C.SQLITE_TRACE_CLOSE
|
TraceClose = uint32(C.SQLITE_TRACE_CLOSE)
|
||||||
)
|
)
|
||||||
|
|
||||||
type TraceInfo struct {
|
type TraceInfo struct {
|
||||||
@ -71,7 +71,7 @@ type TraceUserCallback func(TraceInfo) int
|
|||||||
|
|
||||||
type TraceConfig struct {
|
type TraceConfig struct {
|
||||||
Callback TraceUserCallback
|
Callback TraceUserCallback
|
||||||
EventMask C.uint
|
EventMask uint32
|
||||||
WantExpandedSQL bool
|
WantExpandedSQL bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +105,8 @@ func traceCallbackTrampoline(
|
|||||||
// Parameter named 'X' in SQLite docs (eXtra event data?):
|
// Parameter named 'X' in SQLite docs (eXtra event data?):
|
||||||
xValue unsafe.Pointer) C.int {
|
xValue unsafe.Pointer) C.int {
|
||||||
|
|
||||||
|
eventCode := uint32(traceEventCode)
|
||||||
|
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
panic(fmt.Sprintf("No context (ev 0x%x)", traceEventCode))
|
panic(fmt.Sprintf("No context (ev 0x%x)", traceEventCode))
|
||||||
}
|
}
|
||||||
@ -114,7 +116,7 @@ func traceCallbackTrampoline(
|
|||||||
|
|
||||||
var traceConf TraceConfig
|
var traceConf TraceConfig
|
||||||
var found bool
|
var found bool
|
||||||
if traceEventCode == TraceClose {
|
if eventCode == TraceClose {
|
||||||
// clean up traceMap: 'pop' means get and delete
|
// clean up traceMap: 'pop' means get and delete
|
||||||
traceConf, found = popTraceMapping(connHandle)
|
traceConf, found = popTraceMapping(connHandle)
|
||||||
} else {
|
} else {
|
||||||
@ -123,16 +125,16 @@ func traceCallbackTrampoline(
|
|||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
panic(fmt.Sprintf("Mapping not found for handle 0x%x (ev 0x%x)",
|
panic(fmt.Sprintf("Mapping not found for handle 0x%x (ev 0x%x)",
|
||||||
connHandle, traceEventCode))
|
connHandle, eventCode))
|
||||||
}
|
}
|
||||||
|
|
||||||
var info TraceInfo
|
var info TraceInfo
|
||||||
|
|
||||||
info.EventCode = uint32(traceEventCode)
|
info.EventCode = eventCode
|
||||||
info.AutoCommit = (int(C.sqlite3_get_autocommit(contextDB)) != 0)
|
info.AutoCommit = (int(C.sqlite3_get_autocommit(contextDB)) != 0)
|
||||||
info.ConnHandle = connHandle
|
info.ConnHandle = connHandle
|
||||||
|
|
||||||
switch traceEventCode {
|
switch eventCode {
|
||||||
case TraceStmt:
|
case TraceStmt:
|
||||||
info.StmtHandle = uintptr(p)
|
info.StmtHandle = uintptr(p)
|
||||||
|
|
||||||
@ -183,7 +185,7 @@ func traceCallbackTrampoline(
|
|||||||
// registering this callback trampoline with SQLite --- for cleanup.
|
// registering this callback trampoline with SQLite --- for cleanup.
|
||||||
// In the future there may be more events forced to "selected" in SQLite
|
// In the future there may be more events forced to "selected" in SQLite
|
||||||
// for the driver's needs.
|
// for the driver's needs.
|
||||||
if traceConf.EventMask&traceEventCode == 0 {
|
if traceConf.EventMask&eventCode == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
vendor/github.com/mattn/go-sqlite3/sqlite3ext.h
generated
vendored
7
vendor/github.com/mattn/go-sqlite3/sqlite3ext.h
generated
vendored
@ -293,6 +293,9 @@ struct sqlite3_api_routines {
|
|||||||
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
|
int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
|
||||||
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
|
void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
|
||||||
void *(*value_pointer)(sqlite3_value*,const char*);
|
void *(*value_pointer)(sqlite3_value*,const char*);
|
||||||
|
int (*vtab_nochange)(sqlite3_context*);
|
||||||
|
int (*value_nochange)(sqlite3_value*);
|
||||||
|
const char *(*vtab_collation)(sqlite3_index_info*,int);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -559,6 +562,10 @@ typedef int (*sqlite3_loadext_entry)(
|
|||||||
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
|
#define sqlite3_bind_pointer sqlite3_api->bind_pointer
|
||||||
#define sqlite3_result_pointer sqlite3_api->result_pointer
|
#define sqlite3_result_pointer sqlite3_api->result_pointer
|
||||||
#define sqlite3_value_pointer sqlite3_api->value_pointer
|
#define sqlite3_value_pointer sqlite3_api->value_pointer
|
||||||
|
/* Version 3.22.0 and later */
|
||||||
|
#define sqlite3_vtab_nochange sqlite3_api->vtab_nochange
|
||||||
|
#define sqlite3_value_nochange sqlite3_api->value_nochange
|
||||||
|
#define sqlite3_vtab_collation sqlite3_api->vtab_collation
|
||||||
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
|
||||||
|
|
||||||
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
|
||||||
|
21
vendor/github.com/mattn/go-sqlite3/static_mock.go
generated
vendored
Normal file
21
vendor/github.com/mattn/go-sqlite3/static_mock.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// +build !cgo
|
||||||
|
|
||||||
|
package sqlite3
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"database/sql/driver"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
sql.Register("sqlite3", &SQLiteDriverMock{})
|
||||||
|
}
|
||||||
|
|
||||||
|
type SQLiteDriverMock struct{}
|
||||||
|
|
||||||
|
var errorMsg = errors.New("Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub")
|
||||||
|
|
||||||
|
func (SQLiteDriverMock) Open(s string) (driver.Conn, error) {
|
||||||
|
return nil, errorMsg
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user