Class Insert
java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
com.northconcepts.datapipeline.sql.postgresql.PostgresSqlPart
com.northconcepts.datapipeline.sql.postgresql.Insert
Generates an INSERT INTO statement for PostgreSQL.
Sample Generated SQL:
INSERT INTO "tableName" ("col1", "col2", "col3")
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3),...
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a column value (an SQL literal, written as-is) to the current row; only the first row's column names are used.voidcollectSqlFragment(CodeWriter writer) Writes this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.getRows()getTable()nextRow()Starts a new row for subsequentadd(String, Object)calls; the first row already exists after construction.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")
VALUES (val1, val2, val3),Methods inherited from class com.northconcepts.datapipeline.sql.postgresql.PostgresSqlPart
escapeKeywordMethods inherited from class com.northconcepts.datapipeline.jdbc.sql.SqlPart
collectParameterValues, getParameterValues, getSqlFragment, isPretty, printSqlParts, toString
-
Constructor Details
-
Insert
-
-
Method Details
-
setPretty
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")
VALUES (val1, val2, val3),
(val1, val2, val3),
(val1, val2, val3),...
Example output (pretty = false):
INSERT INTO "tableName" ("col1", "col2", "col3") VALUES (val1, val2, val3), (val1, val2, val3), (val1, val2, val3),... -
getTable
-
nextRow
Starts a new row for subsequentadd(String, Object)calls; the first row already exists after construction. -
add
Adds a column value (an SQL literal, written as-is) to the current row; only the first row's column names are used. -
getRows
-
getLastRow
-
collectSqlFragment
Description copied from class:SqlPartWrites this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.- Specified by:
collectSqlFragmentin classSqlPart
-