public interface Row extends GettableData
ResultSet
.
The values of a CQL Row can be retrieved by either index (index starts at zero) or name. When
getting them by name, names follow the case insensitivity rules explained in ColumnDefinitions
.
Modifier and Type | Method and Description |
---|---|
ColumnDefinitions |
getColumnDefinitions()
Returns the columns contained in this Row.
|
Token |
getPartitionKeyToken()
Returns the value of the first column containing a
Token . |
Token |
getToken(int i)
Returns the
i th value of this row as a Token . |
Token |
getToken(String name)
Returns the value of column
name as a Token . |
get, get, get, getBool, getByte, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getShort, getString, getTime, getTimestamp, getTupleValue, getUDTValue, getUUID, getVarint, isNull
get, get, get, getBool, getByte, getBytes, getBytesUnsafe, getDate, getDecimal, getDouble, getFloat, getInet, getInt, getList, getList, getLong, getMap, getMap, getObject, getSet, getSet, getShort, getString, getTime, getTimestamp, getTupleValue, getUDTValue, getUUID, getVarint, isNull
ColumnDefinitions getColumnDefinitions()
Token getToken(int i)
i
th value of this row as a Token
.
getPartitionKeyToken()
should generally be preferred to this method (unless the
token column is aliased).
i
- the index (0 <= i < size()
) of the column to retrieve.i
th column in this row as an Token.IndexOutOfBoundsException
- if i < 0 || i >= this.columns().size()
.InvalidTypeException
- if column i
is not of the type of token values for this
cluster (this depends on the configured partitioner).Token getToken(String name)
name
as a Token
.
getPartitionKeyToken()
should generally be preferred to this method (unless the
token column is aliased).
name
- the name of the column to retrieve.name
as a Token.IllegalArgumentException
- if name
is not part of the ResultSet this row is part
of, i.e. if !this.columns().names().contains(name)
.InvalidTypeException
- if column name
is not of the type of token values for this
cluster (this depends on the configured partitioner).Token getPartitionKeyToken()
Token
.
This method is a shorthand for queries returning a single token in an unaliased column. It
will look for the first name matching token(...)
:
ResultSet rs = session.execute("SELECT token(k) FROM my_table WHERE k = 1");
Token token = rs.one().getPartitionKeyToken(); // retrieves token(k)
If that doesn't work for you (for example, if you're using an alias), use getToken(int)
or getToken(String)
.name
as a Token.IllegalStateException
- if no column named token(...)
exists in this ResultSet.InvalidTypeException
- if the first column named token(...)
is not of the type of
token values for this cluster (this depends on the configured partitioner).Copyright © 2012–2020. All rights reserved.