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

RWDBSchema

Module:  DB Interface Module   Group:  Database Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/db/schema.h>

RWDBSchema s;
RWDBSchema s = myTable.schema();

Description

Class RWDBSchema is an ordered collection of RWDBColumns. An RWDBSchema serves as an encapsulation of the database notion of schema, a set of attributes defining a table. The DB Interface Module extends this notion slightly by using an RWDBSchema to define a stored procedure's formal parameter list, and to specify a list of columns wherever one is required. Each RWDBSchema can have foreign key and primary key information associated with it.

Every RWDBTable has an RWDBSchema. An application can interrogate the RWDBSchema of an RWDBTable for schema information, or obtain a copy of an RWDBSchema for its own use. An RWDBSchema instance may be used to create a database table. To do this, an application can use an RWDBSchema obtained from an existing RWDBTable, modify an existing RWDBSchema, or build one from scratch using the methods appendColumn, foreignKey, and primaryKey.

This class is implemented using a technique called copy on write. With this technique, the copy constructor and assignment operators reference the old object and, as a result, are very fast. An actual copy is made only when the object is about to be changed. The net result is excellent performance, with easy-to-understand copy semantics.

Public Constructors

RWDBSchema();
RWDBSchema(const RWDBSchema& schema);

Public Member Operators

RWDBSchema&
operator=(RWDBSchema& schema);
bool 
operator==(const RWDBSchema& schema) const;
bool 
operator!=(const RWDBSchema& schema) const;
RWDBColumn
operator[](size_t index) const;
RWDBColumn
operator[](const RWCString& name) const;

Public Member Functions

void
acquire() const;
RWDBColumn
appendColumn(const RWDBColumn& col);
RWDBColumn
appendColumn(const RWCString& name, 
             RWDBValue::ValueType type = RWDBValue::NoType, 
             long storageLength = RWDB_NO_TRAIT,
             int nativeType = RWDB_NO_TRAIT, 
             int precision = RWDB_NO_TRAIT,
             int scale = RWDB_NO_TRAIT, 
             bool nullAllowed = true, 
             RWDBColumn::ParamType paramType = 
                                 RWDBColumn::notAParameter);
RWCString
asString() const;
RWCString
asString(const RWDBPhraseBook& phraseBook) const;
RWDBSchema
clone() const;
RWDBColumn
column(size_t index) const;
RWDBColumn
column(const RWCString& name) const;
RWDBColumn
column(const RWCString& name, 
       RWCString::caseCompare caseCompare) const; 
RWCString
columnName(size_t index) const; 
size_t
entries() const;
RWDBStatus::ErrorHandler
errorHandler() const;
RWDBSchema&
foreignKey(const RWDBForeignKey& fk);
size_t
index(const RWCString& name) const;
size_t
index(const RWCString& name, 
      RWCString::caseCompare caseCompare) const; 
size_t
index(const RWDBColumn& column) const; 
bool
isEmpty() const;
bool
isValid() const;
RWCString
keysAsString();
RWCString
keysAsString(const RWDBPhraseBook&);
RWDBSchema
primaryKey();
RWDBSchema&
primaryKey(const RWDBSchema& pk);
void
release() const;
void
setErrorHandler(RWDBStatus::ErrorHandler handler); 
RWDBStatus
status() const;


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.