C++ SDK Documentation  23.4.0
Vertica::VNumeric Class Reference

Representation of NUMERIC, fixed point data types in Vertica. More...

Inheritance diagram for Vertica::VNumeric:
Inheritance graph
Collaboration diagram for Vertica::VNumeric:
Collaboration graph

Public Member Functions

 VNumeric (uint64 *words, int32 precision, int32 scale)
 Create a VNumeric with the provided storage location, precision and scale. More...
 
 VNumeric (const VNumeric &other)
 
void accumulate (const VNumeric *from)
 Adds another VNumeric to this VNumeric.
 
void add (const VNumeric *a, const VNumeric *b)
 
int compare (const VNumeric *from) const
 Compares this (signed) VNumeric to another. More...
 
int compareUnsigned (const VNumeric *from) const
 Compares this (unsigned) VNumeric to another. More...
 
void copy (const VNumeric *from)
 Copy data from another VNumeric. More...
 
bool copy (ifloat value, bool round=true)
 Copy data from a floating-point number. More...
 
void div (const VNumeric *a, const VNumeric *b)
 
bool equal (const VNumeric *from) const
 Indicates whether some other VNumeric is equal to this one.
 
int32 getPrecision () const
 
int32 getScale () const
 
void incr ()
 
void invertSign ()
 Inverts the sign of this VNumeric (equivalent to multiplying this VNumeric by -1)
 
bool isNeg () const
 Indicates if this VNumeric is negative.
 
bool isNull () const
 Indicates if this VNumeric is the SQL NULL value.
 
bool isZero () const
 Indicates if this VNumeric is zero.
 
void mul (const VNumeric *a, const VNumeric *b)
 
VNumericoperator*= (const VNumeric &other)
 
VNumericoperator+= (const VNumeric &other)
 
VNumericoperator-= (const VNumeric &other)
 
VNumericoperator/= (const VNumeric &other)
 
bool operator< (const VNumeric &other) const
 
VNumericoperator<<= (unsigned shift)
 
bool operator<= (const VNumeric &other) const
 
VNumericoperator= (const VNumeric &other)
 
bool operator== (const VNumeric &other) const
 
bool operator> (const VNumeric &other) const
 
bool operator>= (const VNumeric &other) const
 
VNumericoperator>>= (unsigned shift)
 
void setNull ()
 Sets this VNumeric to the SQL NULL value.
 
void setZero ()
 Sets this VNumeric to zero.
 
void shiftLeft (unsigned bitsToShift)
 
void shiftRight (unsigned bitsToShift)
 
void sub (const VNumeric *a, const VNumeric *b)
 
ifloat toFloat () const
 Convert the VNumeric value into floating-point. More...
 
size_t toString (char *outBuf, int olen) const
 

Detailed Description

Representation of NUMERIC, fixed point data types in Vertica.

Constructor & Destructor Documentation

Vertica::VNumeric::VNumeric ( uint64 words,
int32  precision,
int32  scale 
)
inline

Create a VNumeric with the provided storage location, precision and scale.

Note
It is the callers responsibility to allocate enough memory for the words parameter

Member Function Documentation

int Vertica::VNumeric::compare ( const VNumeric from) const
inline

Compares this (signed) VNumeric to another.

Returns
-1 if this < other, 0 if equal, 1 if this > other
Note
SQL NULL compares less than anything else; two SQL NULLs are considered equal
int Vertica::VNumeric::compareUnsigned ( const VNumeric from) const
inline

Compares this (unsigned) VNumeric to another.

Returns
-1 if this < other, 0 if equal, 1 if this > other
Note
SQL NULL compares less than anything else; two SQL NULLs are considered equal
void Vertica::VNumeric::copy ( const VNumeric from)
inline

Copy data from another VNumeric.

Parameters
fromThe source VNumeric
bool Vertica::VNumeric::copy ( ifloat  value,
bool  round = true 
)
inline

Copy data from a floating-point number.

Parameters
valueThe source floating-point number
roundTruncates if false; otherwise the numeric result is rounded
Returns
false if conversion failed (precision lost or overflow, etc); true otherwise
ifloat Vertica::VNumeric::toFloat ( ) const
inline

Convert the VNumeric value into floating-point.

Returns
the value in 80-bit floating-point