libQtCassandra: QtCassandra::QCassandraRow Class Reference

QtCassandra::QCassandraRow Class Reference

The row class to hold a set of cells. More...

#include <include/QtCassandra/QCassandraRow.h>

Inheritance diagram for QtCassandra::QCassandraRow:
Collaboration diagram for QtCassandra::QCassandraRow:

List of all members.

Public Types

typedef QVector< QCassandraValuecomposite_column_names_t
 The set of column names.

Public Member Functions

virtual ~QCassandraRow ()
 Clean up the QCassandraRow object.

QSharedPointer< QCassandraCellcell (const char *column_name)
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellcell (const wchar_t *column_name)
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellcell (const QString &column_name)
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellcell (const QUuid &column_name)
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellcell (const QByteArray &column_key)
 Retrieve a cell from the row.

int cellCount (const QCassandraColumnPredicate &column_predicate=QCassandraColumnPredicate())
 Retrieve the number of cells defined in this row.

const QCassandraCellscells () const
 Retrieve the map of cells.

void clearCache ()
 Clear the cached cells.

QCassandraCellcompositeCell (const composite_column_names_t &composite_names)
 Retrieve a cell from the row.

const QCassandraCellcompositeCell (const composite_column_names_t &composite_names) const
 Retrieve a cell from the row.

void dropCell (const char *column_name, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0)
 Drop the named cell.

void dropCell (const wchar_t *column_name, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0)
 Drop the named cell.

void dropCell (const QString &column_name, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0)
 Drop the named cell.

void dropCell (const QUuid &column_name, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0)
 Drop the named cell.

void dropCell (const QByteArray &column_key, QCassandraValue::timestamp_mode_t mode=QCassandraValue::TIMESTAMP_MODE_AUTO, int64_t timestamp=0)
 Drop the specified cell from the Cassandra database.

bool exists (const char *column_name) const
 Check whether a cell exists in this row.

bool exists (const wchar_t *column_name) const
 Check whether a cell exists in this row.

bool exists (const QString &column_name) const
 Check whether a cell exists in this row.

bool exists (const QUuid &column_name) const
 Check whether a cell exists in this row.

bool exists (const QByteArray &column_key) const
 Check whether a cell exists in this row.

QSharedPointer< QCassandraCellfindCell (const char *column_name) const
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellfindCell (const wchar_t *column_name) const
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellfindCell (const QString &column_name) const
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellfindCell (const QUuid &column_name) const
 Retrieve a cell from the row.

QSharedPointer< QCassandraCellfindCell (const QByteArray &column_key) const
 Retrieve a cell from the row.

QCassandraCelloperator[] (const char *column_name)
 Retrieve a cell from the row.

QCassandraCelloperator[] (const wchar_t *column_name)
 Retrieve a cell from the row.

QCassandraCelloperator[] (const QString &column_name)
 Retrieve a cell from the row.

QCassandraCelloperator[] (const QUuid &column_name)
 Retrieve a cell from the row.

QCassandraCelloperator[] (const QByteArray &column_key)
 Retrieve a cell from the row.

const QCassandraCelloperator[] (const char *column_name) const
 Retrieve a cell from the row.

const QCassandraCelloperator[] (const wchar_t *column_name) const
 Retrieve a cell from the row.

const QCassandraCelloperator[] (const QString &column_name) const
 Retrieve a cell from the row.

const QCassandraCelloperator[] (const QUuid &column_name) const
 Retrieve a cell from the row.

const QCassandraCelloperator[] (const QByteArray &column_key) const
 Retrieve a cell from the row.

void readCells ()
 Read the cells as defined by a default column predicate.

void readCells (QCassandraColumnPredicate &column_predicate)
 Read the cells as defined by the predicate.

const QByteArray & rowKey () const
 Retrieve the row key.

QString rowName () const
 Retrieve the name of the row.

Private Member Functions

 QCassandraRow (QCassandraTable *table, const QByteArray &row_key)
 Initialize a QCassandraRow object.

void addValue (const QByteArray &column_key, int64_t value)
 Add a value to a Cassandra counter.

bool getValue (const QByteArray &column_key, QCassandraValue &value)
 Get a cell value from Cassandra.

