Enum Constant and Description |
---|
CURRENT
Updates the data of the record at the cursor position.
|
NO_DUP_DATA
Inserts a record in a database with duplicate keys if a record with a
matching key and data is not already present.
|
NO_OVERWRITE
Inserts a record if a record with a matching key is not already present.
|
OVERWRITE
Inserts or updates a record depending on whether a matching record is
already present.
|
Modifier and Type | Method and Description |
---|---|
static Put |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Put[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Put OVERWRITE
If the database does not have duplicate keys, a matching record is defined as one with the same key. The existing record's data will be replaced. In addition, if a custom key comparator is configured, and the key bytes are different but considered equal by the comparator, the key is replaced.
If the database does have duplicate keys, a matching record is defined as one with the same key and data. As above, if a custom key comparator is configured, and the key bytes are different but considered equal by the comparator, the key is replaced. In addition, if a custom duplicate comparator is configured, and the data bytes are different but considered equal by the comparator, the data is replaced.
The operation always succeeds (null is never returned).
public static final Put NO_OVERWRITE
If the database has duplicate keys, a record is inserted only if there are no records with a matching key.
The operation does not succeed (null is returned) when an existing record matches.
public static final Put NO_DUP_DATA
This operation is not allowed for databases that do not have duplicate keys.
The operation does not succeed (null is returned) when an existing record matches.
public static final Put CURRENT
If the database does not have duplicate keys, the existing record's data will be replaced.
If the database does have duplicate keys, the existing data is
replaced but it is must be considered equal by the duplicate comparator.
If the data is not considered equal, DuplicateDataException
is
thrown. Using the default comparator, a key is considered equal only if
its bytes are equal. Therefore, changing the data is only possible if a
custom duplicate comparator is configured.
A partial data item may be specified to optimize for partial data update.
This operation cannot be used to update the key of an existing record
and in fact the key parameter must be null when calling generic put
methods such as
Database.put(Transaction, DatabaseEntry, DatabaseEntry, Put,
WriteOptions)
and
Cursor.put(DatabaseEntry, DatabaseEntry, Put, WriteOptions)
.
The operation does not succeed (null is returned) if the record at the current position has been deleted. This can occur in two cases: 1. If the record was deleted using this cursor and then accessed. 2. If the record was not locked by this cursor or transaction, and was deleted by another thread or transaction after this cursor was positioned on it.
public static Put[] values()
for (Put c : Put.values()) System.out.println(c);
public static Put valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullCopyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.