Skip to content

Commit efb0ea6

Browse files
committed
Upgrade the latest version of go-sqlite3 and sqlcipher.
2 parents 7f9cd31 + ad30583 commit efb0ea6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+41900
-20844
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,13 @@
22
*.exe
33
*.dll
44
*.o
5+
6+
# VSCode
7+
.vscode
8+
9+
# Exclude from upgrade
10+
upgrade/*.c
11+
upgrade/*.h
12+
13+
# Exclude upgrade binary
14+
upgrade/upgrade

.travis.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ addons:
77
packages:
88
- libssl-dev
99

10-
env:
11-
- GOTAGS=
12-
- GOTAGS=trace
13-
- GOTAGS=vtable
1410
go:
15-
- 1.7.x
16-
- 1.8.x
1711
- 1.9.x
12+
- 1.10.x
13+
- 1.11.x
1814
- master
15+
1916
before_install:
17+
- |
18+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
19+
brew update
20+
fi
21+
- go get github.com/smartystreets/goconvey
2022
- go get github.com/mattn/goveralls
2123
- go get golang.org/x/tools/cmd/cover
24+
2225
script:
2326
- $HOME/gopath/bin/goveralls -repotoken PfqH9iFyzW3daUxflzllSougjTxvFwQZE
24-
- go test -race -v . -tags "$GOTAGS"
27+
- go test -race -v . -tags ""
28+
- go test -race -v . -tags "libsqlite3"
29+
- go test -race -v . -tags "sqlite_allow_uri_authority sqlite_app_armor sqlite_foreign_keys sqlite_fts5 sqlite_icu sqlite_introspect sqlite_json sqlite_secure_delete sqlite_see sqlite_stat4 sqlite_trace sqlite_userauth sqlite_vacuum_incr sqlite_vtable sqlite_unlock_notify"
30+
- go test -race -v . -tags "sqlite_vacuum_full"

README.md

+437-37
Large diffs are not rendered by default.

_example/encrypto/encrypto.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
)
1515

1616
func main() {
17-
db, err := sql.Open("sqlite3", "users.db")
17+
db, err := sql.Open("sqlite3", "users.db?key=123456")
1818
if err != nil {
1919
fmt.Println(err)
2020
}

callback.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ func updateHookTrampoline(handle uintptr, op int, db *C.char, table *C.char, row
7777
callback(op, C.GoString(db), C.GoString(table), rowid)
7878
}
7979

80+
//export authorizerTrampoline
81+
func authorizerTrampoline(handle uintptr, op int, arg1 *C.char, arg2 *C.char, arg3 *C.char) int {
82+
callback := lookupHandle(handle).(func(int, string, string, string) int)
83+
return callback(op, C.GoString(arg1), C.GoString(arg2), C.GoString(arg3))
84+
}
85+
8086
// Use handles to avoid passing Go pointers to C.
8187

8288
type handleVal struct {
@@ -331,8 +337,18 @@ func callbackRetText(ctx *C.sqlite3_context, v reflect.Value) error {
331337
return nil
332338
}
333339

340+
func callbackRetNil(ctx *C.sqlite3_context, v reflect.Value) error {
341+
return nil
342+
}
343+
334344
func callbackRet(typ reflect.Type) (callbackRetConverter, error) {
335345
switch typ.Kind() {
346+
case reflect.Interface:
347+
errorInterface := reflect.TypeOf((*error)(nil)).Elem()
348+
if typ.Implements(errorInterface) {
349+
return callbackRetNil, nil
350+
}
351+
fallthrough
336352
case reflect.Slice:
337353
if typ.Elem().Kind() != reflect.Uint8 {
338354
return nil, errors.New("the only supported slice type is []byte")
@@ -352,7 +368,7 @@ func callbackRet(typ reflect.Type) (callbackRetConverter, error) {
352368
func callbackError(ctx *C.sqlite3_context, err error) {
353369
cstr := C.CString(err.Error())
354370
defer C.free(unsafe.Pointer(cstr))
355-
C.sqlite3_result_error(ctx, cstr, -1)
371+
C.sqlite3_result_error(ctx, cstr, C.int(-1))
356372
}
357373

358374
// Test support code. Tests are not allowed to import "C", so we can't

0 commit comments

Comments
 (0)