void insertValue (const QByteArray &column_key, const QCassandraValue &value)
 Save a cell value that changed.

void unparent ()
 This internal function marks the row as unusable.

Private Attributes

QCassandraCells f_cells
 The array of cells defined in this row.

QByteArray f_key
 The binary key of the row.

QCassandraTablef_table
 The table this row is part of.

Friends

class QCassandraCell
class QCassandraTable

Detailed Description

These objects are created by the QCassandraTable whenever data is being read or written to a cell. Rows have a binary key (may be set as a UTF-8 string) and a map of cells indexed by the names of the cells.

The name of a row is limited to nearly 64Kb. Although, if you have a table with very long names, you may want to consider computing an md5sum or equivalent. This is important if you want to avoid slowing down the Cassandra server. Searching through a large set of 60Kb keys is much slower than doing the same through their md5sums. Of course, that means you lose the automatic sorting of the original key.

By default, most of the functions will create a new cell. If you need to test the existance without creating a cell, use the exists() function with the column name of the cell check out.

See also:
exists()

Definition at line 49 of file QCassandraRow.h.


Member Typedef Documentation

This type is used to declare a set of composite column names as used by the compositeCell() functions.

The type simply defines an array of column names. Each name can be any valid column name key. In other words, a QCassandraValue with any value. However, to be compatible with CQL and the CLI and possibly other Cassandra features, you want to limit your names to things that do not include the colon characters. The CQL and CLI make use of names separated by colons (i.e. "blah:foo:123".) However, the Cassandra cluster itself has no limit to the content of the names except for their length which is 65536 bytes each.

Definition at line 52 of file QCassandraRow.h.


Constructor & Destructor Documentation

This function ensures that all resources allocated by the QCassandraRow are released.

Definition at line 146 of file QCassandraRow.cpp.

QtCassandra::QCassandraRow::QCassandraRow ( QCassandraTable table,
const QByteArray &  row_key 
) [private]

This function initializes a QCassandraRow object. You must specify the key of the row and that's the only parameter that a row supports at this time.

The key of the row is a binary buffer of data. It must be at least 1 byte and at most 64Kb minus 1 (65535 bytes).

A row is composed of multiple cells (called columns in Cassandra.)

Exceptions:
std::runtime_errorThe key of the row cannot be empty or more than 64Kb. If that happens, this exception is raised.
Parameters:
[in]tableThe parent table of this row.
[in]row_keyThe key of this row.

Definition at line 128 of file QCassandraRow.cpp.

References f_key.


Member Function Documentation

void QtCassandra::QCassandraRow::addValue ( const QByteArray &  column_key,
int64_t  value 
) [private]

This function calls the table addValue() function to add the specified value to the Cassandra counter that is defined in a cell.

If the cell counter does not exist yet, then value is set to the specified value.

Parameters:
[in]column_keyThe key used to identify the column.
[in]valueTo value to add to this counter.

Definition at line 1153 of file QCassandraRow.cpp.

References QtCassandra::QCassandraTable::addValue(), f_key, and f_table.

Referenced by QtCassandra::QCassandraCell::add().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::cell ( const char *  column_name)

This function retrieves a cell from this row. If the cell does not exist, it is created.

Note that the cell is not saved in the Cassandra database unless you save a value in it (and assuming the context does not only exist in memory.)

This function accepts a column name as UTF-8 which is used directly to access Cassandra.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 281 of file QCassandraRow.cpp.

Referenced by cell(), compositeCell(), dropCell(), exists(), and operator[]().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::cell ( const wchar_t *  column_name)

This function retrieves a cell from this row. If the cell does not exist, it is created.

Note that the cell is not saved in the Cassandra database unless you save a value in it (and assuming the context does not only exist in memory.)

This function accepts a column name. The input is either UCS-4 (most Unix) or UCS-2 (MS-Windows). It will be converted to UTF-8 when accessing the Cassandra database.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 303 of file QCassandraRow.cpp.

References cell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::cell ( const QString &  column_name)

This function retrieves a cell from this row. If the cell does not exist, it is created.

Note that the cell is not saved in the Cassandra database unless you save a value in it (and assuming the context does not only exist in memory.)

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 324 of file QCassandraRow.cpp.

