C++ SDK Documentation  24.2.0
Vertica::ParamReader Class Reference

Provides read access to a set of named parameters. This class provides type-specific methods to retrieve values. More...

Inheritance diagram for Vertica::ParamReader:
Inheritance graph
Collaboration diagram for Vertica::ParamReader:
Collaboration graph

Public Member Functions

 ParamReader (size_t nparams)
 
void addParameter (std::string paramName, const char *arg, const VerticaType &dt)
 
bool containsParameter (std::string paramName) const
 Function to see if the ParamReader has a value for the parameter.
 
void copy (const VerticaBlock &other)
 
void copy (const ParamReader &other)
 Copy the other ParamReader. Discard any existing parameters TODO: create an alternate version that only copies if this ParamReader is empty, is a no-op if they are non-empty and the same, and error if they are non-empty and different.
 
const vboolgetBoolPtr (std::string paramName) const
 Get a pointer to a BOOLEAN value from the input row. More...
 
const vboolgetBoolRef (std::string paramName) const
 Get a reference to a BOOLEAN value from the input row. More...
 
template<class T >
const T * getColPtr (size_t idx) const
 
template<>
const VStringgetColPtr (size_t idx) const
 
template<>
const VNumericgetColPtr (size_t idx) const
 
template<>
const VUuidgetColPtr (size_t idx) const
 
template<>
const BlockReadergetColPtr (size_t idx) const
 
template<class T >
T * getColPtrForWrite (size_t idx)
 
template<>
VStringgetColPtrForWrite (size_t idx)
 
template<>
VNumericgetColPtrForWrite (size_t idx)
 
template<>
VUuidgetColPtrForWrite (size_t idx)
 
template<>
BlockWritergetColPtrForWrite (size_t idx)
 
template<class T >
const T & getColRef (size_t idx) const
 
template<class T >
T & getColRefForWrite (size_t idx)
 
int getColStride (size_t idx) const
 
const EE::DataAreagetDataArea (size_t idx) const
 
const DateADTgetDatePtr (std::string paramName) const
 Get a pointer to a DATE value from the input row. More...
 
const DateADTgetDateRef (std::string paramName) const
 Get a reference to a DATE value from the input row. More...
 
const vfloatgetFloatPtr (std::string paramName) const
 Get a pointer to a FLOAT value from the input row. More...
 
const vfloatgetFloatRef (std::string paramName) const
 Get a reference to a FLOAT value from the input row. More...
 
size_t getIndex (std::string paramName) const
 
const IntervalgetIntervalPtr (std::string paramName) const
 Get a pointer to an INTERVAL value from the input row. More...
 
const IntervalgetIntervalRef (std::string paramName) const
 Get a reference to an INTERVAL value from the input row. More...
 
const IntervalYMgetIntervalYMPtr (std::string paramName) const
 Get a pointer to a INTERVAL YEAR TO MONTH value from the input row. More...
 
const IntervalYMgetIntervalYMRef (std::string paramName) const
 Get a reference to an INTERVAL YEAR TO MONTH value from the input row. More...
 
const vintgetIntPtr (std::string paramName) const
 Get a pointer to an INTEGER value from the input row. More...
 
const vintgetIntRef (std::string paramName) const
 Get a reference to an INTEGER value from the input row. More...
 
size_t getNumCols () const
 
const VNumericgetNumericPtr (std::string paramName) const
 Get a pointer to a VNumeric value from the input row. More...
 
const VNumericgetNumericRef (std::string paramName) const
 Get a reference to a VNumeric value from the input row. More...
 
int getNumRows () const
 
std::vector< std::string > getParamNames () const
 Return the names of all parameters stored in this ParamReader.
 
const VStringgetStringPtr (std::string paramName) const
 Get a pointer to a VString value from the input row. More...
 
const VStringgetStringRef (std::string paramName) const
 Get a reference to an VString value from the input row. More...
 
const TimeADTgetTimePtr (std::string paramName) const
 Get a pointer to a TIME value from the input row. More...
 
const TimeADTgetTimeRef (std::string paramName) const
 Get a reference to a TIME value from the input row. More...
 
const TimestampgetTimestampPtr (std::string paramName) const
 Get a pointer to a TIMESTAMP value from the input row. More...
 
const TimestampgetTimestampRef (std::string paramName) const
 Get a reference to a TIMESTAMP value from the input row. More...
 
const TimestampTzgetTimestampTzPtr (std::string paramName) const
 Get a pointer to a TIMESTAMP WITH TIMEZONE value from the input row. More...
 
const TimestampTzgetTimestampTzRef (std::string paramName) const
 Get a reference to a TIMESTAMP WITH TIMEZONE value from the input row. More...
 
const TimeTzADTgetTimeTzPtr (std::string paramName) const
 Get a pointer to a TIME WITH TIMEZONE value from the input row. More...
 
const TimeTzADTgetTimeTzRef (std::string paramName) const
 Get a reference to a TIME WITH TIMEZONE value from the input row. More...
 
VerticaType getType (std::string paramName) const
 Return the type of the given parameter.
 
const SizedColumnTypesgetTypeMetaData () const
 
SizedColumnTypesgetTypeMetaData ()
 
VUuidgetUuidPtr (std::string paramName) const
 Get a pointer to a VUuid value from the input row. More...
 
const VUuidgetUuidRef (std::string paramName) const
 
void * getVoidPtr (size_t idx=0)
 
const void * getVoidPtr (size_t idx=0) const
 
bool isEmpty () const
 Returns true if there are no parameters.
 
bool remaining () const
 
virtual void resetForDataAreaFlush ()
 
void setDataArea (size_t idx, void *dataarea)
 

Public Attributes

std::map< std::string, size_t > paramNameToIndex
 

Protected Member Functions

void addCol (char *arg, int colstride, const Field &field)
 
void addCol (const char *arg, int colstride, const Field &field)
 
bool checkStringUserBlockInfo (size_t idx) const
 
bool checkTimeUserBlockInfo (size_t idx) const
 
EE::DataArea ** getArrayIntermediateDataArea (size_t c)
 
void reset ()
 
void resetIndex ()
 
void setRowCount (int rowCount)
 
void validateStringColumn (size_t idx, const VString &s, size_t colLength) const
 

Protected Attributes

std::vector< char * > cols
 
std::vector< int > colstrides
 
int count
 
std::vector< NestedBlockPtrctWrappers
 
int index
 
const int * indices
 
size_t ncols
 
int nrows
 
std::vector< BaseDataOID > processBlockUserInfoVector
 
std::vector< VStringsvWrappers
 
SizedColumnTypes typeMetaData
 
std::vector< VUuiduuWrappers
 
std::vector< VNumericvnWrappers
 

Friends

class VerticaBlockSerializer
 

Detailed Description

Provides read access to a set of named parameters. This class provides type-specific methods to retrieve values.

Member Function Documentation

◆ addCol()

void Vertica::VerticaBlock::addCol ( char *  arg,
int  colstride,
const Field field 
)
protectedinherited

Add the location for reading a particular argument.

Parameters
argThe base location to find data.
colstrideThe stride between data instances.
fieldmetadata for the added column
dtThe type of input.
fieldnamethe name of the field

Referenced by addParameter().

◆ addParameter()

void Vertica::ParamReader::addParameter ( std::string  paramName,
const char *  arg,
const VerticaType dt 
)
inline

Add a parameter to the block and stores it name and corresponding index in the paramNameToIndex map

◆ getArrayIntermediateDataArea()

EE::DataArea** Vertica::VerticaBlock::getArrayIntermediateDataArea ( size_t  c)
inlineprotectedinherited
Returns
a pointer to a DataArea for accumulating an intermediate result

