Commit 60153e8a authored by gwenn's avatar gwenn

Misc.

parent c0e5c663
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
package sqlite package sqlite
/*
#include <sqlite3.h>
*/
import "C"
import ( import (
"fmt" "fmt"
"io" "io"
...@@ -137,20 +142,18 @@ func pragma(dbName, pragmaName string) string { ...@@ -137,20 +142,18 @@ func pragma(dbName, pragmaName string) string {
return Mprintf("PRAGMA %Q."+pragmaName, dbName) return Mprintf("PRAGMA %Q."+pragmaName, dbName)
} }
func (c *Conn) oneValue(query string, value interface{}, args ...interface{}) error { // no cache func (c *Conn) oneValue(query string, value interface{}) error { // no cache
s, err := c.prepare(query, args...) s, err := c.prepare(query)
if err != nil { if err != nil {
return err return err
} }
defer func() { defer s.finalize()
s.Reset() rv := C.sqlite3_step(s.stmt)
s.finalize() err = Errno(rv)
}() if err == Row {
b, err := s.Next() return s.Scan(value)
if err != nil { } else if err == Done {
return err
} else if !b {
return io.EOF return io.EOF
} }
return s.Scan(value) return s.error(rv)
} }
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