(ctx Context, m *qcode.Mutate, set func(), from func(), where func())
| 637 | } |
| 638 | |
| 639 | func (d *SQLiteDialect) RenderUpdate(ctx Context, m *qcode.Mutate, set func(), from func(), where func()) { |
| 640 | // Pre-select IDs into _gj_ids for later use by the SELECT query |
| 641 | vName := getVarName(m) |
| 642 | ctx.WriteString(`INSERT INTO _gj_ids (k, id) SELECT '`) |
| 643 | ctx.WriteString(vName) |
| 644 | ctx.WriteString(`', `) |
| 645 | renderPKIDExpr(ctx, m) |
| 646 | ctx.WriteString(` FROM `) |
| 647 | ctx.ColWithTable(m.Ti.Schema, m.Ti.Name) |
| 648 | ctx.WriteString(` AS `) |
| 649 | ctx.Quote(m.Ti.Name) |
| 650 | if from != nil { |
| 651 | ctx.WriteString(`, `) // Comma for implicit join in SELECT |
| 652 | from() |
| 653 | } |
| 654 | ctx.WriteString(` WHERE `) |
| 655 | |
| 656 | // Add implicit join condition for JSON updates (only for Arrays where ID is in Input) |
| 657 | if m.IsJSON && m.Array { |
| 658 | renderPKJSONJoin(ctx, m) |
| 659 | ctx.WriteString(` AND `) |
| 660 | } |
| 661 | |
| 662 | where() |
| 663 | ctx.WriteString(`; `) |
| 664 | |
| 665 | ctx.WriteString(`UPDATE `) |
| 666 | ctx.ColWithTable(m.Ti.Schema, m.Ti.Name) |
| 667 | ctx.WriteString(` SET `) |
| 668 | set() |
| 669 | if from != nil { |
| 670 | ctx.WriteString(` FROM `) // SQLite UPDATE FROM syntax |
| 671 | from() |
| 672 | } |
| 673 | ctx.WriteString(` WHERE `) |
| 674 | |
| 675 | // Add implicit join condition for JSON updates (only for Arrays where ID is in Input) |
| 676 | if m.IsJSON && m.Array { |
| 677 | renderPKJSONJoin(ctx, m) |
| 678 | ctx.WriteString(` AND `) |
| 679 | } |
| 680 | |
| 681 | where() |
| 682 | } |
| 683 | |
| 684 | func (d *SQLiteDialect) RenderDelete(ctx Context, m *qcode.Mutate, where func()) { |
| 685 | ctx.WriteString(`DELETE FROM `) |
no test coverage detected