References cell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::cell ( const QUuid &  column_uuid)

This function retrieves a cell from this row. If the cell does not exist, it is created.

Note that the cell is not saved in the Cassandra database unless you save a value in it (and assuming the context does not only exist in memory.)

This function accepts a UUID as the name of the column.

Parameters:
[in]column_uuidThe name of the column referencing this cell in the form of a UUID.
Returns:
A shared pointer to the cell.

Definition at line 344 of file QCassandraRow.cpp.

References cell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::cell ( const QByteArray &  column_key)

This function retrieves a cell from this row. If the cell does not exist, it is created.

Note that the cell is not saved in the Cassandra database unless you save a value in it (and assuming the context does not only exist in memory.)

This function makes use of a binary key to reference the cell.

Note:
This function cannot be used to read a composite column unless you know how to build the QByteArray to do so. I suggest you use the compositeCell() function instead.
Parameters:
[in]column_keyThe binary key of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
compositeCell()
compositeCell() const

Definition at line 372 of file QCassandraRow.cpp.

References f_cells, and QCassandraCell.

This function retrieves the number of cells currently defined in this row, depending on the specified predicate (by default, all the cells.)

This counts the number of cells available in the Cassandra database. It may be different from the number of cells in the memory cache. (i.e. the value returned by cells().size())

Parameters:
[in]column_predicateThe predicate used to select which columns to count.
Returns:
The number of cells defined in this row.
See also:
cells()

Definition at line 203 of file QCassandraRow.cpp.

References f_key, f_table, and QtCassandra::QCassandraTable::getCellCount().

This function returns a constant reference to the map of cells defined in the row.

This map does not generally represent all the cells of a row as only those that you already accessed in read or write mode will be defined in memory.

Note:
The order of the cells in memory may not be the same as the order of the cells in the database. This is especially true if the data is not integers. (i.e. floating point numbers, UTF-8 or other encodings with characters that are not ordered in the same order as the bytes representing them, etc.) This also depends on the definition of the type in Cassandra. Positive integers should always be properly sorted. Negative integers may be a problem if you use the "wrong" type in Cassandra. FYI, the order of the map of cells uses the QByteArray < operator.
Warning:
When reading cells from a row representing an index, you probably want to clear the cells already read before the next read. This is done with the clearCache() function. Then cells().isEmpty() returns true if no more cells can be read from the database.
Returns:
The map of cells referenced by column keys.
See also:
clearCache()

Definition at line 414 of file QCassandraRow.cpp.

References f_cells.

This function is used to clear all the cells that were cached in this row.

As a side effect, all the QCassandraCell objects are unparented which means that you cannot use them anymore (doing so raises an exception.)

Definition at line 968 of file QCassandraRow.cpp.

References f_cells.

Referenced by unparent().

This function retrieves a cell with a composite name. If the cell does not exist, it returns an empty buffer (i.e. nullValue() on the returned reference is true, note however that an empty string has the property of returning true when nullValue() is called...)

This function accepts a set of column names defined in QCassandraValue objects. The type of each object ("name") must correspond one to one to the type defined in the ComparatorType of the table. The libQtCassandra library doesn't check to avoid wasting time (otherwise it would need to check for every call, and since Cassandra checks anyway...)

Exceptions:
std::runtime_errorThe name of a column is limited to 64Kb minus 1 (65535 bytes). If larger then this exception is raised. This is because each name has its length passed along in an unsigned short (2 bytes.)
Parameters:
[in]composite_namesAn array of composite names defined as QCassandraValue.
Returns:
A reference to the cell.
See also:
compositeCell() const
cell()
exists()

Definition at line 445 of file QCassandraRow.cpp.

References QtCassandra::appendBinaryValue(), QtCassandra::appendUInt16Value(), QtCassandra::appendUnsignedCharValue(), and cell().

Referenced by compositeCell().

This function is the same as the compositeCell() function with the addition of const-ness.

Parameters:
[in]composite_namesAn array of composite names defined as QCassandraValue.
Returns:
A reference to the cell.
See also:
compositeCell()
cell()
exists()

Definition at line 476 of file QCassandraRow.cpp.

References compositeCell().

void QtCassandra::QCassandraRow::dropCell ( const char *  column_name,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0 
)

This function is the same as the dropCell() that accepts a QByteArray as its column key. It simply calls it after changing the column name into a key.

Parameters:
[in]column_nameThe name of the column to drop.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only cells that are equal or older.

Definition at line 986 of file QCassandraRow.cpp.

Referenced by dropCell().

void QtCassandra::QCassandraRow::dropCell ( const wchar_t *  column_name,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0 
)

This function is the same as the dropCell() that accepts a QByteArray as its column key. It simply calls it after changing the column name into a key.

Parameters:
[in]column_nameThe name of the column to drop.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only cells that are equal or older.

Definition at line 1001 of file QCassandraRow.cpp.

References dropCell().

void QtCassandra::QCassandraRow::dropCell ( const QString &  column_name,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0 
)

This function is the same as the dropCell() that accepts a QByteArray as its column key. It simply calls it after changing the column name into a key.

Parameters:
[in]column_nameThe name of the column to drop.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only cells that are equal or older.

Definition at line 1016 of file QCassandraRow.cpp.

References dropCell().

void QtCassandra::QCassandraRow::dropCell ( const QUuid &  column_uuid,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0 
)

This function is the same as the dropCell() that accepts a QByteArray as its column key. It simply calls it after changing the column name into a key.

Parameters:
[in]column_uuidThe name of the column to drop.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only cells that are equal or older.

Definition at line 1031 of file QCassandraRow.cpp.

References dropCell().

void QtCassandra::QCassandraRow::dropCell ( const QByteArray &  column_key,
QCassandraValue::timestamp_mode_t  mode = QCassandraValue::TIMESTAMP_MODE_AUTO,
int64_t  timestamp = 0 
)

This function deletes the specified cell and its data from the Cassandra database and from memory. To delete the cell immediately you want to set the timestamp to now (i.e. use QCassandra::timeofday() with the DEFINED mode as mentioned below.)

The timestamp mode can be set to QCassandraValue::TIMESTAMP_MODE_DEFINED in which case the value defined in the timestamp parameter is used by the Cassandra remove() function.

By default the mode parameter is set to QCassandraValue::TIMESTAMP_MODE_AUTO which means that the timestamp value of the cell f_value parameter is used. This will not work right if the timestamp of the cell value was never set properly (i.e. you never read the cell from the Cassandra database and never called the setTimestamp() function on the cell value.)

The consistency level of the cell f_value is also passed to the Cassandra remove() function. This means that by default you'll get whatever the default is from your QCassandra object, the default in the value or whatever the value was when you last read the value. To change that default you can retrieve the cell and set the consistency level as follow:

     QSharedPointer<QCassandraCell> c(f_row->cell(f_cell));
     c->setConsistencyLevel(CONSISTENCY_LEVEL_QUORUM);

These 2 lines of code do NOT create the cell in the Cassandra cluster. It only creates it in memory unless it was read earlier in which case the cached copy is returned.

Warning:
The corresponding cell is marked as dropped, whether you kept a shared pointer of that cell does not make it reusable. You must forget about it after this call.
Parameters:
[in]column_keyA shared pointer to the cell to remove.
[in]modeSpecify the timestamp mode.
[in]timestampSpecify the timestamp to remove only cells that are equal or older.
See also:
cell()
QCassandra::timeofday()
QCassandraCell::setConsistencyLevel()

Definition at line 1082 of file QCassandraRow.cpp.

References cell(), f_cells, f_key, f_table, QtCassandra::QCassandraTable::remove(), QtCassandra::QCassandraValue::TIMESTAMP_MODE_AUTO, and QtCassandra::QCassandraValue::TIMESTAMP_MODE_DEFINED.

bool QtCassandra::QCassandraRow::exists ( const char *  column_name) const

The check is happening in memory first. If the cell doesn't exist in memory, then the row checks in the Cassandra database.

Todo:
Look into why a cell is created when just checking for its existance.
Bug:
At this time this function CREATES the cell if it does not yet exist!
Parameters:
[in]column_nameThe column name.
Returns:
true if the cell exists, false otherwise.

Definition at line 632 of file QCassandraRow.cpp.

Referenced by exists().

