(ctx Context, m *qcode.Mutate)
| 716 | } |
| 717 | |
| 718 | func (d *SQLiteDialect) RenderReturning(ctx Context, m *qcode.Mutate) { |
| 719 | // SQLite 3.35+ supports RETURNING clause |
| 720 | // Return a JSON object with the ID for the execution layer to parse |
| 721 | if m.Ti.HasCompositePK() { |
| 722 | ctx.WriteString(` RETURNING json_object(`) |
| 723 | for i, pkCol := range m.Ti.PrimaryCols { |
| 724 | if i > 0 { |
| 725 | ctx.WriteString(`, `) |
| 726 | } |
| 727 | ctx.WriteString(`'`) |
| 728 | ctx.WriteString(pkCol.Name) |
| 729 | ctx.WriteString(`', `) |
| 730 | ctx.Quote(pkCol.Name) |
| 731 | } |
| 732 | ctx.WriteString(`)`) |
| 733 | } else { |
| 734 | ctx.WriteString(` RETURNING json_object('id', `) |
| 735 | ctx.Quote(m.Ti.PrimaryCol.Name) |
| 736 | ctx.WriteString(`)`) |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | func (d *SQLiteDialect) RenderAssign(ctx Context, col string, val string) { |
| 741 | ctx.WriteString(col) |
no test coverage detected