SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWDBIdentityConstraint Class Reference

Represents an identity constraint of a column within a table or schema. More...

#include <rw/db/identity.h>

Public Member Functions

 RWDBIdentityConstraint (bool valid=false)
 
 RWDBIdentityConstraint (const RWDBValue &startWith, const RWDBValue &incrementBy, const RWDBValue &maxValue, const RWDBValue &minValue, bool cycle)
 
 RWDBIdentityConstraint (const RWDBIdentityConstraint &idC)
 
RWDBIdentityConstraintcycle (bool cycle)
 
bool cycle () const
 
RWDBIdentityConstraintincrementBy (const RWDBValue &incrementBy)
 
RWDBValue incrementBy () const
 
bool isValid () const
 
RWDBIdentityConstraintmaxValue (const RWDBValue &max)
 
RWDBValue maxValue () const
 
RWDBIdentityConstraintminValue (const RWDBValue &min)
 
RWDBValue minValue () const
 
RWDBIdentityConstraintoperator= (const RWDBIdentityConstraint &idC)
 
RWDBIdentityConstraintstartWith (const RWDBValue &startWith)
 
RWDBValue startWith () const
 

Detailed Description

An RWDBIdentityConstraint is used to represent an identity column in a database. It is used with RWDBColumn to define an identity column when building up an RWDBSchema in preparation for an RWDBDatabase::createTable() call.

An RWDBIdentityConstraint is also used with RWDBColumn instances in an RWDBSchema. An RWDBSchema is a collection of RWDBColumn objects used to describe a database table. If a column of the database table is an identity column, it is represented by an RWDBIdentityConstraint. The attributes of an identity column are available via the accessor methods in RWDBIdentityConstraint.

The identity column attributes supported by database vendors varies. If an attribute is not defined for the identity column, or not available, the returned RWDBValue will be NULL and of NoType.

Constructor & Destructor Documentation

RWDBIdentityConstraint::RWDBIdentityConstraint ( bool  valid = false)

Default constructor. No attributes are set. The created identity constraint is not valid unless true is passed to the constructor.

RWDBIdentityConstraint::RWDBIdentityConstraint ( const RWDBValue startWith,
const RWDBValue incrementBy,
const RWDBValue maxValue,
const RWDBValue minValue,
bool  cycle 
)

Constructs a new RWDBIdentityConstraint with the supplied parameters:

  • startWith — the first value for the identity column
  • incrementBy — the interval between consecutive values of the identity column
  • maxValue — the maximum value at which an ascending identity column either cycles or stops generating values, or a descending identity column cycles to after reaching the minimum value
  • minValue — the minimum value at which a descending identity column either cycles or stops generating values, or an ascending identity column cycles to after reaching the maximum value
  • cycle — bool that specifies whether values continue to be generated for this column after the maximum or minimum value has been reached. The maximum and minimum values for the identity column determine the range that is used for cycling.
RWDBIdentityConstraint::RWDBIdentityConstraint ( const RWDBIdentityConstraint idC)

Copy constructor. The created constraint is a deep copy of idC.

Member Function Documentation

RWDBIdentityConstraint& RWDBIdentityConstraint::cycle ( bool  cycle)

Sets the CYCLE value to cycle. When creating a table, if cycle() is true, the CYCLE clause is used during table creation. If not supported by the database vendor, it is silently ignored.

bool RWDBIdentityConstraint::cycle ( ) const

Returns true if the CYCLE attribute is set.

RWDBIdentityConstraint& RWDBIdentityConstraint::incrementBy ( const RWDBValue incrementBy)

Sets the INCREMENT BY value to incrementBy. When creating a table, if incrementBy() is set, then the INCREMENT BY incrementBy clause is used during table creation. If not supported by the database vendor, it is silently ignored.

RWDBValue RWDBIdentityConstraint::incrementBy ( ) const

Returns the INCREMENT BY value, if available, as an RWDBValue of the appropriate type and value; otherwise the returned RWDBValue is NULL and of NoType.

bool RWDBIdentityConstraint::isValid ( ) const

Returns true if self is an identity column (or any properties for defining identity columns are set).

RWDBIdentityConstraint& RWDBIdentityConstraint::maxValue ( const RWDBValue max)

Sets the MAXVALUE value to max. When creating a table, if maxValue() is set, the MAXVALUE max clause is used during table creation. If not supported by the database vendor, it is silently ignored.

RWDBValue RWDBIdentityConstraint::maxValue ( ) const

Returns the MAXVALUE, if available, as an RWDBValue of the appropriate type and value; otherwise the returned RWDBValue is NULL and of NoType.

RWDBIdentityConstraint& RWDBIdentityConstraint::minValue ( const RWDBValue min)

Sets the MINVALUE to min. When creating a table, if minValue() is set, the MINVALUE min clause is used during table creation. If not supported by the database vendor, it is silently ignored.

RWDBValue RWDBIdentityConstraint::minValue ( ) const

Returns the MINVALUE, if available, as an RWDBValue of the appropriate type and value; otherwise the returned RWDBValue is NULL and of NoType.

RWDBIdentityConstraint& RWDBIdentityConstraint::operator= ( const RWDBIdentityConstraint idC)

Assignment operator. Self copies the implementation of idC.

RWDBIdentityConstraint& RWDBIdentityConstraint::startWith ( const RWDBValue startWith)

Sets the START WITH value to startWith. When creating a table, if startWith() is set, the START WITH startWith clause is used during table creation. If not supported by the database vendor, it is silently ignored.

RWDBValue RWDBIdentityConstraint::startWith ( ) const

Returns the START WITH value, if available, as an RWDBValue of the appropriate type and value; otherwise the returned RWDBValue is NULL and of NoType.

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