Commit 4aca652e authored by gwenn's avatar gwenn

Fix sqlite3_next_stmt misuse and docs.

parent c45ae22f
...@@ -20,7 +20,7 @@ Stmt#ScanByIndex/ScanByName are added to test NULL value. ...@@ -20,7 +20,7 @@ Stmt#ScanByIndex/ScanByName are added to test NULL value.
Currently, the weak point of the binding is the *Scan* methods: Currently, the weak point of the binding is the *Scan* methods:
The original implementation is using this strategy: The original implementation is using this strategy:
- convert the stored value to a []byte by calling sqlite3_column_bytes, - convert the stored value to a []byte by calling sqlite3_column_blob,
- convert the bytes to the desired Go type with correct feedback in case of illegal conversion, - convert the bytes to the desired Go type with correct feedback in case of illegal conversion,
- but apparently no support for NULL value. - but apparently no support for NULL value.
Using the native sqlite3_column_x implies: Using the native sqlite3_column_x implies:
......
...@@ -17,6 +17,7 @@ import ( ...@@ -17,6 +17,7 @@ import (
) )
// io.ReadCloser adapter to BLOB // io.ReadCloser adapter to BLOB
// (See http://sqlite.org/c3ref/blob.html)
type BlobReader struct { type BlobReader struct {
c *Conn c *Conn
bl *C.sqlite3_blob bl *C.sqlite3_blob
......
...@@ -158,6 +158,7 @@ func (c *Conn) LastError() error { ...@@ -158,6 +158,7 @@ func (c *Conn) LastError() error {
} }
// Database connection handle // Database connection handle
// (See http://sqlite.org/c3ref/sqlite3.html)
type Conn struct { type Conn struct {
db *C.sqlite3 db *C.sqlite3
stmtCache *cache stmtCache *cache
...@@ -501,7 +502,7 @@ func (c *Conn) Close() error { ...@@ -501,7 +502,7 @@ func (c *Conn) Close() error {
Log(C.SQLITE_MISUSE, "Dangling statement (not finalize): \""+C.GoString(C.sqlite3_sql(stmt))+"\"") Log(C.SQLITE_MISUSE, "Dangling statement (not finalize): \""+C.GoString(C.sqlite3_sql(stmt))+"\"")
} }
C.sqlite3_finalize(stmt) C.sqlite3_finalize(stmt)
stmt = C.sqlite3_next_stmt(c.db, stmt) stmt = C.sqlite3_next_stmt(c.db, nil)
} }
rv := C.sqlite3_close(c.db) rv := C.sqlite3_close(c.db)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment