C++ SDK Documentation  12.0.0
Vertica::VerticaType Class Reference

Represents types of data that are passed into and returned back from user's code. More...

Collaboration diagram for Vertica::VerticaType:
Collaboration graph

Public Member Functions

 VerticaType (Oid oid, Typemod typmod)
 
 VerticaType (const VerticaType &other)
 
Oid getArray1DOid () const
 
VerticaType getArray1DType () const
 
int32 getCollectionBinarySize (bool checkType=true) const
 For Collection data types, returns the length of the binary backing the array/set.
 
Field getElementField () const
 
Oid getElementOid () const
 
VerticaType getElementType () const
 
Field getField (size_t idx) const
 
std::string getFieldName (size_t idx) const
 
VerticaType getFieldType (size_t idx) const
 
int32 getIntervalPrecision () const
 For INTERVAL data types, returns the precision.
 
int32 getIntervalRange () const
 For INTERVAL data types, returns the range.
 
int32 getMaxSize () const
 Returns the maximum size, in bytes, of a data element of this type.
 
int32 getNumericFractional () const
 For NUMERIC data types, returns the number of fractional digits (i.e., digits right of the decimal point)
 
int32 getNumericIntegral () const
 For NUMERIC data types, returns the number of integral digits (i.e., digits left of the decimal point)
 
int32 getNumericLength () const
 For NUMERIC data types, returns the number of bytes required to store an element. Calling this with a non-numeric data type can cause a crash.
 
int32 getNumericPrecision () const
 For NUMERIC data types, returns the precision.
 
int32 getNumericScale () const
 For NUMERIC data types, returns the scale.
 
int32 getNumericWordCount () const
 
size_t getNumFields () const
 
std::string getPrettyPrintStr () const
 Return human readable type string.
 
Oid getSetOid () const
 
VerticaType getSetType () const
 
int32 getStringLength (bool checkType=true) const
 For VARCHAR/CHAR/VARBINARY/BINARY data types, returns the length of the string.
 
int32 getTimePrecision () const
 For TIMESTAMP data types, returns the precision.
 
int32 getTimestampPrecision () const
 For TIMESTAMP data types, returns the precision.
 
const char * getTypeStr () const
 
Oid getUnderlyingType () const
 
bool isArray1DType () const
 
bool isArrayType () const
 
bool isBinary () const
 Returns true if this type is BINARY, false otherwise.
 
bool isBool () const
 Returns true if this type is BOOLEAN, false otherwise.
 
bool isChar () const
 Returns true if this type is CHAR, false otherwise.
 
bool iscoercedStringType () const
 Return true if it is of string type or it is uuid, date, time, etc..
 
bool isCollection1DType () const
 
bool isCollectionType () const
 
bool isComplexArrayType () const
 
bool isComplexRowArrayType () const
 
bool isComplexRowType () const
 
bool isComplexType () const
 
bool isDate () const
 Returns true if this type is DATE, false otherwise.
 
bool isFloat () const
 Returns true if this type is FLOAT, false otherwise.
 
bool isInt () const
 Returns true if this type is INTEGER, false otherwise.
 
bool isInterval () const
 Returns true if this type is INTERVAL, false otherwise.
 
bool isIntervalYM () const
 Returns true if this type is INTERVAL YEAR TO MONTH, false otherwise.
 
bool isLongVarbinary () const
 Returns true if this type is LONG VARCHAR, false otherwise.
 
bool isLongVarchar () const
 Returns true if this type is LONG VARCHAR, false otherwise.
 
bool isNestedArrayType () const
 
bool isNumeric () const
 Returns true if this type is NUMERIC, false otherwise.
 
bool isSetType () const
 
bool isStringCollectionType () const
 
bool isStringOid (Oid typeOid) const
 
bool isStringType () const
 Return true for VARCHAR/CHAR/VARBINARY/BINARY/LONG VARCHAR/LONG VARBINARY data types.
 
bool isTime () const
 Returns true if this type is TIME, false otherwise.
 
bool isTimestamp () const
 Returns true if this type is TIMESTAMP, false otherwise.
 
bool isTimestampTz () const
 Returns true if this type is TIMESTAMP WITH TIMEZONE, false otherwise.
 
bool isTimeTz () const
 Returns true if this type is TIME WITH TIMEZONE, false otherwise.
 
bool isUuid () const
 Returns true if this type is UUID, false otherwise.
 
bool isVarbinary () const
 Returns true if this type is VARBINARY, false otherwise.
 
bool isVarchar () const
 Returns true if this type is VARCHAR, false otherwise.
 
bool operator!= (const VerticaType &rhs) const
 
bool operator== (const VerticaType &rhs) const
 
void setIntervalPrecision (int32 precision)
 For INTERVAL data types, sets the precision.
 
void setIntervalRange (int32 range)
 For INTERVAL data types, sets the range.
 
void setNumericPrecision (int32 precision)
 For NUMERIC data types, sets the precision.
 
void setNumericScale (int32 scale)
 For NUMERIC data types, sets the scale.
 
void setTimePrecision (int32 precision)
 For TIMESTAMP data types, sets the precision.
 
void setTimestampPrecision (int32 precision)
 For TIMESTAMP data types, sets the precision.
 

Static Public Member Functions

static VerticaType ArrayType (const Field &element, int maxElems=-1)
 
static const char * getTypeStr (Oid typeOid)
 
static Oid isBuiltInType (const Oid typeOid)
 
static VerticaType RowType (const Fields &rowfields)
 

Detailed Description

Represents types of data that are passed into and returned back from user's code.

Member Function Documentation

Field Vertica::VerticaType::getElementField ( ) const
Returns
A Field representing the element type of this collection or complex array. The returned Field's getType() will be this->getElementType().
VerticaType Vertica::VerticaType::getElementType ( ) const
Returns
A type representing the element type of this collection or complex array. Throws an exception if this is not a collection or complex array type.

Referenced by getElementField(), and getPrettyPrintStr().

Field Vertica::VerticaType::getField ( size_t  idx) const
Parameters
idxThe position of the field type to look up.
Returns
A Field representing the field type at position idx of this ROW type. The returned Field's getType() will be this->getFieldType(idx).

Referenced by getFieldName().

std::string Vertica::VerticaType::getFieldName ( size_t  idx) const
Parameters
idxThe position of the field name to look up.
Returns
The name of the field at the provided index.
VerticaType Vertica::VerticaType::getFieldType ( size_t  idx) const
Parameters
idxThe position of the field type to look up.
Returns
A type representing the field type at position idx of this ROW type. Throws an exception if this is not a row type, or if idx is out of range.

Referenced by getField().

size_t Vertica::VerticaType::getNumFields ( ) const
Returns
The number of fields for this ROW type. Should only be called on ROW types.
Oid Vertica::VerticaType::getUnderlyingType ( ) const
inline
Returns
If this is a built in type, returns the typeOid. Otherwise, returns the base type oid on which the type is based.

Referenced by Vertica::VerticaBlock::addCol(), getMaxSize(), getPrettyPrintStr(), iscoercedStringType(), Vertica::ValueRangeReader::isNull(), isStringType(), and Vertica::ValueRangeWriter::setNull().

bool Vertica::VerticaType::isCollection1DType ( ) const
inline
Returns
true if this is a one-dimension collection type, e.g. ARRAY[INTEGER] or SET[VARCHAR]

Returns false if this type is an element of a complex array, even if it itself a 1D array type.

Referenced by Vertica::VerticaBlock::addCol(), getCollectionBinarySize(), getElementField(), getElementType(), getMaxSize(), Vertica::BlockReader::isNull(), Vertica::ValueRangeReader::isNull(), Vertica::BlockWriter::setNull(), and Vertica::ValueRangeWriter::setNull().

bool Vertica::VerticaType::isComplexRowArrayType ( ) const
Returns
true if this type is an ARRAY[ROW(...)] type

Referenced by getMaxSize().

bool Vertica::VerticaType::isComplexRowType ( ) const
inline
Returns
true if this is a ROW(...) type

Referenced by Vertica::copyBlockColumn(), getFieldType(), and getNumFields().

bool Vertica::VerticaType::isNestedArrayType ( ) const
Returns
true if this type is an ARRAY[ARRAY[...]] type
bool Vertica::VerticaType::isStringCollectionType ( ) const
inline
Returns
true if this is a one-dimension collection type whose element is a string type. See isCollection1DType().