Add RowsAffected for query

This commit is contained in:
Jinzhu 2015-01-28 11:16:29 +08:00
parent 3e9c2d581f
commit 1888335b6e
1 changed files with 5 additions and 1 deletions

View File

@ -41,14 +41,18 @@ func Query(scope *Scope) {
if !scope.HasError() {
rows, err := scope.DB().Query(scope.Sql, scope.SqlVars...)
scope.db.RowsAffected = 0
if scope.Err(err) != nil {
return
}
defer rows.Close()
columns, _ := rows.Columns()
defer rows.Close()
for rows.Next() {
scope.db.RowsAffected += 1
anyRecordFound = true
elem := dest
if isSlice {