aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--sqlite3.go2
-rw-r--r--sqlite3_go18.go2
-rw-r--r--sqlite3_solaris.go12
-rw-r--r--static_mock.go21
5 files changed, 38 insertions, 1 deletions
diff --git a/README.md b/README.md
index ad00f10..bddbf8b 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ This package can be installed with the go get command:
_go-sqlite3_ is *cgo* package.
If you want to build your app using go-sqlite3, you need gcc.
-However, if you install _go-sqlite3_ with `go install github.com/mattn/go-sqlite3`, you don't need gcc to build your app anymore.
+However, after you have built and installed _go-sqlite3_ with `go install github.com/mattn/go-sqlite3` (which requires gcc), you can build your app without relying on gcc in future.
Documentation
-------------
diff --git a/sqlite3.go b/sqlite3.go
index fb9a7cf..7569b73 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -1,3 +1,5 @@
+// +build cgo
+
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
//
// Use of this source code is governed by an MIT-style
diff --git a/sqlite3_go18.go b/sqlite3_go18.go
index f9e08e1..dd0f5a7 100644
--- a/sqlite3_go18.go
+++ b/sqlite3_go18.go
@@ -1,3 +1,5 @@
+// +build cgo
+
// Copyright (C) 2014 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
//
// Use of this source code is governed by an MIT-style
diff --git a/sqlite3_solaris.go b/sqlite3_solaris.go
new file mode 100644
index 0000000..dbbdf75
--- /dev/null
+++ b/sqlite3_solaris.go
@@ -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"
diff --git a/static_mock.go b/static_mock.go
new file mode 100644
index 0000000..48629d1
--- /dev/null
+++ b/static_mock.go
@@ -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
+}