mirror of https://github.com/go-gorm/gorm.git
Fix query with extra option
This commit is contained in:
parent
c9dfd80959
commit
b054f235b9
|
@ -51,13 +51,12 @@ func queryCallback(scope *Scope) {
|
|||
scope.prepareQuerySql()
|
||||
|
||||
if !scope.HasError() {
|
||||
var extraOption string
|
||||
if str, ok := scope.Get("gorm:query_option"); ok {
|
||||
extraOption = fmt.Sprint(str)
|
||||
}
|
||||
scope.db.RowsAffected = 0
|
||||
if str, ok := scope.Get("gorm:query_option"); ok {
|
||||
scope.Sql += addExtraSpaceIfExist(fmt.Sprint(str))
|
||||
}
|
||||
|
||||
if rows, err := scope.SqlDB().Query(scope.Sql+addExtraSpaceIfExist(extraOption), scope.SqlVars...); scope.Err(err) == nil {
|
||||
if rows, err := scope.SqlDB().Query(scope.Sql, scope.SqlVars...); scope.Err(err) == nil {
|
||||
defer rows.Close()
|
||||
|
||||
columns, _ := rows.Columns()
|
||||
|
|
Loading…
Reference in New Issue