SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Represents check constraints, used when creating a database table or fetching a database table schema. More...
#include <rw/db/checkconstr.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 () |
RWDBCheckConstraint represents a table's check constraint, used when building up an RWDBSchema in preparation for an RWDBDatabase::createTable() call. The check condition is the definition of the constraint. When creating a table, the instances of RWDBColumn, if any, are ignored.
RWDBCheckConstraint instances are also used as elements of lists that are returned from RWDBTable::checkConstraints(). 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 check constraints are fetched via RWDBTable::checkConstraints().
RWDBCheckConstraint is designed around the Interface/Implementation paradigm. An RWDBCheckConstraint instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation.
RWDBCheckConstraint::RWDBCheckConstraint | ( | ) |
Creates an empty RWDBCheckConstraint. Provided for convenience only.
RWDBCheckConstraint::RWDBCheckConstraint | ( | const RWDBExpr & | checkCond, |
const RWCString & | constraintName = "" |
||
) |
Constructs a check constraint with check condition checkCond and name constraintName. If constraintName is the empty string, no name will be used when creating the table.
RWDBCheckConstraint::RWDBCheckConstraint | ( | const RWDBCheckConstraint & | constr | ) |
Copy constructor. Self shares an implementation with constr.
|
virtual |
Destructor.
RWCString RWDBCheckConstraint::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.
RWDBCheckConstraint& RWDBCheckConstraint::checkCondition | ( | const RWDBExpr & | cond | ) |
Sets the check condition to cond. Returns a reference to self. To unset a check condition, pass an empty RWDBExpr created with the default constructor.
RWDBExpr RWDBCheckConstraint::checkCondition | ( | ) | const |
Returns the check condition. If there is no check condition, returns an empty RWDBExpr.
RWDBCheckConstraint RWDBCheckConstraint::clone | ( | ) | const |
Returns a deep copy of self.
RWDBColumn RWDBCheckConstraint::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.
RWDBColumn RWDBCheckConstraint::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 RWDBCheckConstraint::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.
|
virtual |
If c points to an RWDBCheckConstraint, returns the result of asString().compareTo(c->asString()) using the default phrasebook
, otherwise returns a nonzero value.
Reimplemented from RWCollectable.
RWDBCheckConstraint& RWDBCheckConstraint::constraintName | ( | const RWCString & | newName | ) |
Sets the constraint name of self to newName. Returns a reference to self.
RWCString RWDBCheckConstraint::constraintName | ( | ) | const |
Returns the constraint name of this check constraint.
|
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 RWDBCheckConstraint::entries | ( | ) | const |
Returns the number of RWDBColumn instances in self.
|
virtual |
Returns asString().hash().
Reimplemented from RWCollectable.
size_t RWDBCheckConstraint::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 RWDBCheckConstraint::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 RWDBCheckConstraint::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 __RWDBCHECKCONSTRAINT.
Reimplemented from RWCollectable.
|
virtual |
Behaves as if compareTo(t) was invoked, returning true
if the result equals 0, false
otherwise.
Reimplemented from RWCollectable.
bool RWDBCheckConstraint::isValid | ( | ) | const |
Returns true
if self's check condition is set, otherwise returns false
.
|
virtual |
Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.
Reimplemented from RWCollectable.
RWDBCheckConstraint& RWDBCheckConstraint::operator= | ( | const RWDBCheckConstraint & | constr | ) |
Assignment operator. Self shares an implementation with constr. Returns a reference to self.
bool RWDBCheckConstraint::operator== | ( | const RWDBCheckConstraint & | constraint | ) | const |
Compares self to constraint. Returns true
if constraint and self share the same implementation.
RWDBColumn RWDBCheckConstraint::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 RWDBCheckConstraint is treated as out of range. Note that the returned RWDBColumn is not a deep copy; modifications to RWDBColumn change the containing RWDBCheckConstraint.
RWDBColumn RWDBCheckConstraint::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 RWDBCheckConstraint.
|
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 © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |