-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrvQueryResult.go
More file actions
52 lines (46 loc) · 1.18 KB
/
drvQueryResult.go
File metadata and controls
52 lines (46 loc) · 1.18 KB
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
46
47
48
49
50
51
52
// Copyright 2014 Rana Ian. All rights reserved.
// Use of this source code is governed by The MIT License
// found in the accompanying LICENSE file.
package ora
import (
"database/sql/driver"
)
// DrvQueryResult contains methods to retrieve the results of a SQL select statement.
//
// DrvQueryResult implements the driver.Rows interface.
type DrvQueryResult struct {
rset *Rset
}
// Next populates the specified slice with the next row of data.
//
// Returns io.EOF when there are no more rows.
//
// Next is a member of the driver.Rows interface.
func (qr *DrvQueryResult) Next(dest []driver.Value) (err error) {
err = qr.rset.beginRow()
defer qr.rset.endRow()
if err != nil {
return err
}
// Populate column values into destination slice
for n, define := range qr.rset.defs {
value, err := define.value()
if err != nil {
return err
}
dest[n] = value
}
return nil
}
// Columns returns query column names.
//
// Columns is a member of the driver.Rows interface.
func (qr *DrvQueryResult) Columns() []string {
return qr.rset.ColumnNames
}
// Close performs no operations.
//
// Close is a member of the driver.Rows interface.
func (qr *DrvQueryResult) Close() error {
return nil
}