Skip to content

Commit 4b4fe5b

Browse files
committed
Updated
1 parent 67be4f6 commit 4b4fe5b

23 files changed

+174
-128
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,11 @@ test:
6363
@echo Test pkg/sqobj
6464
@${GO} test ./pkg/sqobj
6565

66-
dependencies: sqlite3 mkdir
66+
dependencies: mkdir
6767
ifeq (,${GO})
6868
$(error "Missing go binary")
6969
endif
7070

71-
sqlite3:
72-
@$(MAKE) -C ${SQLITE_DIR}
73-
7471
mkdir:
7572
@install -d ${BUILD_DIR}
7673

@@ -79,5 +76,4 @@ clean:
7976
@rm -fr $(BUILD_DIR)
8077
@${GO} mod tidy
8178
@${GO} clean
82-
@$(MAKE) -C ${SQLITE_DIR} clean
8379

c/Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

c/shell.c renamed to c/shell.c_old

File renamed without changes.

c/sqlite3.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package c
2+
3+
/*
4+
#cgo CFLAGS: -DSQLITE_THREADSAFE=2
5+
#cgo CFLAGS: -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1
6+
#cgo CFLAGS: -DSQLITE_ENABLE_UNLOCK_NOTIFY
7+
#cgo CFLAGS: -DSQLITE_ENABLE_FTS3
8+
#cgo CFLAGS: -DSQLITE_ENABLE_FTS5
9+
#cgo CFLAGS: -DSQLITE_ENABLE_RTREE
10+
#cgo CFLAGS: -DSQLITE_ENABLE_DBSTAT_VTAB
11+
#cgo CFLAGS: -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
12+
#cgo CFLAGS: -DSQLITE_OMIT_DEPRECATED
13+
#cgo CFLAGS: -DSQLITE_ENABLE_JSON1
14+
#cgo CFLAGS: -DSQLITE_ENABLE_SESSION
15+
#cgo CFLAGS: -DSQLITE_ENABLE_SNAPSHOT
16+
#cgo CFLAGS: -DSQLITE_ENABLE_PREUPDATE_HOOK
17+
#cgo CFLAGS: -DSQLITE_ENABLE_GEOPOLY
18+
#cgo CFLAGS: -DSQLITE_USE_ALLOCA
19+
#cgo CFLAGS: -DSQLITE_ENABLE_COLUMN_METADATA
20+
#cgo CFLAGS: -DHAVE_USLEEP=1
21+
#cgo CFLAGS: -DSQLITE_DQS=0
22+
// Ref: https://github.com/crawshaw/sqlite/blob/master/sqlite.go
23+
#cgo windows LDFLAGS: -Wl,-Bstatic -lwinpthread -Wl,-Bdynamic
24+
#cgo linux LDFLAGS: -ldl -lm
25+
#cgo linux CFLAGS: -std=c99
26+
#cgo openbsd LDFLAGS: -lm
27+
#cgo openbsd CFLAGS: -std=c99
28+
#cgo freebsd LDFLAGS: -lm
29+
#cgo freebsd CFLAGS: -std=c99
30+
*/
31+
import "C"

pkg/config/version.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import (
44
"fmt"
55
"io"
66
"runtime"
7+
8+
// Packages
9+
sqlite3 "github.com/mutablelogic/go-sqlite/sys/sqlite3/"
710
)
811

