Class InsertSqlGenerator

java.lang.Object
org.litebridgedb.db.spi.impl.sql.AbstractSqlGenerator
org.litebridgedb.db.spi.impl.sql.InsertSqlGenerator

public class InsertSqlGenerator extends AbstractSqlGenerator
  • Constructor Details

  • Method Details

    • prepareSql

      public PreparedSql prepareSql(Insert insert, ConnectionProvider connectionProvider)
      Prepare a SQL INSERT statement along with its bind values for execution.

      This method constructs the SQL query string based on the provided Insert object, which contains the table's metadata, expressions, and rows to be inserted. The bind values are derived from the rows and included in the returned PreparedSql.

      Parameters:
      insert - the Insert object containing the table metadata, expressions, and rows for the SQL INSERT operation
      Returns:
      a PreparedSql object containing the generated SQL query string and the list of bind values
    • prepareRow

      protected PreparedRow prepareRow(RowValue rowValue, ConnectionProvider connectionProvider)
      Prepare a row for insertion based on the provided row value. This includes processing column values, converting them to a suitable format, and generating value specifiers and bind values for the prepared row. Handles nullable expressions, auto-increment expressions, and sequence-based value generation as necessary.
      Parameters:
      rowValue - the row value object containing the column definitions and their values
      Returns:
      a PreparedRow instance containing processed value specifiers and bind values
      Throws:
      IllegalArgumentException - if a non-nullable column without an auto-increment or sequence value is attempted to be set to NULL