SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBTPtrMemTable< T, C > Class Template Reference

Represents a parameterized memory table. More...

#include <rw/db/tpmemtab.h>

Inheritance diagram for RWDBTPtrMemTable< T, C >:
RWDBTMemTableBase RWDBTable

Public Member Functions

 RWDBTPtrMemTable (const RWDBSelectorBase &selector, const RWDBConnection &connection, size_t maxElements=0)
 
 RWDBTPtrMemTable (const RWDBSelectorBase &selector, size_t maxElements=0)
 
 RWDBTPtrMemTable (const RWDBTable &table, const RWDBConnection &connection, size_t maxElements=0)
 
 RWDBTPtrMemTable (const RWDBTable &table, size_t maxElements=0)
 
 RWDBTPtrMemTable (RWDBReader &reader, size_t maxElements=0)
 
 RWDBTPtrMemTable (size_t maxElements=0)
 
size_t entries ()
 
T * operator[] (size_t index)
 
- Public Member Functions inherited from RWDBTMemTableBase
bool populate (RWDBReader &reader)
 
- Public Member Functions inherited from RWDBTable
 RWDBTable ()
 
 RWDBTable (const RWDBTable &table)
 
void acquire (void) const
 
RWDBStatus addColumn (const RWCString &name, const RWDBConnection &connection, RWDBValue::ValueType type=RWDBValue::NoType, long storageLength=0, int nativeType=-1, int precision=-1, int scale=-1, bool nullAllowed=true, RWDBColumn::ParamType paramType=RWDBColumn::notAParameter)
 
RWDBStatus addColumn (const RWCString &name, RWDBValue::ValueType type=RWDBValue::NoType, long storageLength=0, int nativeType=-1, int precision=-1, int scale=-1, bool nullAllowed=true, RWDBColumn::ParamType paramType=RWDBColumn::notAParameter)
 
RWDBStatus addColumn (const RWDBColumn &column)
 
RWDBStatus addColumn (const RWDBColumn &column, const RWDBConnection &connection)
 
RWDBStatus addConstraint (const RWDBCheckConstraint &cc)
 
RWDBStatus addConstraint (const RWDBCheckConstraint &cc, const RWDBConnection &connection)
 
RWDBStatus addConstraint (const RWDBForeignKey &fk)
 
RWDBStatus addConstraint (const RWDBForeignKey &fk, const RWDBConnection &connection)
 
RWDBStatus addConstraint (const RWDBPrimaryKey &pk)
 
RWDBStatus addConstraint (const RWDBPrimaryKey &pk, const RWDBConnection &connection)
 
RWDBStatus addConstraint (const RWDBUniqueConstraint &uc)
 
RWDBStatus addConstraint (const RWDBUniqueConstraint &uc, const RWDBConnection &connection)
 
RWDBBulkInserter bulkInserter (const RWDBConnection &conn) const
 
RWDBBulkReader bulkReader (const RWDBConnection &conn) const
 
RWDBStatus checkConstraints (const RWCString &constraintName, RWDBCheckConstraintList &list)
 
RWDBStatus checkConstraints (const RWDBConnection &conn, const RWCString &constraintName, RWDBCheckConstraintList &list)
 
void clearCache (CacheType cache=RWDBTable::Local)
 
RWDBColumn column (const RWCString &name) const
 
RWDBColumn column (const RWCString &name, RWCString::caseCompare caseCompare) const
 
RWDBColumn column (size_t index) const
 
RWDBStatus createIndex (const RWCString &name, const RWDBSchema &columns, bool unique=true, bool clustered=true)
 
RWDBStatus createIndex (const RWCString &name, const RWDBSchema &columns, const RWDBConnection &connection, bool unique=true, bool clustered=true)
 
RWDBCursor cursor (const RWDBConnection &connection, RWDBCursor::CursorType type=RWDBCursor::Sequential, RWDBCursor::CursorAccess access=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSchema &updateCols, const RWDBConnection &connection, RWDBCursor::CursorType type=RWDBCursor::Sequential, RWDBCursor::CursorAccess access=RWDBCursor::Read) const
 
RWDBCursor cursor (const RWDBSchema &updateCols, RWDBCursor::CursorType type=RWDBCursor::Sequential, RWDBCursor::CursorAccess access=RWDBCursor::Read) const
 
RWDBCursor cursor (RWDBCursor::CursorType type=RWDBCursor::Sequential, RWDBCursor::CursorAccess access=RWDBCursor::Read) const
 
