support update join

This commit is contained in:
Lunny Xiao 2023-07-24 16:00:20 +08:00
parent a13564976c
commit 860e0aca85
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 11 additions and 2 deletions

View File

@ -1471,8 +1471,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
@ -1500,4 +1504,3 @@ func TestUpdateWithJoin(t *testing.T) {
Update(&TestUpdateWithJoin{Name: "test2"})
assert.NoError(t, err)
}
*/

View File

@ -436,10 +436,16 @@ func (statement *Statement) WriteUpdate(updateWriter *builder.BytesWriter, cond
return err
}
// write table name
if err := statement.writeUpdateTableName(updateWriter); err != nil {
return err
}
// write join
if err := statement.writeJoins(updateWriter); err != nil {
return err
}
// write set
if _, err := fmt.Fprint(updateWriter, " SET "); err != nil {
return err