1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.dynamic.sql.insert.render;
17
18 import static org.mybatis.dynamic.sql.util.StringUtilities.spaceBefore;
19
20 import org.mybatis.dynamic.sql.SqlTable;
21
22 public class InsertRenderingUtilities {
23 private InsertRenderingUtilities() {}
24
25 public static String calculateInsertStatement(SqlTable table, FieldAndValueCollector collector) {
26 String statementStart = calculateInsertStatementStart(table);
27 String columnsPhrase = collector.columnsPhrase();
28 String valuesPhrase = collector.valuesPhrase();
29
30 return statementStart + spaceBefore(columnsPhrase) + spaceBefore(valuesPhrase);
31 }
32
33 public static String calculateInsertStatementStart(SqlTable table) {
34 return "insert into " + table.tableName();
35 }
36 }