Fix wrong RowsAffected if not data found

This commit is contained in:
Jinzhu 2021-01-14 16:01:23 +08:00
parent ce610a9560
commit 79628be2c2
1 changed files with 2 additions and 0 deletions

View File

@ -446,6 +446,8 @@ func (db *DB) Scan(dest interface{}) (tx *DB) {
defer rows.Close()
if rows.Next() {
tx.ScanRows(rows, dest)
} else {
tx.RowsAffected = 0
}
}