forked from snowflakedb/gosnowflake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
statement.go
45 lines (36 loc) · 1.27 KB
/
statement.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
// Copyright (c) 2017-2022 Snowflake Computing Inc. All rights reserved.
package gosnowflake
import (
"context"
"database/sql/driver"
)
type snowflakeStmt struct {
sc *snowflakeConn
query string
}
func (stmt *snowflakeStmt) Close() error {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.Close")
// noop
return nil
}
func (stmt *snowflakeStmt) NumInput() int {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.NumInput")
// Go Snowflake doesn't know the number of binding parameters.
return -1
}
func (stmt *snowflakeStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error) {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.ExecContext")
return stmt.sc.ExecContext(ctx, stmt.query, args)
}
func (stmt *snowflakeStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error) {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.QueryContext")
return stmt.sc.QueryContext(ctx, stmt.query, args)
}
func (stmt *snowflakeStmt) Exec(args []driver.Value) (driver.Result, error) {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.Exec")
return stmt.sc.Exec(stmt.query, args)
}
func (stmt *snowflakeStmt) Query(args []driver.Value) (driver.Rows, error) {
logger.WithContext(stmt.sc.ctx).Infoln("Stmt.Query")
return stmt.sc.Query(stmt.query, args)
}