Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
DB Interface Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWDBMemTable

Module:  DB Interface Module   Group:  Utility and Diagnostics Classes


RWDBMemTable RWDBTable

Local Index

Members

Synopsis

#include <rw/db/memtable.h>

RWDBMemTable myTable = myDbase.memTable("myTable");

Description

RWDBMemTable is a table of data that resides in program memory. After construction, an RWDBMemTable is no longer associated with a table in the database. An application can modify the data in an RWDBMemTable, but the changes are not propagated back to the database.

RWDBMemTable is designed around the Interface/Implementation paradigm. An RWDBMemTable instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation.

Because an RWDBMemTable resides in memory, it is possible to provide random access to its data. The DB Interface Module provides operator [] for indexing on RWDBMemTable, the result of which is a reference to RWDBRow. RWDBRow inherits indexing operator [] from the Essential Tools Module class RWOrdered. The net result is the ability to access RWDBMemTable data with double indexing, as if it were a two-dimensional C++ array.

There are limitations to using RWDBMemTable, as it lacks some of the functionality of an RWDBTable. The differences in functionality come from the lack of a server in memory for selecting, deleting, inserting, and updating memory tables through SQL constructs. This means that selectors, cursors, deleters, inserters, and updaters cannot be created using memory tables. Instead, the actual table in the database must be referenced.

However, RWDBReader may be produced from RWDBMemTable, allowing access to each row within the memory table, rather than using the overloaded operators[ ] for indexing.

It should also be noted that since memory tables exist within memory, the normal data definition language (DDL) constructs that are associated with tables are also dysfunctional, and return invalid results. These include grant, revoke, addColumn, dropColumn, and so on.

Public Constructors

RWDBMemTable (size_t capacity = 0);
RWDBMemTable(const RWDBTable& table, size_t capacity = 0);
RWDBMemTable(RWDBReader& reader, size_t capacity = 0);
RWDBMemTable(const RWDBTable& table,
             const RWDBConnection& connection, 
             size_t capacity = 0);
RWDBMemTable(const RWDBMemTable& table);
RWDBMemTable(const RWDBSelectorBase& sel, 
             const RWDBConnection& conn, size_t capacity=0);
RWDBMemTable(const RWDBSelectorBase& sel, 
             size_t capacity=0);

Public Member Operators

RWDBMemTable& 
operator=(const RWDBMemTable& table);
RWDBRow&
operator[](size_t index);

Public Member Functions

void
acquire() const;
RWDBColumn
column(const RWCString& name) const;
RWDBColumn
column(size_t index) const;
RWDBColumn
column(const RWCString& name, 
       RWCString::caseCompare caseCompare);
RWDBDatabase
database() const;
size_t
entries() const;
bool
exists(bool forceLookup = False);
size_t
index(const RWCString& name) const;
size_t
index(const RWDBColumn& column) const;
size_t
index(const RWCString& name, 
      RWCString::caseCompare caseCompare) const;
bool
isValid() const;
RWCString&
name() const;
RWDBTable&
name(RWCString& name);
size_t
numberOfColumns() const;
bool
populate(RWDBReader& reader);
bool
populate(RWDBTable& table);
RWDBReader
reader() const;
RWDBReader
reader(const RWDBConnection& connection) const;
void
release() const;
RWDBSchema
schema() const;
RWDBStatus
status() const;
RWCString
tag() const;
RWDBTable&
tag(const RWCString& name);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.