java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
Direct Known Subclasses:
CreatePostgreSqlDdlFromSchemaDef, Delete, H2SqlPart, Insert, InsertRow, InsertValue, Merge, MergeValue, MySqlPart, OnConflict, PostgresSqlPart, QueryPart, QuerySource, Update, UpdateValue

public abstract class SqlPart extends Object
Base class for the SQL builders: renders a SQL fragment and collects the values for its ? parameters.
  • Constructor Details

    • SqlPart

      public SqlPart()
  • Method Details

    • isPretty

      public boolean isPretty()
      Indicates if getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
    • setPretty

      public SqlPart setPretty(boolean pretty)
      Indicates if getSqlFragment() adds line breaks and indentation instead of using one line (default is false).
    • collectSqlFragment

      public abstract void collectSqlFragment(CodeWriter writer)
      Writes this part's SQL to the writer; used by getSqlFragment() and by enclosing parts.
    • getSqlFragment

      public final String getSqlFragment()
      Returns this part's SQL, formatted as set by setPretty(boolean), with trailing whitespace removed.
    • collectParameterValues

      public void collectParameterValues(List<Object> values)
      Appends the values for this part's ? parameters to the list in order; adds nothing by default.
    • getParameterValues

      public final Object[] getParameterValues()
      Returns the values for this part's ? parameters in order, or an empty array if there are none.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • printSqlParts

      protected static void printSqlParts(CodeWriter writer, List<? extends SqlPart> parts, String separator)
      Writes the SQL of each part to the writer, separated by separator.