Fix Create when dialect does not support last inserted id

This commit is contained in:
Bojan Petrovic 2015-06-04 13:47:25 +02:00
parent 0b8c9f29a9
commit 94f56e646b
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ func Create(scope *Scope) {
} }
} else { } else {
if primaryField == nil { if primaryField == nil {
if results, err := scope.SqlDB().Exec(scope.Sql, scope.SqlVars...); err != nil { if results, err := scope.SqlDB().Exec(scope.Sql, scope.SqlVars...); err == nil {
scope.db.RowsAffected, _ = results.RowsAffected() scope.db.RowsAffected, _ = results.RowsAffected()
} }
} else if scope.Err(scope.SqlDB().QueryRow(scope.Sql, scope.SqlVars...).Scan(primaryField.Field.Addr().Interface())) == nil { } else if scope.Err(scope.SqlDB().QueryRow(scope.Sql, scope.SqlVars...).Scan(primaryField.Field.Addr().Interface())) == nil {