public class Insert extends H2SqlPart
Generates an INSERT INTO statement for H2.
INSERT INTO `tableName` (`col1`, `col2`, `col3`)
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3),...
| Constructor and Description |
|---|
Insert(String table)
Constructs an Insert for the specified table.
|
| Modifier and Type | Method and Description |
|---|---|
Insert |
add(String columnName,
Object value)
Adds a column-value pair to the current row.
|
void |
collectSqlFragment(CodeWriter writer) |
InsertRow |
getLastRow()
Returns the last row.
|
List<InsertRow> |
getRows()
Returns the list of rows.
|
String |
getTable()
Returns the table name.
|
Insert |
nextRow()
Starts a new row for inserting.
|
Insert |
setPretty(boolean pretty)
Indicates if line breaks and indentations should be added to output insert statement (default false).
Example output (pretty = true): INSERT INTO `tableName` (`col1`, `col2`, `col3`) |
escapeKeyword, placeBackTickscollectParameterValues, getParameterValues, getSqlFragment, isPretty, printSqlParts, toStringpublic Insert(String table)
table - the table namepublic Insert setPretty(boolean pretty)
INSERT INTO `tableName` (`col1`, `col2`, `col3`)
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3),...
INSERT INTO `tableName` (`col1`, `col2`, `col3`) VALUES (val1, val2, val3), (val1, val2, val3), (val1, val2, val3),...public String getTable()
public Insert nextRow()
public Insert add(String columnName, Object value)
columnName - the column namevalue - the value to insertpublic InsertRow getLastRow()
public void collectSqlFragment(CodeWriter writer)
collectSqlFragment in class SqlPartCopyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.