bool QtCassandra::QCassandraRow::exists ( const wchar_t *  column_name) const

The check is happening in memory first. If the cell doesn't exist in memory, then the row checks in the Cassandra database.

Todo:
Look into why a cell is created when just checking for its existance.
Bug:
At this time this function CREATES the cell if it did not yet exist!
Parameters:
[in]column_nameThe column name.
Returns:
true if the cell exists, false otherwise.

Definition at line 653 of file QCassandraRow.cpp.

References exists().

bool QtCassandra::QCassandraRow::exists ( const QString &  column_name) const

The check is happening in memory first. If the cell doesn't exist in memory, then the row checks in the Cassandra database.

Todo:
Look into why a cell is created when just checking for its existance.
Bug:
At this time this function CREATES the cell if it did not yet exist!
Parameters:
[in]column_nameThe column name.
Returns:
true if the cell exists, false otherwise.

Definition at line 674 of file QCassandraRow.cpp.

References exists().

bool QtCassandra::QCassandraRow::exists ( const QUuid &  column_uuid) const

The check is happening in memory first. If the cell doesn't exist in memory, then the row checks in the Cassandra database.

Todo:
Look into why a cell is created when just checking for its existance.
Bug:
At this time this function CREATES the cell if it did not yet exist!
Parameters:
[in]column_uuidThe column name.
Returns:
true if the cell exists, false otherwise.

Definition at line 695 of file QCassandraRow.cpp.

References exists().

bool QtCassandra::QCassandraRow::exists ( const QByteArray &  column_key) const

The check is happening in memory first. If the cell doesn't exist in memory, then the row checks in the Cassandra database.

Todo:
Look into why a cell is created when just checking for its existance.
Bug:
At this time this function CREATES the cell if it did not yet exist!
Parameters:
[in]column_keyThe column binary key.
Returns:
true if the cell exists, false otherwise.

Definition at line 716 of file QCassandraRow.cpp.

References cell(), f_cells, f_key, f_table, and QtCassandra::QCassandraTable::getValue().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::findCell ( const char *  column_name) const

This function retrieves a cell from this row. If the cell does not exist, it returns a NULL pointer (i.e. isNull() on the shared pointer returns true.)

This function accepts a column name as UTF-8 which is used to retrieve the data from Cassandra.

Warning:
This function does NOT attempt to read the cell from the Cassandra database system. It only checks whether the cell already exists in memory. To check whether the cell exists in the database, use the exists() function instead.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
cell()
exists()

Definition at line 502 of file QCassandraRow.cpp.

Referenced by findCell(), and operator[]().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::findCell ( const wchar_t *  column_name) const

This function retrieves a cell from this row. If the cell does not exist, it returns a NULL pointer (i.e. isNull() on the shared pointer returns true.)

This function accepts a column name. The name is viewed as either UCS-4 (most Unix) or UCS-2 (MS-Windows). It gets converted to UTF-8 which is used to retrieve the data from Cassandra.

Warning:
This function does NOT attempt to read the cell from the Cassandra database system. It only checks whether the cell already exists in memory. To check whether the cell exists in the database, use the exists() function instead.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
cell()
exists()

Definition at line 529 of file QCassandraRow.cpp.

References findCell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::findCell ( const QString &  column_name) const

This function retrieves a cell from this row. If the cell does not exist, it returns a NULL pointer (i.e. isNull() on the shared pointer returns true.)

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Warning:
This function does NOT attempt to read the cell from the Cassandra database system. It only checks whether the cell already exists in memory. To check whether the cell exists in the database, use the exists() function instead.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
cell()
exists()

Definition at line 555 of file QCassandraRow.cpp.

References findCell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::findCell ( const QUuid &  column_uuid) const

This function retrieves a cell from this row. If the cell does not exist, it returns a NULL pointer (i.e. isNull() on the shared pointer returns true.)

This function accepts a column name as a UUID. The binary version of the UUID is used to retrieve the data from Cassandra.

Warning:
This function does NOT attempt to read the cell from the Cassandra database system. It only checks whether the cell already exists in memory. To check whether the cell exists in the database, use the exists() function instead.
Parameters:
[in]column_uuidThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
cell()
exists()

Definition at line 581 of file QCassandraRow.cpp.

References findCell().

QSharedPointer< QCassandraCell > QtCassandra::QCassandraRow::findCell ( const QByteArray &  column_key) const

This function retrieves a cell from this row. If the cell does not exist, it returns a NULL pointer (i.e. isNull() on the shared pointer returns true.)

This function makes use of a binary key to reference the cell.

Warning:
This function does NOT attempt to read the cell from the Cassandra database system. It only checks whether the cell already exists in memory. To check whether the cell exists in the database, use the exists() function instead.
Parameters:
[in]column_keyThe binary key of the column referencing this cell.
Returns:
A shared pointer to the cell.
See also:
cell()
exists()

Definition at line 606 of file QCassandraRow.cpp.

References f_cells.

bool QtCassandra::QCassandraRow::getValue ( const QByteArray &  column_key,
QCassandraValue value 
) [private]

This function calls the table getValue() function to retrieve the currrent value that defined in a cell.

If the cell does not exist, then value is set to the Null value.

Parameters:
[in]column_keyThe key used to identify the column.
[out]valueTo return the value of the cell.
Returns:
false when the value was not found in the database, true otherwise

Definition at line 1134 of file QCassandraRow.cpp.

References f_key, f_table, and QtCassandra::QCassandraTable::getValue().

Referenced by QtCassandra::QCassandraCell::value().

void QtCassandra::QCassandraRow::insertValue ( const QByteArray &  column_key,
const QCassandraValue value 
) [private]

This function calls the table insertValue() function to save the new value that was defined in a cell.

Parameters:
[in]column_keyThe key used to identify the column.
[in]valueThe new value of the cell.

Definition at line 1114 of file QCassandraRow.cpp.

References f_key, f_table, and QtCassandra::QCassandraTable::insertValue().

Referenced by QtCassandra::QCassandraCell::setValue().

QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const char *  column_name)

This function retrieves a reference to a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 758 of file QCassandraRow.cpp.

References cell().

Referenced by operator[]().

QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const wchar_t *  column_name)

This function retrieves a reference to a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 778 of file QCassandraRow.cpp.

References cell().

QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QString &  column_name)

This function retrieves a reference to a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 798 of file QCassandraRow.cpp.

References cell().

QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QUuid &  column_uuid)

This function retrieves a reference to a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function accepts a UUID as the column name. The binary version of it is used to retrieve the data from Cassandra.

Parameters:
[in]column_uuidThe UUID of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 818 of file QCassandraRow.cpp.

References cell().

QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QByteArray &  column_key)

This function retrieves a reference to a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function makes use of a binary key to reference the cell.

Parameters:
[in]column_keyThe binary key of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 837 of file QCassandraRow.cpp.

References cell().

const QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const char *  column_name) const

This function retrieves a constant reference to a cell from this row in array syntax.

This version returns a read-only cell. If the cell doesn't exist, the funtion raises an exception.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Exceptions:
std::runtime_errorThis function requires that the cell being accessed already exist in memory. If not, this exception is raised.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 861 of file QCassandraRow.cpp.

References operator[]().

const QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const wchar_t *  column_name) const

This function retrieves a constant reference to a cell from this row in array syntax.

This version returns a read-only cell. If the cell doesn't exist, the funtion raises an exception.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Exceptions:
std::runtime_errorThis function requires that the cell being accessed already exist in memory. If not, this exception is raised.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 885 of file QCassandraRow.cpp.

References operator[]().

const QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QString &  column_name) const

This function retrieves a constant reference to a cell from this row in array syntax.

This version returns a read-only cell. If the cell doesn't exist, the funtion raises an exception.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Exceptions:
std::runtime_errorThis function requires that the cell being accessed already exist in memory. If not, this exception is raised.
Parameters:
[in]column_nameThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 909 of file QCassandraRow.cpp.

References operator[]().

const QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QUuid &  column_uuid) const

This function retrieves a constant reference to a cell from this row in array syntax.

This version returns a read-only cell. If the cell doesn't exist, the funtion raises an exception.

This function accepts a column name. The UTF-8 version of it is used to retrieve the data from Cassandra.

