Was this page helpful?
Caution
You're viewing documentation for an unstable version of ScyllaDB CPP RS Driver. Switch to the latest stable version.
CassVector¶
-
struct CassVector¶
A fixed-size sequence of values of the same type.
Note that a vector is not a CQL collection: its size is part of its type, its elements cannot be null, and it can only be updated as a whole.
Public Functions
-
CassVector *cass_vector_new(CassValueType element_type, cass_uint16_t dimensions)¶
Creates a new vector with elements of the given native type.
Contrary to a collection or a tuple, a vector is always fully typed: the wire representation of its elements depends on their type, so the element type must be known upfront. For a vector whose elements are not of a native type (a UDT, a tuple, a collection or another vector), build the data type and use cass_vector_new_from_data_type() instead.
Unlike tuple items, vector elements cannot be null, and there is no cass_vector_set_null(). Leaving any element unset results in an error.
See also
- Parameters:
element_type – [in] The value type of the vector’s elements.
dimensions – [in] The number of elements of the vector, which must not be zero.
- Returns:
Returns a vector that must be freed. NULL is returned if
element_typeis not a native value type ordimensionsis zero.
-
CassVector *cass_vector_new_from_data_type(const CassDataType *data_type)¶
Creates a new vector from an existing data type.
See also
- Parameters:
data_type – [in]
- Returns:
Returns a vector that must be freed. NULL is returned if the data type is not a vector.
-
void cass_vector_free(CassVector *vector)¶
Frees a vector instance.
- Parameters:
vector – [in]
-
const CassDataType *cass_vector_data_type(const CassVector *vector)¶
Gets the data type of a vector.
- Parameters:
vector – [in]
- Returns:
Returns a reference to the data type of the vector. Do not free this reference as it is bound to the lifetime of the vector.
-
CassError cass_vector_set_int8(CassVector *vector, size_t index, cass_int8_t value)¶
Sets a “tinyint” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_int16(CassVector *vector, size_t index, cass_int16_t value)¶
Sets an “smallint” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_int32(CassVector *vector, size_t index, cass_int32_t value)¶
Sets an “int” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_uint32(CassVector *vector, size_t index, cass_uint32_t value)¶
Sets a “date” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_int64(CassVector *vector, size_t index, cass_int64_t value)¶
Sets a “bigint”, “counter”, “timestamp” or “time” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_float(CassVector *vector, size_t index, cass_float_t value)¶
Sets a “float” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_double(CassVector *vector, size_t index, cass_double_t value)¶
Sets a “double” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_bool(CassVector *vector, size_t index, cass_bool_t value)¶
Sets a “boolean” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_string(CassVector *vector, size_t index, const char *value)¶
Sets an “ascii”, “text” or “varchar” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in] The value is copied into the vector object; the memory pointed to by this parameter can be freed after this call.
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_string_n(CassVector *vector, size_t index, const char *value, size_t value_length)¶
Same as cass_vector_set_string(), but with lengths for string parameters.
See also
- Parameters:
vector – [in]
index – [in]
value – [in]
value_length – [in]
- Returns:
same as cass_vector_set_string()
-
CassError cass_vector_set_bytes(CassVector *vector, size_t index, const cass_byte_t *value, size_t value_size)¶
Sets a “blob”, “varint” or “custom” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in] The value is copied into the vector object; the memory pointed to by this parameter can be freed after this call.
value_size – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_uuid(CassVector *vector, size_t index, CassUuid value)¶
Sets a “uuid” or “timeuuid” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_inet(CassVector *vector, size_t index, CassInet value)¶
Sets an “inet” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_decimal(CassVector *vector, size_t index, const cass_byte_t *varint, size_t varint_size, cass_int32_t scale)¶
Sets a “decimal” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
varint – [in] The value is copied into the vector object; the memory pointed to by this parameter can be freed after this call.
varint_size – [in]
scale – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_duration(CassVector *vector, size_t index, cass_int32_t months, cass_int32_t days, cass_int64_t nanos)¶
Sets a “duration” in a vector at the specified index.
Requires Apache Cassandra: 3.10+
- Parameters:
vector – [in]
index – [in]
months – [in]
days – [in]
nanos – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_collection(CassVector *vector, size_t index, const CassCollection *value)¶
Sets a “list”, “map” or “set” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_tuple(CassVector *vector, size_t index, const CassTuple *value)¶
Sets a “tuple” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_user_type(CassVector *vector, size_t index, const CassUserType *value)¶
Sets a “udt” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassError cass_vector_set_vector(CassVector *vector, size_t index, const CassVector *value)¶
Sets a “vector” in a vector at the specified index.
- Parameters:
vector – [in]
index – [in]
value – [in]
- Returns:
CASS_OK if successful, otherwise an error occurred.
-
CassVector *cass_vector_new(CassValueType element_type, cass_uint16_t dimensions)¶