forked from mirror/go-sqlcipher
database/sql expects io.EOF after all rows have been Next'ed
Return io.EOF, so rows.Next() will automatically call rows.Close() after all results have been returned.
This commit is contained in:
parent
fdc20cdbcb
commit
81a88cec73
|
@ -19,9 +19,10 @@ _sqlite3_bind_blob(sqlite3_stmt *stmt, int n, void *p, int np) {
|
|||
*/
|
||||
import "C"
|
||||
import (
|
||||
"errors"
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"errors"
|
||||
"io"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
@ -247,6 +248,9 @@ func (rc *SQLiteRows) Columns() []string {
|
|||
|
||||
func (rc *SQLiteRows) Next(dest []driver.Value) error {
|
||||
rv := C.sqlite3_step(rc.s.s)
|
||||
if rv == C.SQLITE_DONE {
|
||||
return io.EOF
|
||||
}
|
||||
if rv != C.SQLITE_ROW {
|
||||
return errors.New(C.GoString(C.sqlite3_errmsg(rc.s.c.db)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue