Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBSchema



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

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. DBTools.h++ 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);
RWBoolean 
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 = 0,
             int nativeType = -1, 
             int precision = -1,
             int scale = -1, 
             RWBoolean 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; 
RWBoolean
isEmpty() const;
RWBoolean
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 DocumentContentsIndexNext file

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