libQtCassandra 0.3.2

QtCassandra::QCassandraColumnNamePredicate Class Reference

A column predicate using a list of column names. More...

#include <QCassandraColumnPredicate.h>

Inheritance diagram for QtCassandra::QCassandraColumnNamePredicate:
Collaboration diagram for QtCassandra::QCassandraColumnNamePredicate:

List of all members.

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 QCassandraColumnKeyscolumnKeys () 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.

Detailed Description

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.


Member Typedef Documentation

This array is used to save the column keys.

Definition at line 77 of file QCassandraColumnPredicate.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
[in]column_keyAdd 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.

Parameters:
[in]column_nameAdd 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.

Returns:
A constant reference to the array of column keys.

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.

Returns:
The current consistency level.
See also:
setConsistencyLevel()
QCassandra::setConsistencyLevel()

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.

Parameters:
[in]consistency_levelOne of the consistency levels.
See also:
consistencyLevel()

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.

Parameters:
[in]dataThe pointer to the SlicePredicate to setup.

Reimplemented from QtCassandra::QCassandraColumnPredicate.

Definition at line 262 of file QCassandraColumnPredicate.cpp.

References f_column_keys.


Member Data Documentation

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This document is part of the libQtCassandra Project.

Copyright by Made to Order Software Corp.