-
Notifications
You must be signed in to change notification settings - Fork 0
/
s.go
54 lines (47 loc) · 1.31 KB
/
s.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
46
47
48
49
50
51
52
53
54
/*
* Copyright (c) 2000-2018, 达梦数据库有限公司.
* All rights reserved.
*/
package dm
type DmResult struct {
filterable
dmStmt *DmStatement
affectedRows int64
insertId int64
}
func newDmResult(bs *DmStatement, execInfo *execRetInfo) *DmResult {
result := DmResult{}
result.resetFilterable(&bs.filterable)
result.dmStmt = bs
result.affectedRows = execInfo.updateCount
result.insertId = execInfo.lastInsertId
result.idGenerator = dmResultIDGenerator
return &result
}
/*************************************************************
** PUBLIC METHODS AND FUNCTIONS
*************************************************************/
func (r *DmResult) LastInsertId() (int64, error) {
//if err := r.dmStmt.checkClosed(); err != nil {
// return -1, err
//}
if len(r.filterChain.filters) == 0 {
return r.lastInsertId()
}
return r.filterChain.reset().DmResultLastInsertId(r)
}
func (r *DmResult) RowsAffected() (int64, error) {
//if err := r.dmStmt.checkClosed(); err != nil {
// return -1, err
//}
if len(r.filterChain.filters) == 0 {
return r.rowsAffected()
}
return r.filterChain.reset().DmResultRowsAffected(r)
}
func (result *DmResult) lastInsertId() (int64, error) {
return result.insertId, nil
}
func (result *DmResult) rowsAffected() (int64, error) {
return result.affectedRows, nil
}