database/sql: Add an optional Queryer-Interface (like Execer)
Completly the same like the Execer-Interface, just for Queries.
This allows Drivers to execute Queries without preparing them first
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7085056
diff --git a/src/pkg/database/sql/fakedb_test.go b/src/pkg/database/sql/fakedb_test.go
index c38ba7c..55597f7 100644
--- a/src/pkg/database/sql/fakedb_test.go
+++ b/src/pkg/database/sql/fakedb_test.go
@@ -266,6 +266,18 @@
return nil, driver.ErrSkip
}
+func (c *fakeConn) Query(query string, args []driver.Value) (driver.Rows, error) {
+ // This is an optional interface, but it's implemented here
+ // just to check that all the args are of the proper types.
+ // ErrSkip is returned so the caller acts as if we didn't
+ // implement this at all.
+ err := checkSubsetTypes(args)
+ if err != nil {
+ return nil, err
+ }
+ return nil, driver.ErrSkip
+}
+
func errf(msg string, args ...interface{}) error {
return errors.New("fakedb: " + fmt.Sprintf(msg, args...))
}