java.lang.Object
org.litebridgedb.db.spi.impl.sql.AbstractSqlGenerator
org.litebridgedb.db.spi.impl.sql.InsertSqlGenerator
-
Field Summary
Fields inherited from class org.litebridgedb.db.spi.impl.sql.AbstractSqlGenerator
columnIdentifierGenerator, typeConverter -
Constructor Summary
ConstructorsConstructorDescriptionInsertSqlGenerator(TypeConverter typeConverter, ColumnIdentifierGenerator columnIdentifierGenerator, BiFunction<Table, ConnectionProvider, TableMetaData> ensureTableMetaData) -
Method Summary
Modifier and TypeMethodDescriptionprotected PreparedRowprepareRow(RowValue rowValue, ConnectionProvider connectionProvider) Prepare a row for insertion based on the provided row value.prepareSql(Insert insert, ConnectionProvider connectionProvider) Prepare a SQL INSERT statement along with its bind values for execution.Methods inherited from class org.litebridgedb.db.spi.impl.sql.AbstractSqlGenerator
appendTable, appendTable, createBindValue, createCondition, ensureColumnMetaData, ensureTableMetaData, getExpressionValue, mapOperator
-
Constructor Details
-
InsertSqlGenerator
public InsertSqlGenerator(TypeConverter typeConverter, ColumnIdentifierGenerator columnIdentifierGenerator, BiFunction<Table, ConnectionProvider, TableMetaData> ensureTableMetaData)
-
-
Method Details
-
prepareSql
Prepare a SQL INSERT statement along with its bind values for execution.This method constructs the SQL query string based on the provided
Insertobject, which contains the table's metadata, expressions, and rows to be inserted. The bind values are derived from the rows and included in the returnedPreparedSql.- Parameters:
insert- theInsertobject containing the table metadata, expressions, and rows for the SQL INSERT operation- Returns:
- a
PreparedSqlobject containing the generated SQL query string and the list of bind values
-
prepareRow
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
-