java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
com.northconcepts.datapipeline.jdbc.sql.insert.Insert

public class Insert extends SqlPart
Builds an INSERT INTO table (columns) VALUES (?, ...), ... statement with one or more rows; the column list comes from the first row.
  • Constructor Details

    • Insert

      public Insert(String table)
  • Method Details

    • setPretty

      public Insert setPretty(boolean pretty)
      Description copied from class: SqlPart
      Indicates if SqlPart.getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
      Overrides:
      setPretty in class SqlPart
    • getTable

      public String getTable()
    • addRows

      public Insert addRows(int rowCount, boolean copyLastRowValues)
      Appends rowCount rows, each pre-filled with the previous row's columns and values if copyLastRowValues is true.
    • nextRow

      public Insert nextRow(boolean copyLastRowValues)
      Begins a new row for subsequent add calls, pre-filled with the previous row's columns and values if copyLastRowValues is true.
    • nextRow

      public Insert nextRow()
      Begins a new, empty row for subsequent add calls.
    • add

      public Insert add(String columnName, Object value)
      Adds a column and its parameter value to the current (last) row.
    • add

      public Insert add(String... columnNames)
      Adds columns with null parameter values to the current (last) row.
    • getRows

      public List<InsertRow> getRows()
    • getLastRow

      public InsertRow getLastRow()
    • collectSqlFragment

      public void collectSqlFragment(CodeWriter writer)
      Description copied from class: SqlPart
      Writes this part's SQL to the writer; used by SqlPart.getSqlFragment() and by enclosing parts.
      Specified by:
      collectSqlFragment in class SqlPart
    • collectParameterValues

      public void collectParameterValues(List<Object> values)
      Description copied from class: SqlPart
      Appends the values for this part's ? parameters to the list in order; adds nothing by default.
      Overrides:
      collectParameterValues in class SqlPart