aboutsummaryrefslogtreecommitdiff
path: root/sqlite3_go18.go
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2016-11-04 14:24:22 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2016-11-04 14:24:22 +0900
commitc95a77965c55783416165ca638dec12c0f0a9fdb (patch)
tree69e42bf5616a95814d99e764056c8898e4892f46 /sqlite3_go18.go
parentimplement go18 Pinger (diff)
downloadgolite-c95a77965c55783416165ca638dec12c0f0a9fdb.tar.gz
golite-c95a77965c55783416165ca638dec12c0f0a9fdb.tar.xz
context features
Diffstat (limited to 'sqlite3_go18.go')
-rw-r--r--sqlite3_go18.go32
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)
+}