Fix update join for databases except sqlite
This commit is contained in:
parent
b23798dc98
commit
22d763c312
|
@ -626,6 +626,10 @@ func (statement *Statement) WriteUpdate(updateWriter *builder.BytesWriter, cond
|
|||
return err
|
||||
}
|
||||
|
||||
if err := statement.writeJoins(updateWriter); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if statement.dialect.URI().DBType == schemas.MSSQL {
|
||||
table := statement.RefTable
|
||||
if statement.HasOrderBy() && table != nil && len(table.PrimaryKeys) == 1 {
|
||||
|
|
|
@ -1472,8 +1472,12 @@ func TestNilFromDB(t *testing.T) {
|
|||
assert.NotNil(t, tt4.Field1.cb)
|
||||
}
|
||||
|
||||
/*
|
||||
func TestUpdateWithJoin(t *testing.T) {
|
||||
if testEngine.Dialect().URI().DBType == schemas.SQLITE {
|
||||
t.Skip()
|
||||
return
|
||||
}
|
||||
|
||||
type TestUpdateWithJoin struct {
|
||||
Id int64
|
||||
ExtId int64
|
||||
|
@ -1497,8 +1501,7 @@ func TestUpdateWithJoin(t *testing.T) {
|
|||
|
||||
_, err = testEngine.Table("test_update_with_join").
|
||||
Join("INNER", "test_update_with_join2", "test_update_with_join.ext_id = test_update_with_join2.id").
|
||||
Where("test_update_with_join2.name = ?", "test").
|
||||
Where("test_update_with_join2.`name` = ?", "test").
|
||||
Update(&TestUpdateWithJoin{Name: "test2"})
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue