aboutsummaryrefslogtreecommitdiff
path: root/sqlite.go
diff options
context:
space:
mode:
Diffstat (limited to 'sqlite.go')
-rw-r--r--sqlite.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/sqlite.go b/sqlite.go
index 6b40b7a..0679018 100644
--- a/sqlite.go
+++ b/sqlite.go
@@ -29,6 +29,7 @@ var (
//lint:ignore SA1019 TODO implement QueryerContext
_ driver.Queryer = (*conn)(nil)
_ driver.Result = (*result)(nil)
+ _ driver.Rows = noRows{}
_ driver.Rows = (*rows)(nil)
_ driver.Stmt = (*stmt)(nil)
_ driver.Tx = (*tx)(nil)
@@ -496,6 +497,11 @@ func (s *stmt) query(ctx context.Context, args []driver.NamedValue) (r driver.Ro
pstmt = 0
return nil
case sqlite3.SQLITE_DONE:
+ if r == nil {
+ pstmt = 0
+ r = noRows{}
+ return nil
+ }
// nop
default:
return s.c.errstr(int32(rc))
@@ -516,6 +522,12 @@ func (s *stmt) query(ctx context.Context, args []driver.NamedValue) (r driver.Ro
return r, err
}
+type noRows struct{}
+
+func (noRows) Columns() []string { return nil }
+func (noRows) Close() error { return nil }
+func (noRows) Next([]driver.Value) error { return sql.ErrNoRows }
+
type tx struct {
c *conn
}