diff options
Diffstat (limited to 'sqlite3_go18.go')
-rw-r--r-- | sqlite3_go18.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sqlite3_go18.go b/sqlite3_go18.go new file mode 100644 index 0000000..1ee4c6a --- /dev/null +++ b/sqlite3_go18.go @@ -0,0 +1,32 @@ +package sqlite3 + +import ( + "database/sql/driver" + "errors" + + "golang.org/x/net/context" +) + +// Ping implement Pinger. +func (c *SQLiteConn) Ping(ctx context.Context) error { + if c.db == nil { + return errors.New("Connection was closed") + } + return nil +} + +func (c *SQLiteConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error) { + list := make([]namedValue, len(args)) + for i, nv := range args { + list[i] = namedValue(nv) + } + return c.query(ctx, query, list) +} + +func (s *SQLiteStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) { + list := make([]namedValue, len(args)) + for i, nv := range args { + list[i] = namedValue(nv) + } + return s.query(ctx, list) +} |