Exceptions:
std::runtime_errorThis function requires that the cell being accessed already exist in memory. If not, this exception is raised.
Parameters:
[in]column_uuidThe name of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 933 of file QCassandraRow.cpp.

References operator[]().

const QCassandraCell & QtCassandra::QCassandraRow::operator[] ( const QByteArray &  column_key) const

This function retrieves a cell from this row in array syntax.

This version returns a writable cell and it creates a new cell when one with the specified name doesn't already exist.

This function makes use of a binary key to reference the cell.

Parameters:
[in]column_keyThe binary key of the column referencing this cell.
Returns:
A shared pointer to the cell.

Definition at line 951 of file QCassandraRow.cpp.

References cell(), and findCell().

This function is the same as the readCells() with a column predicate only it uses a default predicate which is to read all the columns available in that row, with a limit of 100 cells.

In this case the predicate has no column names or range boundaries and no index capabilities. This mode should be used on rows which you know have a limited number of cells. Otherwise, you should use the other readCells() version.

To know how many cells were read, use the count() function on the map returned by the cells() function.

Definition at line 225 of file QCassandraRow.cpp.

References f_key, f_table, and QtCassandra::QCassandraTable::getColumnSlice().

This function reads a set of cells as specified by the specified predicate. If you use the default QCassandraColumnPredicate, then the first 100 cells are read.

If you are using columns as an index, then the column_predicate parameter gets modified by this function. The start column name is updated with the name of the last row read on each iteration.

See the QCassandraColumnPredicate for more information on how to select columns.

This function is often called to read an entire row in memory all at once (this is faster than reading the row one value at a time if you anyway are likely to read most of the columns.) However, this function should not be used that way if the row includes an index.

Parameters:
[in,out]column_predicateThe predicate used to select which columns to read.
See also:
setIndex()

Definition at line 257 of file QCassandraRow.cpp.

References f_key, f_table, and QtCassandra::QCassandraTable::getColumnSlice().

const QByteArray & QtCassandra::QCassandraRow::rowKey ( ) const

This function returns the key of this row. The key is a binary buffer of data. This function works whether the row was created with a name or a key.

Note that when creating a row with a binary key, you cannot retrieve it using the rowName() function.

Returns:
A buffer of data representing the row key.
See also:
rowName()

Definition at line 183 of file QCassandraRow.cpp.

References f_key.

This function returns the name of the row as specified in the constructor.

The name cannot be changed.

Note that if you created the row with a binary key (i.e. a QByteArray parameter) then you CANNOT retrieve the row name. Instead, use the rowKey() function.

Returns:
A string with the key name.
See also:
rowKey()

Definition at line 165 of file QCassandraRow.cpp.

References f_key.

This function is called whenever you drop a row which means that all the data in that row is now not accessible (at least not on Cassandra.)

Any future function call that require the parent will fail with an exception.

Further, this call releases its cells also calling unparent() on them.

Definition at line 1171 of file QCassandraRow.cpp.

References clearCache(), and f_table.


Friends And Related Function Documentation

friend class QCassandraCell [friend]

Definition at line 110 of file QCassandraRow.h.

Referenced by cell().

friend class QCassandraTable [friend]

Definition at line 109 of file QCassandraRow.h.


Member Data Documentation

This is a map of cells. Cells are names and values pairs.

The values are defined with a timestamp and ttl value.

Definition at line 117 of file QCassandraRow.h.

Referenced by cell(), cells(), clearCache(), dropCell(), exists(), and findCell().

The binary key of the row is set to UTF-8 when defined with a string. Otherwise it is defined as specified by the user.

Definition at line 116 of file QCassandraRow.h.

Referenced by addValue(), cellCount(), dropCell(), exists(), getValue(), insertValue(), QCassandraRow(), readCells(), rowKey(), and rowName().

This bare pointer is used to access the table this row is part of. It is a bare pointer because you cannot create a row without having a table and the table keeps a tight reference on the row.

Definition at line 115 of file QCassandraRow.h.

Referenced by addValue(), cellCount(), dropCell(), exists(), getValue(), insertValue(), readCells(), and unparent().


The documentation for this class was generated from the following files:

This document is part of the Snap! Websites Project.

Copyright © 2011-2013 by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly