SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDBValue Class Reference

Provides storage for C++ primitive types and structured types used by the DB Interface Module, and adds NULL/NOT NULL semantics. More...

#include <rw/db/value.h>

Inheritance diagram for RWDBValue:
RWCollectable

Public Types

enum  ValueType {
  NoType , Char , UnsignedChar , Tiny ,
  UnsignedTiny , Short , UnsignedShort , Int ,
  UnsignedInt , Long , UnsignedLong , LongLong ,
  UnsignedLongLong , Float , Double , LongDouble ,
  Decimal , Date , DateTime , TimeTuple ,
  TimeTupleOffset , Duration , String , Blob ,
  WString , MBString , UString
}
 

Public Member Functions

 RWDBValue ()
 
 RWDBValue (char value)
 
 RWDBValue (const char *value)
 
 RWDBValue (const RWBasicUString &value)
 
 RWDBValue (const RWCString &value)
 
 RWDBValue (const RWDate &value)
 
 RWDBValue (const RWDateTime &value)
 
 RWDBValue (const RWDBBlob &value)
 
 RWDBValue (const RWDBDateTime &value)
 
 RWDBValue (const RWDBDuration &value)
 
 RWDBValue (const RWDBMBString &value)
 
 RWDBValue (const RWDBValue &value)
 
 RWDBValue (const RWDecimalPortable &value)
 
 RWDBValue (const RWTimeTuple &value)
 
 RWDBValue (const RWTimeTupleOffset &value)
 
 RWDBValue (const RWWString &value)
 
 RWDBValue (const wchar_t *value)
 
 RWDBValue (double value)
 
 RWDBValue (float value)
 
 RWDBValue (int value)
 
 RWDBValue (long double value)
 
 RWDBValue (long long value)
 
 RWDBValue (long value)
 
 RWDBValue (RWDBValueManip manip)
 
 RWDBValue (short value)
 
 RWDBValue (unsigned char value)
 
 RWDBValue (unsigned int value)
 
 RWDBValue (unsigned long long value)
 
 RWDBValue (unsigned long value)
 
 RWDBValue (unsigned short value)
 
RWDBBlob asBlob () const
 
char asChar () const
 
RWDate asDate () const
 
RWDateTime asDateTime () const
 
RWDecimalPortable asDecimal () const
 
double asDouble () const
 
RWDBDuration asDuration () const
 
float asFloat () const
 
int asInt () const
 
long asLong () const
 
long double asLongDouble () const
 
long long asLongLong () const
 
RWDBMBString asMBString () const
 
short asShort () const
 
RWCString asString () const
 
RWCString asString (const RWDBPhraseBook &phraseBook) const
 
RWTimeTuple asTimeTuple () const
 
RWTimeTupleOffset asTimeTupleOffset () const
 
unsigned char asUnsignedChar () const
 
unsigned int asUnsignedInt () const
 
unsigned long asUnsignedLong () const
 
unsigned long long asUnsignedLongLong () const
 
unsigned short asUnsignedShort () const
 
RWBasicUString asUString () const
 
RWWString asWString () const
 
virtual RWspace binaryStoreSize () const
 
bool canConvert (ValueType type) const
 
virtual int compareTo (const RWCollectable *cp) const
 
virtual RWCollectablecopy () const
 
virtual unsigned hash () const
 
virtual RWClassID isA () const
 
virtual bool isEqual (const RWCollectable *cp) const
 
bool isNull () const
 
virtual RWCollectablenewSpecies () const
 
RWDBValueoperator= (char value)
 
RWDBValueoperator= (const RWBasicUString &value)
 
RWDBValueoperator= (const RWCString &value)
 
RWDBValueoperator= (const RWDate &value)
 
RWDBValueoperator= (const RWDateTime &value)
 
RWDBValueoperator= (const RWDBBlob &value)
 
RWDBValueoperator= (const RWDBDateTime &value)
 
RWDBValueoperator= (const RWDBDuration &value)
 
RWDBValueoperator= (const RWDBMBString &value)
 
RWDBValueoperator= (const RWDBValue &value)
 
RWDBValueoperator= (const RWDecimalPortable &value)
 
RWDBValueoperator= (const RWTimeTuple &value)
 
RWDBValueoperator= (const RWTimeTupleOffset &value)
 
RWDBValueoperator= (const RWWString &value)
 
RWDBValueoperator= (double value)
 
RWDBValueoperator= (float value)
 
RWDBValueoperator= (int value)
 
RWDBValueoperator= (long double value)
 
RWDBValueoperator= (long long value)
 
RWDBValueoperator= (long value)
 
RWDBValueoperator= (RWDBValueManip manip)
 
RWDBValueoperator= (short value)
 
RWDBValueoperator= (unsigned char value)
 
RWDBValueoperator= (unsigned int value)
 
RWDBValueoperator= (unsigned long long value)
 
RWDBValueoperator= (unsigned long value)
 
RWDBValueoperator= (unsigned short value)
 
virtual void restoreGuts (RWFile &file)
 
virtual void restoreGuts (RWvistream &stream)
 
virtual void saveGuts (RWFile &file) const
 
virtual void saveGuts (RWvostream &stream) const
 
ValueType type () const
 
RWCString typeString () const
 
- Public Member Functions inherited from RWCollectable
virtual ~RWCollectable ()
 
RWspace recursiveStoreSize () const
 
RWStringID stringID () const
 

Friends

void rwdbNull (RWDBValue &)
 

Related Symbols

(Note that these are not member symbols.)

typedef void(* RWDBValueManip) (RWDBValue &)
 

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 ()
 

Detailed Description

RWDBValue provides storage for C++ primitive types and structured types used by the DB Interface Module. It also adds NULL/NOT NULL semantics to the types. RWDBValue is used in two ways:

  • Externally, RWDBValue allows your applications to work with data from the database without knowing the data's type. For example, you could write an ad hoc query tool to process and print result data from arbitrary queries that return different types of data. Instead of using specific data types like int or RWDateTime, you could simply read the data into an RWDBValue instance and use the asString() method to convert the data into an RWCString.
  • Internally, RWDBValue provides a value-oriented interface to application programs. See the chapter "The Data Model" in the DB Interface Module User's Guide for more information on the data model of the DB Interface Module.

RWDBValue inherits from class RWCollectable of the Essential Tools Module. The virtual functions of the base class RWCollectable are redefined, allowing instances of RWDBValue to be stored in the Smalltalk-like collections of the Essential Tools Module.

Synopsis
#include <rw/db/value.h>
RWDBValue value; //null, no type value
RWDBValue value(20); //integer value
Provides storage for C++ primitive types and structured types used by the DB Interface Module,...
Definition value.h:116

Member Enumeration Documentation

◆ ValueType

Every RWDBValue is tagged with a ValueType. In addition, RWDBColumn uses RWDBValue::ValueType to store schema information. In that context, Tiny and UnsignedTiny refer to one-byte integers. The DB Interface Module does not store data as Tiny or UnsignedTiny.

Enumerator
NoType 

Indicates there is no associated data.

Char 

Associated with data of type char.

UnsignedChar 

Associated with data of type unsigned char.

Tiny 

Used by RWDBColumn to indicate a one-byte integral type.

UnsignedTiny 

Used by RWDBColumn to indicate a one-byte unsigned integral type.

Short 

Associated with data of type short.

UnsignedShort 

Associated with data of type unsigned short.

Int 

Associated with data of type int.

UnsignedInt 

Associated with data of type unsigned int.

Long 

Associated with data of type long.

UnsignedLong 

Associated with data of type unsigned long.

LongLong 

Associated with data of type long long.

UnsignedLongLong 

Associated with data of type unsigned long long.

Float 

Associated with data of type float.

Double 

Associated with data of type double.

LongDouble 

Associated with data of type long double.

Decimal 

Associated with data of type RWDecimalPortable.

Date 

Associated with data of type RWDate.

DateTime 

Associated with data of type RWDateTime.

TimeTuple 

Associated with data of type RWTimeTuple.

TimeTupleOffset 

Associated with data of type RWTimeTupleOffset.

Duration 

Associated with data of type RWDBDuration.

String 

Associated with data of type RWCString.

Blob 

Associated with data of type RWDBBlob.

WString 

Associated with data of type RWWString.

MBString 

Associated with data of type RWDBMBString.

UString 

Associated with data of type RWBasicUString.

Constructor & Destructor Documentation

◆ RWDBValue() [1/30]

RWDBValue::RWDBValue ( )

The default constructor creates a NULL value without type.

◆ RWDBValue() [2/30]

RWDBValue::RWDBValue ( const RWDBValue & value)

Copy constructor. RWDBValue obeys value semantics.

◆ RWDBValue() [3/30]

RWDBValue::RWDBValue ( RWDBValueManip manip)

Constructs an RWDBValue defined by the semantics of manip. In particular, rwdbNull can be used to construct a NULL value without type.

◆ RWDBValue() [4/30]

RWDBValue::RWDBValue ( char value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [5/30]

RWDBValue::RWDBValue ( unsigned char value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [6/30]

RWDBValue::RWDBValue ( short value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [7/30]

RWDBValue::RWDBValue ( unsigned short value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [8/30]

RWDBValue::RWDBValue ( int value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [9/30]

RWDBValue::RWDBValue ( unsigned int value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [10/30]

RWDBValue::RWDBValue ( long value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [11/30]

RWDBValue::RWDBValue ( unsigned long value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [12/30]

RWDBValue::RWDBValue ( long long value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [13/30]

RWDBValue::RWDBValue ( unsigned long long value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [14/30]

RWDBValue::RWDBValue ( float value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [15/30]

RWDBValue::RWDBValue ( double value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [16/30]

RWDBValue::RWDBValue ( long double value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [17/30]

RWDBValue::RWDBValue ( const char * value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [18/30]

RWDBValue::RWDBValue ( const wchar_t * value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [19/30]

RWDBValue::RWDBValue ( const RWDecimalPortable & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [20/30]

RWDBValue::RWDBValue ( const RWDate & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [21/30]

RWDBValue::RWDBValue ( const RWDBDateTime & value)
Deprecated
As of SourcePro 12.5, use RWDBValue(const RWDateTime&) instead.

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [22/30]

RWDBValue::RWDBValue ( const RWDateTime & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [23/30]

RWDBValue::RWDBValue ( const RWTimeTuple & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [24/30]

RWDBValue::RWDBValue ( const RWTimeTupleOffset & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [25/30]

RWDBValue::RWDBValue ( const RWDBDuration & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [26/30]

RWDBValue::RWDBValue ( const RWCString & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [27/30]

RWDBValue::RWDBValue ( const RWDBBlob & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [28/30]

RWDBValue::RWDBValue ( const RWWString & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [29/30]

RWDBValue::RWDBValue ( const RWDBMBString & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

◆ RWDBValue() [30/30]

RWDBValue::RWDBValue ( const RWBasicUString & value)

Constructs an RWDBValue from the supplied value. Self is non-NULL and is tagged with the appropriate ValueType.

Note
This function accepts Unicode strings. For more information, see the entry for RWBasicUString in the Essential Tools Module Reference Guide. For more information on internationalization, see the chapter "Internationalization" of the DB Interface Module User's Guide.

Member Function Documentation

◆ asBlob()

RWDBBlob RWDBValue::asBlob ( ) const

Returns self as an RWDBBlob. If self cannot be converted according to canConvert() using an argument of RWDBValue::Blob, returns an RWDBBlob with zero length. If self holds data of type RWDBValue::UString, conversion to RWDBBlob checks the endian format used by the current system (Big-Endian or Little-Endian) to give the same RWDBBlob data for the same UString data independent of the endian format of the system.

◆ asChar()

char RWDBValue::asChar ( ) const

Returns self as a char. If self cannot be converted according to canConvert() using an argument of RWDBValue::Char, returns a char with value (char)0.

◆ asDate()

RWDate RWDBValue::asDate ( ) const

Returns self as an RWDate. If self cannot be converted according to canConvert() using an argument of RWDBValue::Date, returns an RWDate whose state is invalid.

◆ asDateTime()

RWDateTime RWDBValue::asDateTime ( ) const

Returns self as an RWDateTime. If self cannot be converted according to canConvert() using an argument of RWDBValue::DateTime, returns an RWDateTime whose state is invalid.

◆ asDecimal()

RWDecimalPortable RWDBValue::asDecimal ( ) const

Returns self as an RWDecimalPortable. If self cannot be converted according to canConvert() using an argument of RWDBValue::Decimal, returns an RWDecimalPortable with a value of 0.

◆ asDouble()

double RWDBValue::asDouble ( ) const

Returns self as a double. If self cannot be converted according to canConvert() using an argument of RWDBValue::Double, returns a double with a value of 0.

◆ asDuration()

RWDBDuration RWDBValue::asDuration ( ) const

Returns self as an RWDBDuration. If self cannot be converted according to canConvert() using an argument of RWDBValue::Duration, returns an RWDBDuration whose state is invalid.

◆ asFloat()

float RWDBValue::asFloat ( ) const

Returns self as a float. If self cannot be converted according to canConvert() using an argument of RWDBValue::Float, returns a float with a value of 0.

◆ asInt()

int RWDBValue::asInt ( ) const

Returns self as an int. If self cannot be converted according to canConvert() using an argument of RWDBValue::Int, returns an int with a value of 0.

◆ asLong()

long RWDBValue::asLong ( ) const

Returns self as a long. If self cannot be converted according to canConvert() using an argument of RWDBValue::Long, returns a long with a value of 0.

◆ asLongDouble()

long double RWDBValue::asLongDouble ( ) const

Returns self as a long double. If self cannot be converted according to canConvert() using an argument of RWDBValue::LongDouble, returns a long double with a value of 0.

◆ asLongLong()

long long RWDBValue::asLongLong ( ) const

Returns self as a long long. If self cannot be converted according to canConvert() using an argument of RWDBValue::LongLong, returns a long long with a value of 0.

◆ asMBString()

RWDBMBString RWDBValue::asMBString ( ) const

Returns self as an RWDBMBString. Any RWDBValue can be converted to an RWDBMBString.

◆ asShort()

short RWDBValue::asShort ( ) const

Returns self as a short. If self cannot be converted according to canConvert() using an argument of RWDBValue::Short, returns a short with a value of 0.

◆ asString() [1/2]

RWCString RWDBValue::asString ( ) const

Returns self as an RWCString. Any RWDBValue can be converted to an RWCString. Uses default format specifications.

◆ asString() [2/2]

RWCString RWDBValue::asString ( const RWDBPhraseBook & phraseBook) const

Returns self as an RWCString. Any RWDBValue can be converted to an RWCString. Uses format specifications from the supplied phraseBook.

◆ asTimeTuple()

RWTimeTuple RWDBValue::asTimeTuple ( ) const

Returns self as an RWTimeTuple. If self cannot be converted according to canConvert() using an argument of RWDBValue::TimeTuple, returns an RWTimeTuple with all fields set to -1.

◆ asTimeTupleOffset()

RWTimeTupleOffset RWDBValue::asTimeTupleOffset ( ) const

Returns self as an RWTimeTupleOffset. If self cannot be converted according to canConvert() using an argument of RWDBValue::TimeTupleOffset, returns an RWTimeTupleOffset with all fields set to -1.

◆ asUnsignedChar()

unsigned char RWDBValue::asUnsignedChar ( ) const

Returns self as an unsigned char. If self cannot be converted according to canConvert() using an argument of RWDBValue::UnsignedChar, returns an unsigned char with a value of (unsigned char) 0.

◆ asUnsignedInt()

unsigned int RWDBValue::asUnsignedInt ( ) const

Returns self as an unsigned int. If self cannot be converted according to canConvert() using an argument of RWDBValue::UnsignedInt, returns an unsigned int with a value of 0.

◆ asUnsignedLong()

unsigned long RWDBValue::asUnsignedLong ( ) const

Returns self as an unsigned long. If self cannot be converted according to canConvert() using an argument of RWDBValue::UnsignedLong, returns an unsigned long with a value of 0.

◆ asUnsignedLongLong()

unsigned long long RWDBValue::asUnsignedLongLong ( ) const

Returns self as an unsigned long long. If self cannot be converted according to canConvert() using an argument of RWDBValue::UnsignedLongLong, returns an unsigned long long with a value of 0.

◆ asUnsignedShort()

unsigned short RWDBValue::asUnsignedShort ( ) const

Returns self as an unsigned short. If self cannot be converted according to canConvert() using an argument of RWDBValue::UnsignedShort, returns an unsigned short with a value of 0.

◆ asUString()

RWBasicUString RWDBValue::asUString ( ) const

Returns self as an RWBasicUString. If self cannot be converted according to canConvert() using an argument of RWDBValue::UString, then returns an empty RWBasicUString. If self holds data of type RWDBValue::Blob, conversion to RWBasicUString checks the endian format used by the current system (Big-Endian or Little-Endian) to give the same RWBasicUString data for the same Blob data independent of the endian format of the system.

Note
This function returns a Unicode string. For more information, see the entry for RWBasicUString in the Essential Tools Module Reference Guide. For more information on internationalization, see the Chapter "Internationalization" of the DB Interface Module User's Guide.

◆ asWString()

RWWString RWDBValue::asWString ( ) const

Returns self as an RWWString. Any RWDBValue can be converted to an RWWString.

◆ binaryStoreSize()

virtual RWspace RWDBValue::binaryStoreSize ( ) const
virtual

Returns the number of bytes required to store self in an RWFile.

Reimplemented from RWCollectable.

◆ canConvert()

bool RWDBValue::canConvert ( ValueType type) const

Returns true if self can be converted to type by an RWDBValue::asType() method, otherwise returns false.

The table below shows the supported type conversions. Each row is a data type to be converted, while each column is a conversion type. A 1 means can convert and a 0 means can't convert. For example, table shows that type Blob can be converted to itself and to String, WString, MBString, and UString.

Supported Type Conversions

Type a b c d e f g h i j k l m n o p q r s t u v w x y
a NoType 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
b Char 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
c UnsignedChar 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
d Short 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
e UnsignedShort 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
f Int 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
g UnsignedInt 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
h Long 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
i UnsignedLong 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
j LongLong 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
k UnsignedLongLong 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
l Float 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
m Double 0 1 1 1 1 1 1 1 1 1 1 1 1 1 11 0 0 0 0 0 1 1 1 1 0
n LongDouble 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
o Decimal 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0
p Date 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0
q DateTime 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 0
r TimeTuple 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0
s TimeTupleOffset 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0
t Duration 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0
u String 0 12 12 12 12 12 12 12 12 12 12 12 12 12 12 0 0 0 0 0 1 1 1 1 1
v Blob 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
w WString 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
x MBString 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1
y UString 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1

1 Conversion will only be carried out to a scale of 6.
2 Conversion is supported only if the string value is representable as a number.

Note
Loss of precision can result without warning if you try to convert a string representation of a number into a value that can't hold it. If this is a concern, please use RWDecimalPortable, as in the following example:
RWDBValue aNumber("12345.6789");
assert(aNumber.canConvert(RWDBValue::Char));
char numberThatIsTooSmall =
aNumber.asChar(); // No way that 12345.6789 can fit.
assert(aNumber.canConvert(RWDBValue::Decimal));
RWDecimalPortable bigEnough = aNumber.asDecimal(); // This is OK.
@ Char
Definition value.h:136
@ Decimal
Definition value.h:211
Represents an arbitrary precision decimal fraction, providing maximum portability.
Definition tools/decport.h:103

◆ compareTo()

virtual int RWDBValue::compareTo ( const RWCollectable * cp) const
virtual

Interprets cp as a pointer to an RWDBValue, dereferences it, and compares the result with self. If either self or *cp is NULL, the result is undefined. Otherwise, if self and *cp have the same type, the result is <0, 0, or >0, depending upon whether self is less than, equal to, or greater than *cp, according to the semantics of self's type. Otherwise self and *cp have different types, and the result is defined only as nonzero.

As a precondition, cp is tested to determine if it is a null pointer. If null, the method asserts in debug mode, and throws RWInternalErr in optimized builds.

Reimplemented from RWCollectable.

◆ copy()

virtual RWCollectable * RWDBValue::copy ( ) const
virtual

Returns a new, copy-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWCollectable.

◆ hash()

virtual unsigned RWDBValue::hash ( ) const
virtual

Returns a suitable value for hashing.

Reimplemented from RWCollectable.

◆ isA()

virtual RWClassID RWDBValue::isA ( ) const
virtual

Redefined from class RWCollectable. Returns __RWDBVALUE.

Reimplemented from RWCollectable.

◆ isEqual()

virtual bool RWDBValue::isEqual ( const RWCollectable * cp) const
virtual

Returns true if compareTo( cp ) == 0, otherwise returns false.

Reimplemented from RWCollectable.

◆ isNull()

bool RWDBValue::isNull ( ) const

Returns true if self represents a NULL value, otherwise returns false. Note that the results of arithmetic and logical operations on NULL values are undefined; checks for NULL must be made independently.

◆ newSpecies()

virtual RWCollectable * RWDBValue::newSpecies ( ) const
virtual

Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.

Reimplemented from RWCollectable.

◆ operator=() [1/27]

RWDBValue & RWDBValue::operator= ( char value)

Assigns value's type and value to self.

◆ operator=() [2/27]

RWDBValue & RWDBValue::operator= ( const RWBasicUString & value)

Assigns value's type and value to self.

◆ operator=() [3/27]

RWDBValue & RWDBValue::operator= ( const RWCString & value)

Assigns value's type and value to self.

◆ operator=() [4/27]

RWDBValue & RWDBValue::operator= ( const RWDate & value)

Assigns value's type and value to self.

◆ operator=() [5/27]

RWDBValue & RWDBValue::operator= ( const RWDateTime & value)

Assigns value's type and value to self.

◆ operator=() [6/27]

RWDBValue & RWDBValue::operator= ( const RWDBBlob & value)

Assigns value's type and value to self.

◆ operator=() [7/27]

RWDBValue & RWDBValue::operator= ( const RWDBDateTime & value)
Deprecated
As of SourcePro 12.5, use operator=(const RWDateTime&) instead.

Assigns value's type and value to self.

◆ operator=() [8/27]

RWDBValue & RWDBValue::operator= ( const RWDBDuration & value)

Assigns value's type and value to self.

◆ operator=() [9/27]

RWDBValue & RWDBValue::operator= ( const RWDBMBString & value)

Assigns value's type and value to self.

◆ operator=() [10/27]

RWDBValue & RWDBValue::operator= ( const RWDBValue & value)

Assignment operator. RWDBValue obeys value semantics.

◆ operator=() [11/27]

RWDBValue & RWDBValue::operator= ( const RWDecimalPortable & value)

Assigns value's type and value to self.

◆ operator=() [12/27]

RWDBValue & RWDBValue::operator= ( const RWTimeTuple & value)

Assigns value's type and value to self.

◆ operator=() [13/27]

RWDBValue & RWDBValue::operator= ( const RWTimeTupleOffset & value)

Assigns value's type and value to self.

◆ operator=() [14/27]

RWDBValue & RWDBValue::operator= ( const RWWString & value)

Assigns value's type and value to self.

◆ operator=() [15/27]

RWDBValue & RWDBValue::operator= ( double value)

Assigns value's type and value to self.

◆ operator=() [16/27]

RWDBValue & RWDBValue::operator= ( float value)

Assigns value's type and value to self.

◆ operator=() [17/27]

RWDBValue & RWDBValue::operator= ( int value)

Assigns value's type and value to self.

◆ operator=() [18/27]

RWDBValue & RWDBValue::operator= ( long double value)

Assigns value's type and value to self.

◆ operator=() [19/27]

RWDBValue & RWDBValue::operator= ( long long value)

Assigns value's type and value to self.

◆ operator=() [20/27]

RWDBValue & RWDBValue::operator= ( long value)

Assigns value's type and value to self.

◆ operator=() [21/27]

RWDBValue & RWDBValue::operator= ( RWDBValueManip manip)

Assigns a type and value defined by manip to self. In particular, rwdbNull can be assigned to an RWDBValue, changing it into a NULL value without type.

◆ operator=() [22/27]

RWDBValue & RWDBValue::operator= ( short value)

Assigns value's type and value to self.

◆ operator=() [23/27]

RWDBValue & RWDBValue::operator= ( unsigned char value)

Assigns value's type and value to self.

◆ operator=() [24/27]

RWDBValue & RWDBValue::operator= ( unsigned int value)

Assigns value's type and value to self.

◆ operator=() [25/27]

RWDBValue & RWDBValue::operator= ( unsigned long long value)

Assigns value's type and value to self.

◆ operator=() [26/27]

RWDBValue & RWDBValue::operator= ( unsigned long value)

Assigns value's type and value to self.

◆ operator=() [27/27]

RWDBValue & RWDBValue::operator= ( unsigned short value)

Assigns value's type and value to self.

◆ restoreGuts() [1/2]

virtual void RWDBValue::restoreGuts ( RWFile & file)
virtual

Replaces the value of self with a value read from file.

Reimplemented from RWCollectable.

◆ restoreGuts() [2/2]

virtual void RWDBValue::restoreGuts ( RWvistream & stream)
virtual

Replaces the value of self with a value read from stream.

Reimplemented from RWCollectable.

◆ saveGuts() [1/2]

virtual void RWDBValue::saveGuts ( RWFile & file) const
virtual

Writes self to file.

Reimplemented from RWCollectable.

◆ saveGuts() [2/2]

virtual void RWDBValue::saveGuts ( RWvostream & stream) const
virtual

Writes self to stream.

Reimplemented from RWCollectable.

◆ type()

ValueType RWDBValue::type ( ) const

Returns the data type of self.

◆ typeString()

RWCString RWDBValue::typeString ( ) const

Returns the data type of self formatted as a string.

Friends And Related Symbol Documentation

◆ rwdbNull

void rwdbNull ( RWDBValue & )
friend

rwdbNull is of type RWDBValueManip. It is used to represent a literal NULL value.

◆ RWDBValueManip

typedef void(* RWDBValueManip) (RWDBValue &)
related

RWDBValueManip is a typedef and is typically used to insert a NULL value.

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