Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWDBColumn



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

Synopsis

#include <rw/db/column.h>

RWDBColumn c = myTable["columnName"];

Description

RWDBColumn provides a way to refer to a particular column of a table or schema, or to a particular parameter of a stored procedure. An application obtains instances of RWDBColumn by indexing into an RWDBTable or RWDBSchema.

RWDBColumn instances may be used in expressions (see RWDBExpr), which in turn are used to build up encapsulated SQL objects such as RWDBSelector.

RWDBColumn instances are also used in RWDBSchema. An RWDBSchema is a collection of RWDBColumns used to describe a database table, view, or stored procedure. When used in this way, RWDBColumn stores several pieces of information:


NOTE:DBTools.h++ does not obtain schema information until it is required. See RWDBTable::fetchSchema.

If no schema information has been obtained for the table containing a column, the column will contain default values. For Native Type, Storage Length, Precision, and Scale, this default value is RWDB_NO_TRAIT, and may be used in conditional expressions as follows:

RWDBColumn is designed around the Interface/Implementation paradigm. An RWDBColumn instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. Unlike many DBTools.h++ classes, RWDBColumn implementations do not require database-specific variants.

About Precision and Scale

Precision and scale are used when defining numeric datatypes. Each database applies these specifications to datatypes in a slightly different manner. For example, Sybase applies precision and scale to decimal and numeric datatypes, while Oracle applies precision and scale to numeric datatypes only.

The precision of a column defines the total precision of the datatype. For decimal datatypes, this translates into the total number of base ten digits. For floating point datatypes, this translates into binary digits or size.

The scale of a column defines the precision of the fractional part of the datatype. For decimal datatypes, this translates into the total number of digits following the decimal point.

Note that precision and scale are often optional for a datatype and that many databases apply default sizes when precision and scale are not provided.

For DBTools.h++ applications, precision and scale should always be specified if an application will create columns of a certain precision and scale. An access library can either disregard or use the necessary information in order to create a column of the correct datatype. Typically, precision and scale should always be given for decimal columns.

Related Classes

RWDBColumn is commonly used to construct encapsulated SQL expressions, which can in turn become part of encapsulated SQL statements like RWDBSelector, RWDBInserter, RWDBDeleter, and RWDBUpdater. For example, to create an encapsulation of the SQL statement:

UPDATE myTable SET myColumn = 10 WHERE myKey < 100

we would write:

Note that the index expressions myTable["myColumn"] and myTable ["myKey"] result in the construction of RWDBColumn instances, which are then used to construct instances of an RWDBAssignment and RWDBExpr, respectively.

For additional details, see RWDBExpr, RWDBAssignment, RWDBCriterion, RWDBSelector, RWDBInserter, RWDBUpdater, and RWDBDeleter.

Public Enum

enum ParamType { notAParameter, inParameter, outParameter,
                 inOutParameter };

Public Constructors

RWDBColumn();
RWDBColumn(const RWDBColumn& column);

Public Member Operator

RWDBColumn&
operator=(const RWDBColumn& column); 

Public Member Functions

void
acquire() const;
RWDBAssignment
assign(const RWDBExpr& expression) const; 
RWDBAssignment
assign(char value) const;
RWDBAssignment
assign(unsigned char value) const;
RWDBAssignment
assign(short int value) const;
RWDBAssignment
assign(unsigned short int value) const;
RWDBAssignment
assign(long int value) const;
RWDBAssignment
assign(unsigned long int value) const;
RWDBAssignment
assign(int value) const;
RWDBAssignment
assign(unsigned int value) const;
RWDBAssignment
assign(float value) const;
RWDBAssignment
assign(double value) const;
RWDBAssignment
assign(const char* value) const;
RWDBAssignment
assign(const RWCString& value) const;
RWDBAssignment
assign(const RWDate& value) const;
RWDBAssignment
assign(const RWTime& value) const;
RWDBAssignment
assign(const RWDBDateTime& value) const;
RWDBAssignment
assign(const RWDBDuration& value) const;
RWDBAssignment
assign(const RWDecimalPortable& value) const;
RWDBAssignment
assign(const RWDBBlob& value) const;
RWDBAssignment
assign(const RWDBExpr& expr) const;
RWDBAssignment
assign(const RWDBMBString& value) const;
RWDBAssignment
assign(const RWWString& value) const;
RWDBAssignment
assign(const wchar_t* value) const;
RWDBAssignment
assign(const RWDBValueManip manip) const;
RWDBCriterion
between(const RWDBExpr& expression1, 
        const RWDBExpr& expression2) const; 
RWDBColumn&
clearTable();
RWDBColumn
clone() const;
RWDBStatus::ErrorHandler
errorHandler() const;
RWDBCriterion
in(const RWDBExpr& expression) const;
RWBoolean
isEquivalent(const RWDBColumn& column) const;
RWDBCriterion 
isNull(void) const;
RWBoolean
isValid() const;
RWDBCriterion
leftOuterJoin(const RWDBExpr& expression) const;
RWDBCriterion
like(const RWDBExpr& expression) const;
RWDBCriterion
matchUnique(const RWDBExpr& expression) const;
RWCString
name() const;
RWDBColumn&
name(const RWCString& newName);
int
nativeType() const;
RWDBColumn&
nativeType(int newType);
RWBoolean
nullAllowed() const;
RWDBColumn&
nullAllowed(RWBoolean nullAllowed);
RWDBColumn::ParamType
paramType() const;
RWDBColumn&
paramType(RWDBColumn::ParamType type);
int
precision() const;
RWDBColumn&
precision(int precision);
RWCString
qualifiedName() const;
void
release() const;
RWDBCriterion
rightOuterJoin(const RWDBExpr& expression) const;
int
scale() const;
RWDBColumn&
scale(int scale);
void
setErrorHandler(RWDBStatus::ErrorHandler handler);
RWDBStatus
status() const;
long
storageLength() const;
RWDBColumn&
storageLength(long newLength);
RWDBTable
table() const;
RWDBColumn&
table(const RWDBTable& table);
RWDBValue::ValueType
type() const;
RWDBColumn&
type(RWDBValue::ValueType type);


Previous fileTop of DocumentContentsIndexNext file

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