bug fixed for joinstr when has two Join

This commit is contained in:
Lunny Xiao 2014-06-25 17:09:49 +08:00
parent 021ad08402
commit c039d40ada
2 changed files with 3 additions and 2 deletions

View File

@ -389,7 +389,8 @@ func (session *Session) scanMapIntoStruct(obj interface{}, objMap map[string][]b
for key, data := range objMap { for key, data := range objMap {
if col = table.GetColumn(key); col == nil { if col = table.GetColumn(key); col == nil {
session.Engine.LogWarn(fmt.Sprintf("table %v's has not column %v. %v", table.Name, key, table.Columns())) session.Engine.LogWarn(fmt.Sprintf("struct %v's has not field %v. %v",
table.Type.Name(), key, table.ColumnsSeq()))
continue continue
} }

View File

@ -833,7 +833,7 @@ func (statement *Statement) OrderBy(order string) *Statement {
//The join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN //The join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
func (statement *Statement) Join(join_operator, tablename, condition string) *Statement { func (statement *Statement) Join(join_operator, tablename, condition string) *Statement {
if statement.JoinStr != "" { if statement.JoinStr != "" {
statement.JoinStr = statement.JoinStr + fmt.Sprintf("%v JOIN %v ON %v", join_operator, tablename, condition) statement.JoinStr = statement.JoinStr + fmt.Sprintf(" %v JOIN %v ON %v", join_operator, tablename, condition)
} else { } else {
statement.JoinStr = fmt.Sprintf("%v JOIN %v ON %v", join_operator, tablename, condition) statement.JoinStr = fmt.Sprintf("%v JOIN %v ON %v", join_operator, tablename, condition)
} }