forked from go-mysql-org/go-mysql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.go
43 lines (35 loc) · 773 Bytes
/
result.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
package mysql
// Result should be created by NewResultWithoutRows or NewResult. The zero value
// of Result is invalid.
type Result struct {
Status uint16
Warnings uint16
InsertId uint64
AffectedRows uint64
*Resultset
}
func NewResult(resultset *Resultset) *Result {
return &Result{
Resultset: resultset,
}
}
func NewResultReserveResultset(fieldCount int) *Result {
return &Result{
Resultset: NewResultset(fieldCount),
}
}
type Executer interface {
Execute(query string, args ...interface{}) (*Result, error)
}
func (r *Result) Close() {
if r.Resultset != nil {
r.Resultset.returnToPool()
r.Resultset = nil
}
}
func (r *Result) HasResultset() bool {
if r.Resultset != nil && len(r.Resultset.Fields) > 0 {
return true
}
return false
}