Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBMemTable


RWDBMemTable RWDBTable

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

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. DBTools.h++ provides operator [] for indexing on RWDBMemTable, the result of which is a reference to RWDBRow. RWDBRow inherits indexing operator [] from the Tools.h++ 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;
int
entries() const;
RWBoolean
exists(RWBoolean 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;
RWBoolean
isValid() const;
RWCString&
name() const;
RWDBTable&
name(RWCString& name);
size_t
numberOfColumns() const;
RWBoolean
populate(RWDBReader& reader);
RWBoolean
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 DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.