RWDBDatabase database () const
 
RWDBDeleter deleter () const
 
RWDBDeleter deleter (const RWDBCriterion &criterion) const
 
virtual RWDBSchema describe (Metadata md)
 
virtual RWDBSchema describe (Metadata md, const RWDBConnection &conn)
 
RWDBStatus drop ()
 
RWDBStatus drop (const RWDBConnection &connection)
 
RWDBStatus dropColumn (const RWDBColumn &column)
 
RWDBStatus dropColumn (const RWDBColumn &column, const RWDBConnection &connection)
 
RWDBStatus dropConstraint (const RWCString &constraintName)
 
RWDBStatus dropConstraint (const RWCString &constraintName, const RWDBConnection &connection)
 
RWDBStatus dropConstraint (const RWDBCheckConstraint &cc)
 
RWDBStatus dropConstraint (const RWDBCheckConstraint &cc, const RWDBConnection &connection)
 
RWDBStatus dropConstraint (const RWDBForeignKey &fk)
 
RWDBStatus dropConstraint (const RWDBForeignKey &fk, const RWDBConnection &connection)
 
RWDBStatus dropConstraint (const RWDBPrimaryKey &pk)
 
RWDBStatus dropConstraint (const RWDBPrimaryKey &pk, const RWDBConnection &connection)
 
RWDBStatus dropConstraint (const RWDBUniqueConstraint &uc)
 
RWDBStatus dropConstraint (const RWDBUniqueConstraint &uc, const RWDBConnection &connection)
 
RWDBStatus dropIndex (const RWCString &name)
 
RWDBStatus dropIndex (const RWCString &name, const RWDBConnection &connection)
 
RWDBStatus::ErrorHandler errorHandler () const
 
bool exists (bool forceLookup=false)
 
bool exists (const RWDBConnection &connection, bool forceLookup=false)
 
virtual bool fetchSchema ()
 
virtual bool fetchSchema (const RWDBConnection &connection)
 
RWDBStatus foreignKeys (const RWCString &refName, RWDBForeignKeyList &keyList)
 
RWDBStatus foreignKeys (const RWDBConnection &conn, const RWCString &refName, RWDBForeignKeyList &keyList)
 
RWDBStatus grant (const RWCString &priv, const RWCString &user)
 
RWDBStatus grant (const RWCString &priv, const RWCString &user, const RWDBConnection &connection)
 
RWDBStatus grant (const RWCString &priv, const RWDBSchema &colList, const RWCString &user)
 
RWDBStatus grant (const RWCString &priv, const RWDBSchema &colList, const RWCString &user, const RWDBConnection &connection)
 
RWDBColumn identityColumn () const
 
size_t index (const RWCString &name) const
 
size_t index (const RWCString &name, RWCString::caseCompare caseCompare) const
 
size_t index (const RWDBColumn &column) const
 
RWDBInserter inserter (const RWDBCompoundSelector &selector) const
 
RWDBInserter inserter (const RWDBCompoundSelector &selector, const RWDBSchema &columnList) const
 
RWDBInserter inserter (const RWDBSchema &columnList, size_t cache=0) const
 
RWDBInserter inserter (const RWDBSelector &selector) const
 
RWDBInserter inserter (const RWDBSelector &selector, const RWDBSchema &columnList) const
 
RWDBInserter inserter (size_t cache=0) const
 
bool isReady () const
 
bool isValid () const
 
bool isView () const
 
bool isView (const RWDBConnection &conn) const
 
RWCString name () const
 
RWDBTablename (const RWCString &name)
 
size_t numberOfColumns () const
 
RWDBTableoperator= (const RWDBTable &table)
 
RWDBColumn operator[] (const RWCString &name) const
 
RWDBColumn operator[] (size_t position) const
 
RWDBPrimaryKey primaryKey ()
 
RWDBPrimaryKey primaryKey (const RWDBConnection &conn)
 
RWDBReader reader (const RWDBConnection &connection, size_t cacheSize=0) const
 
RWDBReader reader (size_t cacheSize=0) const
 
RWDBStatus referredToBy (const RWDBConnection &conn, RWDBForeignKeyList &keyList)
 
RWDBStatus referredToBy (RWDBForeignKeyList &keyList)
 
void release (void) const
 
RWDBStatus revoke (const RWCString &privilege, const RWCString &user)
 
RWDBStatus revoke (const RWCString &privilege, const RWCString &user, const RWDBConnection &connection)
 
RWDBStatus revoke (const RWCString &privilege, const RWDBSchema &columnList, const RWCString &user)
 
RWDBStatus revoke (const RWCString &privilege, const RWDBSchema &columnList, const RWCString &user, const RWDBConnection &connection)
 
RWDBSchema schema () const
 
void setErrorHandler (RWDBStatus::ErrorHandler errorHandler)
 
RWDBStatus status () const
 
RWCString tag () const
 
RWDBTabletag (const RWCString &newtag)
 
RWDBStatus uniqueConstraints (const RWCString &constraintName, RWDBUniqueConstraintList &list)
 
RWDBStatus uniqueConstraints (const RWDBConnection &conn, const RWCString &constraintName, RWDBUniqueConstraintList &list)
 
RWDBUpdater updater () const
 
RWDBUpdater updater (const RWDBCriterion &criterion) const
 

Additional Inherited Members

- Public Types inherited from RWDBTable
enum  CacheType { Local , All }
 
enum  Metadata {
  None , ColumnList , DefaultValues , IdentityConstraint ,
  PrimaryKey
}
 

Detailed Description

template<class T, class C>
class RWDBTPtrMemTable< T, C >

This class represents a parameterized memory table. Not only can the type of the object inserted into the memory table be parameterized, but also the implementation.

Parameter T represents the type of the object to be stored in the memory table. It can be a class or a built-in type. The class must have:

  • Well-defined copy semantics (T::T(const T&) or the equivalent)
  • Well-defined assignment semantics (T::operator=(const T&) or the equivalent)
  • Any other semantics required by class C. For Rogue Wave collections, this includes a default constructor.
  • A friend function to map the columns read by an RWDBReader to the elements of T:
    friend RWDBReader& operator>>(const RWDBReader&, const T&)
    Provides row-by-row access to tabular data.
    Definition reader.h:136

Parameter C represents the pointer- based template collection used as the implementation of the memory table. It must have:

  • A well-defined void insert(T*) method
  • A well-defined T* operator[](size_t) method
  • A well-defined size_t entries() method

Possible choices for C are classes RWTPtrSlist and RWTPtrOrderedVector of the Essential Tools Module.

The constructors for the class dynamically allocate space for the elements of type T that are placed in the collection. It is the application's responsibility to free this memory when the RWDBTPtrMemTable goes out of scope. An effective way to do this is to have the collection class C call operator delete on each of the entries in its destructor.

Synopsis
#include <rw/db/tpmemtab.h>
Represents a parameterized memory table.
Definition tpmemtab.h:69

Constructor & Destructor Documentation

◆ RWDBTPtrMemTable() [1/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( size_t maxElements = 0)

Constructor that builds an empty instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table.

◆ RWDBTPtrMemTable() [2/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBTable & table,
size_t maxElements = 0 )

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance is created on the table. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

◆ RWDBTPtrMemTable() [3/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBTable & table,
const RWDBConnection & connection,
size_t maxElements = 0 )

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance, using the connection specified by connection, is created on the table. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

◆ RWDBTPtrMemTable() [4/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBSelectorBase & selector,
size_t maxElements = 0 )

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance is created on the selector. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

◆ RWDBTPtrMemTable() [5/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( const RWDBSelectorBase & selector,
const RWDBConnection & connection,
size_t maxElements = 0 )

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, an RWDBReader instance, using the connection specified by connection, is created on the selector. From this reader, up to maxElements instances of class T are allocated and inserted into the memory table. It is the application's responsibility to free the memory associated with the table.

◆ RWDBTPtrMemTable() [6/6]

template<class T , class C >
RWDBTPtrMemTable< T, C >::RWDBTPtrMemTable ( RWDBReader & reader,
size_t maxElements = 0 )

Constructor that builds an instance with an upper limit of maxElements. If maxElements is zero, no upper limit is imposed on the number of elements in the memory table. After building the memory table, the RWDBReader instance reader is used to allocate and insert into the memory table up to maxElements instances of class T. It is the application's responsibility to free the memory associated with the table.

Member Function Documentation

◆ entries()

template<class T , class C >
size_t RWDBTPtrMemTable< T, C >::entries ( )

Returns number of rows in self. Uses user-defined method C::entries().

◆ operator[]()

template<class T , class C >
T * RWDBTPtrMemTable< T, C >::operator[] ( size_t index)

Returns a pointer to the T* in self at position index. Uses user-defined operator T* C::operator[](size_t index).

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.