SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Represents unique constraints, used when creating a database table or fetching a database table schema. More...
#include <rw/db/uniqueconstr.h>
Additional Inherited Members | |
Static Public Member Functions inherited from RWCollectable | |
static RWClassID | classID (const RWStringID &name) |
static RWClassID | classIsA () |
static bool | isAtom (RWClassID id) |
static RWspace | nilStoreSize () |
RWDBUniqueConstraint represents a table's unique constraints, used when building up an RWDBSchema in preparation for an RWDBDatabase::createTable() call. When creating a table, the instances of RWDBColumn are used to define the set of columns that make up a unique constraint.
RWDBUniqueConstraint instances are also used as elements of lists that are returned from RWDBTable::uniqueConstraints(). If the table columns in the definition of the constraint can be obtained from the database, they will be available via the methods operator[]() and column() when the unique constraints are fetched via RWDBTable::uniqueConstraints().
RWDBUniqueConstraint is designed around the Interface/Implementation paradigm. An RWDBUniqueConstraint instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation.
RWDBUniqueConstraint::RWDBUniqueConstraint | ( | ) |
Creates an empty RWDBUniqueConstraint. The object is not valid until it contains at least one column.
RWDBUniqueConstraint::RWDBUniqueConstraint | ( | const RWCString & | constraintName | ) |
Constructs a unique constraint. If constraintName is the empty string, no name will be used when creating the table.
RWDBUniqueConstraint::RWDBUniqueConstraint | ( | const RWDBUniqueConstraint & | constr | ) |
Copy constructor. Self shares an implementation with constr.
|
virtual |
Destructor.
RWDBColumn RWDBUniqueConstraint::appendColumn | ( | const RWDBColumn & | col | ) |
Creates a deep copy of the RWDBColumn col, using the RWDBColumn::clone() method. Appends the copied column to self, and returns it.
RWCString RWDBUniqueConstraint::asString | ( | const RWDBPhraseBook & | phrasebook | ) | const |
Returns an RWCString representing self as a string based on the format found in phrasebook.
|
virtual |
Returns the number of bytes used by the virtual function saveGuts(RWFile&) to store an object. Typically, this involves adding up the space required to store all primitives, plus the results of calling recursiveStoreSize() for all objects inheriting from RWCollectable. See the Essential Tools Module User's Guide for details.
Reimplemented from RWCollectable.
RWDBUniqueConstraint RWDBUniqueConstraint::clone | ( | ) | const |
Returns a deep copy of self.
RWDBColumn RWDBUniqueConstraint::column | ( | const RWCString & | name | ) | const |
Returns a shallow copy of the column from self whose name matches the given name. If there is no match, returns an RWDBColumn whose status is RWDBStatus::columnNotFound.
RWDBColumn RWDBUniqueConstraint::column | ( | const RWCString & | name, |
RWCString::caseCompare | cc ) const |
Returns a shallow copy of the column from self whose name matches the given name, according to cc. If there is no match, returns an RWDBColumn whose status is RWDBStatus::columnNotFound.
RWDBColumn RWDBUniqueConstraint::column | ( | size_t | index | ) | const |
Returns a shallow copy of the column from self at the specified index. If the index is out of range, returns an RWDBColumn whose status is RWDBStatus::invalidPosition.
|
virtual |
If c points to an RWDBUniqueConstraint, returns the result of asString().compareTo(c->asString()) using the default phrasebook
, otherwise returns a nonzero value.
Reimplemented from RWCollectable.
RWCString RWDBUniqueConstraint::constraintName | ( | ) | const |
Returns the constraint name of this unique constraint.
RWDBUniqueConstraint & RWDBUniqueConstraint::constraintName | ( | const RWCString & | newName | ) |
Sets the constraint name of self to newName. Returns a reference to self.
|
virtual |
Returns a new, copy-constructed object of the same type as self. The caller is responsible for deleting the object.
Reimplemented from RWCollectable.
size_t RWDBUniqueConstraint::entries | ( | ) | const |
Returns the number of RWDBColumn instances in self.
|
virtual |
Returns asString().hash().
Reimplemented from RWCollectable.
size_t RWDBUniqueConstraint::index | ( | const RWCString & | name | ) | const |
Returns the index of the first RWDBColumn in self with the given name. Returns RW_NPOS if no such column is found.
size_t RWDBUniqueConstraint::index | ( | const RWCString & | name, |
RWCString::caseCompare | cc ) const |
Returns the index of the first column from self whose name matches the given name, according to cc. If there is no match, returns RW_NPOS.
size_t RWDBUniqueConstraint::index | ( | const RWDBColumn & | column | ) | const |
Returns the index of the first RWDBColumn in self with the same name as the name of the given column. Returns RW_NPOS if no such column is found.
|
virtual |
Returns __RWDBUNIQUECONSTRAINT.
Reimplemented from RWCollectable.
|
virtual |
Behaves as if compareTo(t) was invoked, returning true
if the result equals 0, false
otherwise.
Reimplemented from RWCollectable.
bool RWDBUniqueConstraint::isValid | ( | ) | const |
Returns false
if self has no columns (i.e. entries() == 0
), otherwise returns true
.
|
virtual |
Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.
Reimplemented from RWCollectable.
RWDBUniqueConstraint & RWDBUniqueConstraint::operator= | ( | const RWDBUniqueConstraint & | constr | ) |
Assignment operator. Self shares an implementation with constr. Returns a reference to self.
bool RWDBUniqueConstraint::operator== | ( | const RWDBUniqueConstraint & | constraint | ) | const |
Compares self to constraint. Returns true
if constraint and self share the same implementation.
RWDBColumn RWDBUniqueConstraint::operator[] | ( | const RWCString & | name | ) | const |
Returns the first RWDBColumn in self with the given name. If no such column exists, returns an RWDBColumn with a status of RWDBStatus::columnNotFound. Note that the returned RWDBColumn is not a deep copy; modifications to RWDBColumn change the containing RWDBUniqueConstraint.
RWDBColumn RWDBUniqueConstraint::operator[] | ( | size_t | index | ) | const |
Returns the RWDBColumn in self at position index. If the index is out of range, returns an RWDBColumn with a status of RWDBStatus::invalidPosition. Indexing into an empty RWDBUniqueConstraint is treated as out of range. Note that the returned RWDBColumn is not a deep copy; modifications to RWDBColumn change the containing RWDBUniqueConstraint.
|
virtual |
Reads an object's state from a binary file, using class RWFile, replacing the previous state.
Reimplemented from RWCollectable.
|
virtual |
Reads an object's state from an input stream, replacing the previous state.
Reimplemented from RWCollectable.
|
virtual |
Writes an object's state to a binary file, using class RWFile.
Reimplemented from RWCollectable.
|
virtual |
Writes an object's state to an output stream.
Reimplemented from RWCollectable.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |