File: stmt.go

package info (click to toggle)
golang-github-erikstmartin-go-testdb 0.0~git20160219.0.8d10e4a-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 116 kB
  • ctags: 113
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package testdb

import (
	"database/sql/driver"
)

type stmt struct {
	queryFunc func(args []driver.Value) (driver.Rows, error)
	execFunc  func(args []driver.Value) (driver.Result, error)
}

func (s *stmt) Close() error {
	return nil
}

func (s *stmt) NumInput() int {
	// This prevents the sql package from validating the number of inputs
	return -1
}

func (s *stmt) Exec(args []driver.Value) (driver.Result, error) {
	return s.execFunc(args)
}

func (s *stmt) Query(args []driver.Value) (driver.Rows, error) {
	return s.queryFunc(args)
}