T
- The type of object being processed.public class InsertRecordsRequest<T> extends Object
GPUdb.insertRecords(InsertRecordsRequest)
.
Adds multiple records to the specified table. The operation is synchronous, meaning that a response will not be returned until all the records are fully inserted and available. The response payload provides the counts of the number of records actually inserted and/or updated, and can provide the unique identifier of each added record.
The options
parameter can be used to customize this function's
behavior.
The update_on_existing_pk
option specifies the record collision
policy for inserting into a table with a primary key, but is ignored if no primary key exists.
The return_record_ids
option indicates that the database should
return the unique identifiers of inserted records.
Modifier and Type | Class and Description |
---|---|
static class |
InsertRecordsRequest.Options
Optional parameters.
|
Constructor and Description |
---|
InsertRecordsRequest()
Constructs an InsertRecordsRequest object with default parameters.
|
InsertRecordsRequest(String tableName,
List<T> data,
Map<String,String> options)
Constructs an InsertRecordsRequest object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
List<T> |
getData() |
Map<String,String> |
getOptions() |
String |
getTableName() |
int |
hashCode() |
InsertRecordsRequest<T> |
setData(List<T> data) |
InsertRecordsRequest<T> |
setOptions(Map<String,String> options) |
InsertRecordsRequest<T> |
setTableName(String tableName) |
String |
toString() |
public InsertRecordsRequest()
public InsertRecordsRequest(String tableName, List<T> data, Map<String,String> options)
tableName
- Table to which the records are to be added. Must be an
existing table.data
- An array of binary-encoded data for the records to be
added. All records must be of the same type as that of the
table. Empty array if listEncoding
is json
.options
- Optional parameters.
UPDATE_ON_EXISTING_PK
: Specifies the record collision
policy for inserting into a table with a primary key. If set to true
,
any existing table record with primary key values that
match those of a record being inserted will be replaced
by that new record. If set to false
, any
existing table record with primary key values that match
those of a record being inserted will remain unchanged
and the new record discarded. If the specified table
does not have a primary key, then this option is
ignored.
Supported values:
The default value is FALSE
.
RETURN_RECORD_IDS
: If true
then return the
internal record id along for each inserted record.
Supported values:
The default value is FALSE
.
Map
.public String getTableName()
public InsertRecordsRequest<T> setTableName(String tableName)
tableName
- Table to which the records are to be added. Must be an
existing table.this
to mimic the builder pattern.public List<T> getData()
listEncoding
is json
.public InsertRecordsRequest<T> setData(List<T> data)
data
- An array of binary-encoded data for the records to be
added. All records must be of the same type as that of the
table. Empty array if listEncoding
is json
.this
to mimic the builder pattern.public Map<String,String> getOptions()
UPDATE_ON_EXISTING_PK
: Specifies the record collision policy
for inserting into a table with a primary key. If set to true
, any
existing table record with primary key values that match those
of a record being inserted will be replaced by that new record.
If set to false
, any existing table record with primary
key values that match those of a record being inserted will
remain unchanged and the new record discarded. If the specified
table does not have a primary key, then this option is ignored.
Supported values:
The default value is FALSE
.
RETURN_RECORD_IDS
: If true
then return the internal
record id along for each inserted record.
Supported values:
The default value is FALSE
.
Map
.public InsertRecordsRequest<T> setOptions(Map<String,String> options)
options
- Optional parameters.
UPDATE_ON_EXISTING_PK
: Specifies the record collision
policy for inserting into a table with a primary key. If set to true
,
any existing table record with primary key values that
match those of a record being inserted will be replaced
by that new record. If set to false
, any
existing table record with primary key values that match
those of a record being inserted will remain unchanged
and the new record discarded. If the specified table
does not have a primary key, then this option is
ignored.
Supported values:
The default value is FALSE
.
RETURN_RECORD_IDS
: If true
then return the
internal record id along for each inserted record.
Supported values:
The default value is FALSE
.
Map
.this
to mimic the builder pattern.Copyright © 2019. All rights reserved.