-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstmt.go
45 lines (36 loc) · 932 Bytes
/
stmt.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package sparql
import (
"context"
"database/sql/driver"
"github.com/garsue/sparql/client"
)
// Stmt implements `driver.Stmt` with `sparql.Statement`.
type Stmt struct {
*client.Statement
}
// QueryContext queries to a SPARQL source.
func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
result, err := s.Statement.Query(ctx, argsToParams(args)...)
if err != nil {
return nil, err
}
return &Rows{
queryResult: result,
}, nil
}
// Close closes the statement. Actually do nothing.
func (s *Stmt) Close() error {
return nil
}
// NumInput is not supported. Always return -1.
func (s *Stmt) NumInput() int {
return -1
}
// Exec is not supported. DO NOT USE.
func (*Stmt) Exec(args []driver.Value) (driver.Result, error) {
panic("not supported")
}
// Query queries to the endpoint.
func (s *Stmt) Query(args []driver.Value) (driver.Rows, error) {
panic("deprecated")
}