forked from mirror/gorm
Add RowsAffected for query
This commit is contained in:
parent
3e9c2d581f
commit
1888335b6e
|
@ -41,14 +41,18 @@ func Query(scope *Scope) {
|
||||||
|
|
||||||
if !scope.HasError() {
|
if !scope.HasError() {
|
||||||
rows, err := scope.DB().Query(scope.Sql, scope.SqlVars...)
|
rows, err := scope.DB().Query(scope.Sql, scope.SqlVars...)
|
||||||
|
scope.db.RowsAffected = 0
|
||||||
|
|
||||||
if scope.Err(err) != nil {
|
if scope.Err(err) != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
defer rows.Close()
|
|
||||||
columns, _ := rows.Columns()
|
columns, _ := rows.Columns()
|
||||||
|
|
||||||
|
defer rows.Close()
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
|
scope.db.RowsAffected += 1
|
||||||
|
|
||||||
anyRecordFound = true
|
anyRecordFound = true
|
||||||
elem := dest
|
elem := dest
|
||||||
if isSlice {
|
if isSlice {
|
||||||
|
|
Loading…
Reference in New Issue