Support uint64 with high bit set.

This limitation is due to "database/sql" go package implementation.
This commit is contained in:
Nicolas Duval 2014-07-11 10:40:41 -07:00
parent 244c0989f2
commit c9db8e93f7
2 changed files with 6 additions and 2 deletions

View File

@ -2597,6 +2597,8 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
} else {
return nil, ErrUnSupportedType
}
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return int64(fieldValue.Uint()), nil
default:
return fieldValue.Interface(), nil
}

View File

@ -375,7 +375,8 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
if !requiredField && fieldValue.Uint() == 0 {
continue
}
val = fieldValue.Interface()
t := int64(fieldValue.Uint())
val = reflect.ValueOf(&t).Interface()
case reflect.Struct:
if fieldType == reflect.TypeOf(time.Now()) {
t := fieldValue.Interface().(time.Time)
@ -546,7 +547,8 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
if !requiredField && fieldValue.Uint() == 0 {
continue
}
val = fieldValue.Interface()
t := int64(fieldValue.Uint())
val = reflect.ValueOf(&t).Interface()
case reflect.Struct:
if fieldType == reflect.TypeOf(time.Now()) {
t := fieldValue.Interface().(time.Time)