912
///////////////////////////////////////////////////////////////////////////////
@@ -27,5 +30,6 @@ func PrintVersion(w io.Writer) {
2730
if GoBuildTime != "" {
2831
fmt.Fprintf(w, " Build Time: %v\n", GoBuildTime)
2932
}
30-
fmt.Fprintf(w, " Go: %v (%v/%v)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
33+
fmt.Fprintf(w, " go: %v (%v/%v)\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
34+
fmt.Fprintf(w, " sqlite3: %v\n", sqlite3.Version())
3135
}

sys/sqlite3/auth.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package sqlite3
22

3+
///////////////////////////////////////////////////////////////////////////////
4+
// CGO
5+
36
/*
47
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
68
#include <sqlite3.h>
79
#include <stdlib.h>
810
*/

sys/sqlite3/backup.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
package sqlite3
22

3+
import (
4+
"fmt"
5+
"unsafe"
6+
)
7+
8+
///////////////////////////////////////////////////////////////////////////////
9+
// CGO
10+
311
/*
412
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
613
#include <sqlite3.h>
714
#include <stdlib.h>
815
*/
916
import "C"
10-
import (
11-
"fmt"
12-
"unsafe"
13-
)
1417

1518
///////////////////////////////////////////////////////////////////////////////
1619
// TYPES

sys/sqlite3/bind.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package sqlite3
22

3+
import (
4+
"math"
5+
"time"
6+
"unsafe"
7+
)
8+
9+
///////////////////////////////////////////////////////////////////////////////
10+
// CGO
11+
312
/*
413
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
614
#include <sqlite3.h>
715
#include <stdlib.h>
816
@@ -20,11 +28,8 @@ static inline int _sqlite3_bind_pointer(sqlite3_stmt* stmt, int index, void* p,c
2028
*/
2129
import "C"
2230

23-
import (
24-
"math"
25-
"time"
26-
"unsafe"
27-
)
31+
///////////////////////////////////////////////////////////////////////////////
32+
// GLOBALS
2833

2934
const (
3035
// sqliteNamedPrefix removes these prefixes from the named parameter

sys/sqlite3/blob.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
package sqlite3
22

3+
import (
4+
"fmt"
5+
"unsafe"
6+
)
7+
8+
///////////////////////////////////////////////////////////////////////////////
9+
// CGO
10+
311
/*
412
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
613
#include <sqlite3.h>
714
#include <stdlib.h>
815
*/
916
import "C"
10-
import (
11-
"fmt"
12-
"unsafe"
13-
)
1417

1518
///////////////////////////////////////////////////////////////////////////////
1619
// TYPES

sys/sqlite3/blobex.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
package sqlite3
22

3+
import (
4+
"fmt"
5+
"io"
6+
)
7+
8+
///////////////////////////////////////////////////////////////////////////////
9+
// CGO
10+
311
/*
412
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
613
#include <sqlite3.h>
714
#include <stdlib.h>
815
*/
916
import "C"
1017

11-
import (
12-
"fmt"
13-
"io"
14-
)
15-
1618
///////////////////////////////////////////////////////////////////////////////
1719
// TYPES
1820

sys/sqlite3/column.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
package sqlite3
22

3+
import (
4+
"fmt"
5+
"reflect"
6+
"unsafe"
7+
)
8+
9+
///////////////////////////////////////////////////////////////////////////////
10+
// CGO
11+
312
/*
413
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
614
#include <sqlite3.h>
715
#include <stdlib.h>
816
*/
917
import "C"
1018

11-
import (
12-
"fmt"
13-
"reflect"
14-
"unsafe"
15-
)
16-
1719
///////////////////////////////////////////////////////////////////////////////
1820
// METHODS
1921

sys/sqlite3/conn.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
package sqlite3
22

3+
import (
4+
"fmt"
5+
"strings"
6+
"unsafe"
7+
8+
// Modules
9+
multierror "github.com/hashicorp/go-multierror"
10+
11+
// Import into namespace
12+
. "github.com/djthorpe/go-errors"
13+
)
14+
15+
///////////////////////////////////////////////////////////////////////////////
16+
// CGO
17+
318
/*
419
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3 -lm -ldl -lz -lpthread
620
#include <sqlite3.h>
721
#include <stdlib.h>
822
*/
@@ -17,18 +31,6 @@ import "C"
1731
// -- }
1832
// -- }
1933

20-
import (
21-
"fmt"
22-
"strings"
23-
"unsafe"
24-
25-
// Modules
26-
multierror "github.com/hashicorp/go-multierror"
27-
28-
// Import into namespace
29-
. "github.com/djthorpe/go-errors"
30-
)
31-
3234
///////////////////////////////////////////////////////////////////////////////
3335
// TYPES
3436

sys/sqlite3/connex.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
package sqlite3
22

3+
import (
4+
"errors"
5+
"io"
6+
"reflect"
7+
"sync"
8+
"time"
9+
"unsafe"
10+
11+
// Modules
12+
"github.com/hashicorp/go-multierror"
13+
)
14+
15+
///////////////////////////////////////////////////////////////////////////////
16+
// CGO
17+
318
/*
419
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
620
#include <sqlite3.h>
721
#include <stdlib.h>
822
#include <stdint.h>
@@ -50,18 +64,6 @@ static inline int _sqlite3_trace_v2(sqlite3* db, unsigned mask, uintptr_t userIn
5064
*/
5165
import "C"
5266

53-
import (
54-
"errors"
55-
"io"
56-
"reflect"
57-
"sync"
58-
"time"
59-
"unsafe"
60-
61-
// Modules
62-
"github.com/hashicorp/go-multierror"
63-
)
64-
6567
///////////////////////////////////////////////////////////////////////////////
6668
// TYPES
6769

sys/sqlite3/context.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
package sqlite3
22

3+
import (
4+
"math"
5+
"reflect"
6+
"unsafe"
7+
)
8+
9+
///////////////////////////////////////////////////////////////////////////////
10+
// CGO
11+
312
/*
413
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
614
#include <sqlite3.h>
715
#include <stdlib.h>
816
@@ -22,11 +30,6 @@ void _sqlite3_result_blob64(sqlite3_context* ctx, void* data, sqlite3_uint64 len
2230
2331
*/
2432
import "C"
25-
import (
26-
"math"
27-
"reflect"
28-
"unsafe"
29-
)
3033

3134
///////////////////////////////////////////////////////////////////////////////
3235
// TYPES

sys/sqlite3/error.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package sqlite3
22

3+
import "fmt"
4+
5+
///////////////////////////////////////////////////////////////////////////////
6+
// CGO
7+
38
/*
49
#cgo CFLAGS: -I../../c
5-
#cgo LDFLAGS: -L../../c -lsqlite3
610
#include <sqlite3.h>
711
#include <stdlib.h>
812
*/
913
import "C"
10-
import "fmt"
1114

1215
///////////////////////////////////////////////////////////////////////////////
1316
// TYPES

0 commit comments

Comments
 (0)