-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexec.go
36 lines (30 loc) · 863 Bytes
/
exec.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
package bigquery
import (
"context"
"database/sql/driver"
"github.com/viant/bigquery/internal/ingestion"
)
type ingestionStatement struct {
service *ingestion.Service
ctx context.Context
SQL string
}
// Close dummy function because interface requires it
func (s *ingestionStatement) Close() error {
return nil
}
// NumInput dummy function because interface requires it
func (s *ingestionStatement) NumInput() int {
return 0
}
// Exec executes a query that doesn't return rows, such as an LOAD
func (s *ingestionStatement) Exec(args []driver.Value) (driver.Result, error) {
affected, err := s.service.Ingest(s.ctx, s.SQL)
res := result{}
res.totalRows = affected
return &res, err
}
// Query dummy function because interface requires it
func (s *ingestionStatement) Query(args []driver.Value) (driver.Rows, error) {
return &Rows{}, nil
}