public class Insert extends BuiltStatement
Modifier and Type | Class and Description |
---|---|
static class |
Insert.Options
The options of an INSERT statement.
|
idempotent, NULL_PAYLOAD_VALUE
Modifier and Type | Method and Description |
---|---|
Insert |
ifNotExists()
Sets the 'IF NOT EXISTS' option for this INSERT statement.
|
Insert.Options |
using()
Returns the options for this INSERT statement.
|
Insert.Options |
using(Using using)
Adds a new options for this INSERT statement.
|
Insert |
value(String name,
Object value)
Adds a column/value pair to the values inserted by this INSERT statement.
|
Insert |
values(List<String> names,
List<Object> values)
Adds multiple column/value pairs to the values inserted by this INSERT statement.
|
Insert |
values(String[] names,
Object[] values)
Adds multiple column/value pairs to the values inserted by this INSERT statement.
|
escapeId, getKeyspace, getQueryString, getRoutingKey, getValues, hasValues, isIdempotent, setForceNoValues, toString
disableTracing, enableTracing, getConsistencyLevel, getDefaultTimestamp, getFetchSize, getRetryPolicy, getSerialConsistencyLevel, isTracing, setConsistencyLevel, setDefaultTimestamp, setFetchSize, setIdempotent, setOutgoingPayload, setPagingState, setPagingStateUnsafe, setRetryPolicy, setSerialConsistencyLevel
public Insert value(String name, Object value)
name
- the name of the column to insert/update.value
- the value to insert/update for name
.public Insert values(String[] names, Object[] values)
names
- a list of column names to insert/update.values
- a list of values to insert/update. The i
th
value in values
will be inserted for the i
th column
in names
.IllegalArgumentException
- if names.length != values.length
.public Insert values(List<String> names, List<Object> values)
names
- a list of column names to insert/update.values
- a list of values to insert/update. The i
th
value in values
will be inserted for the i
th column
in names
.IllegalArgumentException
- if names.size() != values.size()
.public Insert.Options using(Using using)
using
- the option to add.public Insert.Options using()
Insert.Options.and(Using)
to add options.public Insert ifNotExists()
An insert with that option will not succeed unless the row does not exist at the time the insertion is execution. The existence check and insertions are done transactionally in the sense that if multiple clients attempt to create a given row with this option, then at most one may succeed.
Please keep in mind that using this option has a non negligible performance impact and should be avoided when possible.
Copyright © 2012–2015. All rights reserved.