(w expr.DialectWriter)
| 1785 | |
| 1786 | func (m *SqlInsert) Keyword() lex.TokenType { return m.kw } |
| 1787 | func (m *SqlInsert) WriteDialect(w expr.DialectWriter) { |
| 1788 | |
| 1789 | io.WriteString(w, "INSERT INTO ") |
| 1790 | w.WriteIdentity(m.Table) |
| 1791 | io.WriteString(w, " (") |
| 1792 | |
| 1793 | for i, col := range m.Columns { |
| 1794 | if i > 0 { |
| 1795 | io.WriteString(w, ", ") |
| 1796 | } |
| 1797 | col.WriteDialect(w) |
| 1798 | } |
| 1799 | io.WriteString(w, ") VALUES") |
| 1800 | for i, row := range m.Rows { |
| 1801 | if i > 0 { |
| 1802 | io.WriteString(w, "\n\t,") |
| 1803 | } |
| 1804 | io.WriteString(w, " (") |
| 1805 | for vi, val := range row { |
| 1806 | if vi > 0 { |
| 1807 | io.WriteString(w, " ,") |
| 1808 | } |
| 1809 | if val.Expr != nil { |
| 1810 | val.Expr.WriteDialect(w) |
| 1811 | } else { |
| 1812 | // Value is not nil |
| 1813 | w.WriteValue(val.Value) |
| 1814 | } |
| 1815 | } |
| 1816 | w.Write([]byte{')'}) |
| 1817 | } |
| 1818 | } |
| 1819 | func (m *SqlInsert) String() string { |
| 1820 | w := expr.NewDefaultWriter() |
| 1821 | m.WriteDialect(w) |
no test coverage detected