fixed
h2 insert
This commit is contained in:
parent
9235703e7a
commit
0112f25f24
|
@ -117,10 +117,20 @@ func createCallback(scope *Scope) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := scope.SQLDB().QueryRow(scope.SQL, scope.SQLVars...).Scan(primaryField.Field.Addr().Interface()); scope.Err(err) == nil {
|
|
||||||
primaryField.IsBlank = false
|
if scope.Dialect().GetName() == "h2" {
|
||||||
scope.db.RowsAffected = 1
|
_, err := scope.SQLDB().Exec(scope.SQL, scope.SQLVars...)
|
||||||
|
if scope.Err(err) == nil {
|
||||||
|
primaryField.IsBlank = false
|
||||||
|
scope.db.RowsAffected = 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := scope.SQLDB().QueryRow(scope.SQL, scope.SQLVars...).Scan(primaryField.Field.Addr().Interface()); scope.Err(err) == nil {
|
||||||
|
primaryField.IsBlank = false
|
||||||
|
scope.db.RowsAffected = 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,12 +114,13 @@ func (s h2) CurrentDatabase() (name string) {
|
||||||
|
|
||||||
func (s h2) LastInsertIDReturningSuffix(tableName, key string) string {
|
func (s h2) LastInsertIDReturningSuffix(tableName, key string) string {
|
||||||
//return fmt.Sprintf("RETURNING %v.%v", tableName, key)
|
//return fmt.Sprintf("RETURNING %v.%v", tableName, key)
|
||||||
return fmt.Sprintf(" ")
|
return fmt.Sprintf(" ; ")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h2) SupportLastInsertID() bool {
|
func (h2) SupportLastInsertID() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//func isByteArrayOrSlice(value reflect.Value) bool {
|
//func isByteArrayOrSlice(value reflect.Value) bool {
|
||||||
// return (value.Kind() == reflect.Array || value.Kind() == reflect.Slice) && value.Type().Elem() == reflect.TypeOf(uint8(0))
|
// return (value.Kind() == reflect.Array || value.Kind() == reflect.Slice) && value.Type().Elem() == reflect.TypeOf(uint8(0))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user