◆ getBoolPtr()

const vbool* Vertica::ParamReader::getBoolPtr ( std::string  paramName) const
inline

Get a pointer to a BOOLEAN value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a BOOLEAN.

Referenced by getBoolRef().

◆ getBoolRef()

const vbool& Vertica::ParamReader::getBoolRef ( std::string  paramName) const
inline

Get a reference to a BOOLEAN value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an BOOLEAN.

◆ getColPtr()

template<class T >
const T* Vertica::VerticaBlock::getColPtr ( size_t  idx) const
inlineinherited
Returns
a pointer to the idx'th argument, cast appropriately.

Example:

const vint *a = arg_reader->getColPtr<vint>(0);

◆ getColRef()

template<class T >
const T& Vertica::VerticaBlock::getColRef ( size_t  idx) const
inlineinherited
Returns
a pointer to the idx'th argument, cast appropriately.

Example: const vint a = arg_reader->getColRef<vint>(0);

◆ getDatePtr()

const DateADT* Vertica::ParamReader::getDatePtr ( std::string  paramName) const
inline

Get a pointer to a DATE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a DATE.

Referenced by getDateRef().

◆ getDateRef()

const DateADT& Vertica::ParamReader::getDateRef ( std::string  paramName) const
inline

Get a reference to a DATE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an DATE.

◆ getFloatPtr()

const vfloat* Vertica::ParamReader::getFloatPtr ( std::string  paramName) const
inline

Get a pointer to a FLOAT value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a FLOAT.

Referenced by getFloatRef().

◆ getFloatRef()

const vfloat& Vertica::ParamReader::getFloatRef ( std::string  paramName) const
inline

Get a reference to a FLOAT value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A reference to the parameter value, cast as an FLOAT.

◆ getIntervalPtr()

const Interval* Vertica::ParamReader::getIntervalPtr ( std::string  paramName) const
inline

Get a pointer to an INTERVAL value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as an INTERVAL.

Referenced by getIntervalRef().

◆ getIntervalRef()

const Interval& Vertica::ParamReader::getIntervalRef ( std::string  paramName) const
inline

Get a reference to an INTERVAL value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an INTERVAL.

◆ getIntervalYMPtr()

const IntervalYM* Vertica::ParamReader::getIntervalYMPtr ( std::string  paramName) const
inline

Get a pointer to a INTERVAL YEAR TO MONTH value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A point to the retrieved value cast as a INTERVAL YEAR TO MONTH.

Referenced by getIntervalYMRef().

◆ getIntervalYMRef()

const IntervalYM& Vertica::ParamReader::getIntervalYMRef ( std::string  paramName) const
inline

Get a reference to an INTERVAL YEAR TO MONTH value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an INTERVAL YEAR TO MONTH.

◆ getIntPtr()

const vint* Vertica::ParamReader::getIntPtr ( std::string  paramName) const
inline

Get a pointer to an INTEGER value from the input row.

Returns
a pointer to the idx'th argument, cast appropriately.
Parameters
paramNameThe name of the parameter to retrieve

Example:

vint *a = arg_reader->getIntPtr("max");

Referenced by getIntRef().

◆ getIntRef()

const vint& Vertica::ParamReader::getIntRef ( std::string  paramName) const
inline

Get a reference to an INTEGER value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an INTEGER.

Example:

vint a = arg_reader->getIntRef("max");

◆ getNumCols()

size_t Vertica::VerticaBlock::getNumCols ( ) const
inlineinherited
Returns
the number of columns held by this block.

Referenced by Vertica::BlockWriter::copyFromInput(), Vertica::BlockReader::isNull(), and Vertica::BlockWriter::setNull().

◆ getNumericPtr()

const VNumeric* Vertica::ParamReader::getNumericPtr ( std::string  paramName) const
inline

Get a pointer to a VNumeric value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a Numeric.

Referenced by getNumericRef().

◆ getNumericRef()

