the second Where will be treated as And

This commit is contained in:
Lunny Xiao 2016-03-23 16:22:08 +08:00
parent 3da8f14fc1
commit 0d2245dad2
3 changed files with 7 additions and 2 deletions

View File

@ -1 +1 @@
xorm v0.5.2.0316 xorm v0.5.2.0323

View File

@ -145,6 +145,11 @@ func (statement *Statement) Alias(alias string) *Statement {
// Where add Where statment // Where add Where statment
func (statement *Statement) Where(querystring string, args ...interface{}) *Statement { func (statement *Statement) Where(querystring string, args ...interface{}) *Statement {
// The second where will be triggered as And
if len(statement.WhereStr) > 0 {
return statement.And(querystring, args...)
}
if !strings.Contains(querystring, statement.Engine.dialect.EqStr()) { if !strings.Contains(querystring, statement.Engine.dialect.EqStr()) {
querystring = strings.Replace(querystring, "=", statement.Engine.dialect.EqStr(), -1) querystring = strings.Replace(querystring, "=", statement.Engine.dialect.EqStr(), -1)
} }

View File

@ -17,7 +17,7 @@ import (
) )
const ( const (
Version string = "0.5.2.0316" Version string = "0.5.2.0323"
) )
func regDrvsNDialects() bool { func regDrvsNDialects() bool {