java.lang.Object
java.lang.Record
org.litebridgedb.db.spi.update.Insert
- Record Components:
table- The target table for the insertion operation.columns- The list of columns involved in the insertion operation.rows- The list of rows to be inserted.returnGeneratedKeys- If true, generated keys will be returned after the insert operation.
- All Implemented Interfaces:
UpdateStatement
public record Insert(Table table, List<Column> columns, List<RowValue> rows, boolean returnGeneratedKeys)
extends Record
implements UpdateStatement
A SQL INSERT statement targeting specific table metadata with associated columns and rows of values.
This class is a record that combines:
- A target
TableMetaDatafor the insertion - A list of
ColumnMetaDatarepresenting the columns involved in the insertion - A list of
RowValuerepresenting the rows to be inserted
This class also provides constructors for creating instances with either a single row or multiple rows of data, automatically populating column information based on the rows provided.
Instances of this class are immutable and serve as part of the structure for building SQL update operations targeting a database.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncolumns()Returns the value of thecolumnsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thereturnGeneratedKeysrecord component.rows()Returns the value of therowsrecord component.table()Returns the value of thetablerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Insert
-
Insert
-
Insert
Creates an instance of aInsertrecord class.- Parameters:
table- the value for thetablerecord componentcolumns- the value for thecolumnsrecord componentrows- the value for therowsrecord componentreturnGeneratedKeys- the value for thereturnGeneratedKeysrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
table
Returns the value of thetablerecord component.- Specified by:
tablein interfaceUpdateStatement- Returns:
- the value of the
tablerecord component
-
columns
Returns the value of thecolumnsrecord component.- Returns:
- the value of the
columnsrecord component
-
rows
Returns the value of therowsrecord component.- Returns:
- the value of the
rowsrecord component
-
returnGeneratedKeys
public boolean returnGeneratedKeys()Returns the value of thereturnGeneratedKeysrecord component.- Returns:
- the value of the
returnGeneratedKeysrecord component
-