const VNumeric& Vertica::ParamReader::getNumericRef ( std::string  paramName) const
inline

Get a reference to a VNumeric value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an VNumeric.

◆ getNumRows()

int Vertica::VerticaBlock::getNumRows ( ) const
inlineinherited
Returns
the number of rows held by this block.

◆ getStringPtr()

const VString* Vertica::ParamReader::getStringPtr ( std::string  paramName) const
inline

Get a pointer to a VString value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a VString.

Referenced by getStringRef().

◆ getStringRef()

const VString& Vertica::ParamReader::getStringRef ( std::string  paramName) const
inline

Get a reference to an VString value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as an VString.

◆ getTimePtr()

const TimeADT* Vertica::ParamReader::getTimePtr ( std::string  paramName) const
inline

Get a pointer to a TIME value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a TIME.

Referenced by getTimeRef().

◆ getTimeRef()

const TimeADT& Vertica::ParamReader::getTimeRef ( std::string  paramName) const
inline

Get a reference to a TIME value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as a TIME.

◆ getTimestampPtr()

const Timestamp* Vertica::ParamReader::getTimestampPtr ( std::string  paramName) const
inline

Get a pointer to a TIMESTAMP value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a TIMESTAMP.

Referenced by getTimestampRef().

◆ getTimestampRef()

const Timestamp& Vertica::ParamReader::getTimestampRef ( std::string  paramName) const
inline

Get a reference to a TIMESTAMP value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as a TIMESTAMP.

◆ getTimestampTzPtr()

const TimestampTz* Vertica::ParamReader::getTimestampTzPtr ( std::string  paramName) const
inline

Get a pointer to a TIMESTAMP WITH TIMEZONE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a TIMESTAMP WITH TIMEZONE .

Referenced by getTimestampTzRef().

◆ getTimestampTzRef()

const TimestampTz& Vertica::ParamReader::getTimestampTzRef ( std::string  paramName) const
inline

Get a reference to a TIMESTAMP WITH TIMEZONE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as a TIMESTAMP WITH TIMEZONE.

◆ getTimeTzPtr()

const TimeTzADT* Vertica::ParamReader::getTimeTzPtr ( std::string  paramName) const
inline

Get a pointer to a TIME WITH TIMEZONE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a TIME WITH TIMEZONE.

Referenced by getTimeTzRef().

◆ getTimeTzRef()

const TimeTzADT& Vertica::ParamReader::getTimeTzRef ( std::string  paramName) const
inline

Get a reference to a TIME WITH TIMEZONE value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
a reference to the parameter value, cast as a TIME WITH TIMEZONE.

◆ getTypeMetaData() [1/2]

const SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( ) const
inlineinherited
Returns
information about the types and numbers of arguments

Referenced by getType(), Vertica::BlockReader::isNull(), and Vertica::BlockWriter::setNull().

◆ getTypeMetaData() [2/2]

SizedColumnTypes& Vertica::VerticaBlock::getTypeMetaData ( )
inlineinherited
Returns
information about the types and numbers of arguments

◆ getUuidPtr()

VUuid* Vertica::ParamReader::getUuidPtr ( std::string  paramName) const
inline

Get a pointer to a VUuid value from the input row.

Parameters
paramNameThe name of the parameter to retrieve
Returns
A pointer to the retrieved value cast as a VUuid.

◆ remaining()

bool Vertica::VerticaBlock::remaining ( ) const
inlineinherited
Returns
the number of entries remaining in the block

◆ resetForDataAreaFlush()

virtual void Vertica::VerticaBlock::resetForDataAreaFlush ( )
inlinevirtualinherited

Virtual method to be called when the Data Area fills up in a load. Should be called from the StreamWriter class.

Reimplemented in Vertica::StreamWriter.

Member Data Documentation

◆ paramNameToIndex

std::map<std::string, size_t> Vertica::ParamReader::paramNameToIndex