libQtCassandra 0.3.2
|
A column predicate using a list of column names. More...
#include <QCassandraColumnPredicate.h>
Public Types | |
typedef QVector< QByteArray > | QCassandraColumnKeys |
A map of column keys. | |
Public Member Functions | |
QCassandraColumnNamePredicate () | |
Initializes a column name predicate. | |
void | addColumnKey (const QByteArray &column_key) |
Add a column key. | |
void | addColumnName (const QString &column_name) |
Add a column name. | |
void | clearColumns () |
This function can be used to clear all the column names. | |
const QCassandraColumnKeys & | columnKeys () const |
Retrieve the complete array of column names. | |
consistency_level_t | consistencyLevel () const |
Retrieve the consistency level. | |
void | setConsistencyLevel (consistency_level_t consistency_level) |
Set the consistency level. | |
Private Member Functions | |
virtual void | toPredicate (void *data) const |
Transform to a Thrift predicate. | |
Private Attributes | |
QCassandraColumnKeys | f_column_keys |
The named columns to return. |
This class defines a list of binary column keys that will be returned when reading a list of columns in a row.
Definition at line 74 of file QCassandraColumnPredicate.h.
This array is used to save the column keys.
Definition at line 77 of file QCassandraColumnPredicate.h.
QtCassandra::QCassandraColumnNamePredicate::QCassandraColumnNamePredicate | ( | ) |
This function initializes a column name predicate.
By default, all the columns of a table are returned. If you add column names, then only those columns are returned. This predicate is used to specify the exact column names you want to retrieve.
Definition at line 186 of file QCassandraColumnPredicate.cpp.
void QtCassandra::QCassandraColumnNamePredicate::addColumnKey | ( | const QByteArray & | column_key | ) |
This function adds a binary column key to the list of columns to return when using this predicate.
This predicate is used to define the exact binary column keys to retrieve. It is particularly useful to read a set of columns in a row.
[in] | column_key | Add a column key to the predicate. |
Definition at line 228 of file QCassandraColumnPredicate.cpp.
References f_column_keys.
Referenced by addColumnName().
void QtCassandra::QCassandraColumnNamePredicate::addColumnName | ( | const QString & | column_name | ) |
This function adds a column name to the list of columns to return when using this predicate.
This predicate is used to define the exact column names to retrieve. It is particularly useful to read a set of columns in a row.
[in] | column_name | Add a column name to the predicate. |
Definition at line 213 of file QCassandraColumnPredicate.cpp.
References addColumnKey().
void QtCassandra::QCassandraColumnNamePredicate::clearColumns | ( | ) |
This function can be used to clear all the column names you added to this column name predicate. This way you can reuse the same column name predicate for multiple queries.
Definition at line 198 of file QCassandraColumnPredicate.cpp.
References f_column_keys.
const QCassandraColumnNamePredicate::QCassandraColumnKeys & QtCassandra::QCassandraColumnNamePredicate::columnKeys | ( | ) | const |
This function returns a constant reference to the column keys saved in this predicate.
Note that if you call one of the add functions or the clear function, the list may become undefined.
Definition at line 246 of file QCassandraColumnPredicate.cpp.
References f_column_keys.
consistency_level_t QtCassandra::QCassandraColumnPredicate::consistencyLevel | ( | ) | const [inherited] |
This function returns the current consistency level defined in this column predicate. By default it is set to DEFAULT. You may want to change it with a call to the setConsistencyLevel() function.
To setup the default consistency, see the setConsistencyLevel() function of your QCassandra object.
Definition at line 106 of file QCassandraColumnPredicate.cpp.
References QtCassandra::QCassandraColumnPredicate::f_consistency_level.
Referenced by QtCassandra::QCassandraPrivate::getCellCount(), and QtCassandra::QCassandraPrivate::getColumnSlice().
void QtCassandra::QCassandraColumnPredicate::setConsistencyLevel | ( | consistency_level_t | consistency_level | ) | [inherited] |
This function changes the consistency level you want to use when you use this predicate.
The consistency levels are probably better on the Cassandra system. The default is ONE and the usual best choice is QUORUM.
[in] | consistency_level | One of the consistency levels. |
Definition at line 123 of file QCassandraColumnPredicate.cpp.
References QtCassandra::QCassandraColumnPredicate::f_consistency_level.
void QtCassandra::QCassandraColumnNamePredicate::toPredicate | ( | void * | data | ) | const [private, virtual] |
This function is used to transform a QCassandraColumnNamePredicate object to a Cassandra SlicePredicate structure.
The input parameter is set to void * because the function is defined in the public header file and thus cannot directly make use of the Thrift type definitions.
[in] | data | The pointer to the SlicePredicate to setup. |
Reimplemented from QtCassandra::QCassandraColumnPredicate.
Definition at line 262 of file QCassandraColumnPredicate.cpp.
References f_column_keys.
This parameter is a list of binary column keys. The number of column names is not limited although you may want to limit the number of columns read at once and use a slice instead.
Definition at line 89 of file QCassandraColumnPredicate.h.
Referenced by addColumnKey(), clearColumns(), columnKeys(), and toPredicate().
This document is part of the libQtCassandra Project.
Copyright by Made to Order Software Corp.