|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
R
- The record type of the table being inserted intopublic interface InsertQuery<R extends Record>
A query for data insertion
Method Summary | ||
---|---|---|
void |
addRecord(R record)
Short for calling
newRecord();
setRecord(record);
|
|
|
addValueForUpdate(Field<T> field,
Field<T> value)
Add a value to the ON DUPLICATE KEY UPDATE clause of this
INSERT statement, where this is supported. |
|
|
addValueForUpdate(Field<T> field,
T value)
Add a value to the ON DUPLICATE KEY UPDATE clause of this
INSERT statement, where this is supported. |
|
void |
addValuesForUpdate(Map<? extends Field<?>,?> map)
Add multiple values to the ON DUPLICATE KEY UPDATE clause of
this INSERT statement, where this is supported. |
|
R |
getReturnedRecord()
The record holding returned values as specified by any of the setReturning() methods. |
|
Result<R> |
getReturnedRecords()
The records holding returned values as specified by any of the setReturning() methods. |
|
void |
newRecord()
Adds a new Record to the insert statement for multi-record inserts Calling this method will cause subsequent calls to StoreQuery.addValue(Field, Object) (and similar) to fill the next record. |
|
void |
onDuplicateKeyUpdate(boolean flag)
Whether a ON DUPLICATE KEY UPDATE clause should be added to
this INSERT statement. |
|
void |
setReturning()
Configure the INSERT statement to return all fields in
R . |
|
void |
setReturning(Collection<? extends Field<?>> fields)
Configure the INSERT statement to return a list of fields in
R . |
|
void |
setReturning(Field<?>... fields)
Configure the INSERT statement to return a list of fields in
R . |
|
void |
setReturning(Identity<R,? extends Number> identity)
Configure the INSERT statement to return the generated
identity value. |
Methods inherited from interface org.jooq.StoreQuery |
---|
addValue, addValue, addValueAsArray, addValueAsArray, addValues, setRecord |
Methods inherited from interface org.jooq.Query |
---|
bind, bind, execute, getBindValues, getParam, getParams, getSQL, getSQL |
Methods inherited from interface org.jooq.Attachable |
---|
attach |
Methods inherited from interface org.jooq.Adapter |
---|
internalAPI |
Method Detail |
---|
void newRecord()
Calling this method will cause subsequent calls to
StoreQuery.addValue(Field, Object)
(and similar) to fill the next record.
If this call is not followed by StoreQuery.addValue(Field, Object)
calls,
then this call has no effect.
If this call is done on a fresh insert statement (without any values yet), then this call has no effect either.
void addRecord(R record)
newRecord();
setRecord(record);
record
- The record to add to this insert statement.void onDuplicateKeyUpdate(boolean flag)
ON DUPLICATE KEY UPDATE
clause should be added to
this INSERT
statement.
InsertOnDuplicateStep.onDuplicateKeyUpdate()
<T> void addValueForUpdate(Field<T> field, T value)
ON DUPLICATE KEY UPDATE
clause of this
INSERT
statement, where this is supported.
InsertOnDuplicateStep.onDuplicateKeyUpdate()
<T> void addValueForUpdate(Field<T> field, Field<T> value)
ON DUPLICATE KEY UPDATE
clause of this
INSERT
statement, where this is supported.
InsertOnDuplicateStep.onDuplicateKeyUpdate()
void addValuesForUpdate(Map<? extends Field<?>,?> map)
ON DUPLICATE KEY UPDATE
clause of
this INSERT
statement, where this is supported.
Please assure that key/value pairs have matching <T>
types. Values can either be of type <T>
or
Field<T>
InsertOnDuplicateStep.onDuplicateKeyUpdate()
void setReturning()
INSERT
statement to return all fields in
R
.
getReturnedRecords()
void setReturning(Identity<R,? extends Number> identity)
INSERT
statement to return the generated
identity value.
identity
- The table's identitygetReturnedRecords()
void setReturning(Field<?>... fields)
INSERT
statement to return a list of fields in
R
.
fields
- Fields to be returnedgetReturnedRecords()
void setReturning(Collection<? extends Field<?>> fields)
INSERT
statement to return a list of fields in
R
.
fields
- Fields to be returnedgetReturnedRecords()
R getReturnedRecord()
setReturning()
methods.
If the insert statement returns several records, this is the same as
calling getReturnedRecords().get(0)
This implemented differently for every dialect:
INSERT .. RETURNING
clauses@@identity
or last_inserted_rowid()
values.
Those values are fetched in a separate SELECT
statement. If
other fields are requested, a second statement is issued. Client code
must assure transactional integrity between the two statements.
getReturnedRecords()
Result<R> getReturnedRecords()
setReturning()
methods.
This implemented differently for every dialect:
INSERT .. RETURNING
clauses@@identity
or last_inserted_rowid()
values.
Those values are fetched in a separate SELECT
statement. If
other fields are requested, a second statement is issued. Client code
must assure transactional integrity between the two statements.This currently only works well for DB2, HSQLDB, MySQL, and Postgres
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |