parent
caab56ac7e
commit
d4149d1eee
|
@ -10,6 +10,7 @@ import (
|
|||
"reflect"
|
||||
|
||||
"github.com/go-xorm/builder"
|
||||
"github.com/go-xorm/core"
|
||||
)
|
||||
|
||||
// Exist returns true if the record exist otherwise return false
|
||||
|
@ -35,10 +36,18 @@ func (session *Session) Exist(bean ...interface{}) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
if session.engine.dialect.DBType() == core.MSSQL {
|
||||
sqlStr = fmt.Sprintf("SELECT top 1 * FROM %s WHERE %s", tableName, condSQL)
|
||||
} else {
|
||||
sqlStr = fmt.Sprintf("SELECT * FROM %s WHERE %s LIMIT 1", tableName, condSQL)
|
||||
}
|
||||
args = condArgs
|
||||
} else {
|
||||
if session.engine.dialect.DBType() == core.MSSQL {
|
||||
sqlStr = fmt.Sprintf("SELECT top 1 * FROM %s", tableName)
|
||||
} else {
|
||||
sqlStr = fmt.Sprintf("SELECT * FROM %s LIMIT 1", tableName)
|
||||
}
|
||||
args = []interface{}{}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue