bug fixed for Sql().Find()

This commit is contained in:
Lunny Xiao 2013-12-10 15:12:43 +08:00
parent c70b4ad8d3
commit 82bdc0ec5a
1 changed files with 2213 additions and 2212 deletions

View File

@ -349,8 +349,9 @@ func (session *Session) scanMapIntoStruct(obj interface{}, objMap map[string][]b
table := session.Engine.autoMapType(rType(obj))
for key, data := range objMap {
key = strings.ToLower(key)
if _, ok := table.Columns[key]; !ok {
session.Engine.LogWarn("table %v's has not column %v.", table.Name, key)
session.Engine.LogWarn(fmt.Sprintf("table %v's has not column %v. %v", table.Name, key, table.ColumnsSeq))
continue
}
col := table.Columns[key]
@ -2174,7 +2175,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
}
}
if table.PrimaryKey == "" {
if table.PrimaryKey == "" || table.PKColumn().SQLType.IsText() {
return res.RowsAffected()
}