Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merging upstream mattn/go-sqlite3 into HEAD

  • Loading branch information...
commit 3c3e9fd2fc8fb2e9154a5c31695187bbd2b46548 2 parents 7eefaf9 + 5691b2a
Sven Engelhardt authored
Showing with 39 additions and 3 deletions.
  1. +16 −0 .travis.yml
  2. +11 −1 README.mkd
  3. +12 −2 sqlite3.go
View
16 .travis.yml
@@ -0,0 +1,16 @@
+language: erlang # wither art thou, Go?
+
+install:
+ - hg clone -r weekly https://code.google.com/p/go $HOME/go
+ - cd $HOME/go/src && ./make.bash
+ - mkdir -p $HOME/src || true
+ - mkdir -p $HOME/bin || true
+ - mkdir -p $HOME/pkg || true
+ - export GOPATH=$HOME
+ - export PATH=$PATH:$HOME/go/bin
+ - ln -s $HOME/builds/mattn/go-sqlite3 $HOME/src/go-sqlite3
+ - go get -v github.com/mattn/go-sqlite3
+
+script:
+ - cd $HOME/src/go-sqlite3 && go build -v .
+ - cd $HOME/src/go-sqlite3 && go test -v .
View
12 README.mkd
@@ -6,7 +6,17 @@ DESCRIPTION
sqlite3 driver for go that using database/sql
+INSTALLATION
+------------
+
+It require `pkg-config`. And need to be possible to get information with `pkg-config --cflags --libs sqlite3`.
+If you are using Windows, you can get pkg-config from below.
+
+http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
+
+Go does not support static linkage for external C library. So you should build sqlite3 with shared library. If it run on windows, it need dll.
+
LICENSE
-------
-MIT: http://mattn.mit-license.org/2011
+MIT: http://mattn.mit-license.org/2012
View
14 sqlite3.go
@@ -91,6 +91,12 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
if db == nil {
return nil, errors.New("sqlite succeeded without returning a database")
}
+
+ rv = C.sqlite3_busy_timeout(db, 500)
+ if rv != C.SQLITE_OK {
+ return nil, errors.New(C.GoString(C.sqlite3_errmsg(db)))
+ }
+
return &SQLiteConn{db}, nil
}
@@ -174,7 +180,7 @@ func (s *SQLiteStmt) bind(args []driver.Value) error {
rv = C.sqlite3_bind_int(s.s, n, C.int(v))
case bool:
if bool(v) {
- rv = C.sqlite3_bind_int(s.s, n, -1)
+ rv = C.sqlite3_bind_int(s.s, n, 1)
} else {
rv = C.sqlite3_bind_int(s.s, n, 0)
}
@@ -233,7 +239,11 @@ type SQLiteRows struct {
}
func (rc *SQLiteRows) Close() error {
- return rc.s.Close()
+ rv := C.sqlite3_reset(rc.s.s)
+ if rv != C.SQLITE_OK {
+ return errors.New(C.GoString(C.sqlite3_errmsg(rc.s.c.db)))
+ }
+ return nil
}
func (rc *SQLiteRows) Columns() []string {
Please sign in to comment.
Something went wrong with that request. Please try again.