func buildUpdates has same issue, fixed

This commit is contained in:
Zhou 2015-03-10 09:15:50 +08:00
parent 16b813a159
commit d298f91ceb
1 changed files with 3 additions and 1 deletions

View File

@ -421,7 +421,9 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
if table, ok := engine.Tables[fieldValue.Type()]; ok { if table, ok := engine.Tables[fieldValue.Type()]; ok {
if len(table.PrimaryKeys) == 1 { if len(table.PrimaryKeys) == 1 {
pkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName) pkField := reflect.Indirect(fieldValue).FieldByName(table.PKColumns()[0].FieldName)
if pkField.Int() != 0 { // fix non-int pk issues
//if pkField.Int() != 0 {
if pkField.IsValid() {
val = pkField.Interface() val = pkField.Interface()
} else { } else {
continue continue