sptk2 logo
SPTK Home Page
Public Member Functions | Friends | List of all members
sptk::QueryParameter Class Reference

#include <QueryParameter.h>

Inheritance diagram for sptk::QueryParameter:
sptk::Variant sptk::VariantAdaptors sptk::BaseVariant

Public Member Functions

void bindAdd (uint32_t bindIndex)
 
uint32_t bindCount () const
 
uint32_t bindIndex (uint32_t ind)
 
uint8_t * conversionBuffer ()
 
long & callbackLength ()
 
 QueryParameter (const char *name, bool isOutput=false)
 
 ~QueryParameter () override=default
 
String name () const
 
void setOutput ()
 
QueryParameteroperator= (const Variant &param)
 
QueryParameteroperator= (int16_t v)
 
QueryParameteroperator= (uint16_t v)
 
QueryParameteroperator= (int32_t v) override
 
QueryParameteroperator= (int64_t v) override
 
QueryParameteroperator= (double v) override
 
QueryParameteroperator= (const char *s) override
 
QueryParameteroperator= (const std::string &s)
 
QueryParameteroperator= (DateTime dt) override
 
QueryParameteroperator= (const uint8_t *value) override
 
QueryParameteroperator= (const Buffer &buffer) override
 
virtual void setString (const char *value)
 
virtual void setString (const char *value, size_t maxlen)
 
void setString (const String &value) override
 
bool isOutput () const
 
QueryParameterBindingbinding ()
 
void reallocateBuffer (const char *value, size_t maxlen, size_t valueLength)
 
- Public Member Functions inherited from sptk::Variant
 Variant ()
 
 Variant (bool value)
 
 Variant (int32_t value)
 
 Variant (int64_t value, unsigned scale=1)
 
 Variant (double value)
 
 Variant (const char *value)
 
 Variant (const String &v)
 
 Variant (const DateTime &v)
 
 Variant (const uint8_t *value, size_t sz)
 
 Variant (const Buffer &value)
 
 Variant (const Variant &other)=default
 
 Variant (Variant &&other) noexcept=default
 
 ~Variant () override
 
Variantoperator= (const Variant &other)
 
Variantoperator= (Variant &&other) noexcept
 
virtual Variantoperator= (bool value)
 
virtual Variantoperator= (int32_t value)
 
virtual Variantoperator= (int64_t value)
 
virtual Variantoperator= (double value)
 
virtual Variantoperator= (const MoneyData &value)
 
virtual Variantoperator= (const char *value)
 
virtual Variantoperator= (const String &value)
 
virtual Variantoperator= (DateTime value)
 
virtual Variantoperator= (const uint8_t *value)
 
virtual Variantoperator= (const Buffer &value)
 
virtual operator bool () const
 
virtual operator int () const
 
virtual operator int64_t () const
 
virtual operator uint64_t () const
 
virtual operator double () const
 
virtual operator String () const
 
virtual operator DateTime () const
 
virtual void load (const std::shared_ptr< xdoc::Node > &element)
 
void save (const std::shared_ptr< xdoc::Node > &node) const
 
- Public Member Functions inherited from sptk::VariantAdaptors
 VariantAdaptors ()=default
 Default constructor.
 
 VariantAdaptors (const VariantAdaptors &other)=default
 Copy constructor. More...
 
 VariantAdaptors (VariantAdaptors &&other) noexcept=default
 Move constructor. More...
 
 ~VariantAdaptors () override=default
 Default destructor.
 
virtual void setBool (bool value)
 
virtual void setInteger (int32_t value)
 
virtual void setInt64 (int64_t value)
 
virtual void setFloat (double value)
 
virtual void setMoney (int64_t value, unsigned scale)
 
virtual void setString (const String &value)
 
virtual void setBuffer (const uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
 
virtual void setExternalBuffer (uint8_t *value, size_t valueSize, VariantDataType type=VariantDataType::VAR_BUFFER)
 
virtual void setDateTime (DateTime value, bool dateOnly=false)
 
virtual void setImagePtr (const uint8_t *value)
 
virtual void setImageNdx (uint32_t value)
 
virtual void setMoney (const MoneyData &value)
 
virtual void setNull (VariantDataType vtype=VariantDataType::VAR_NONE)
 
int asInteger () const
 
int64_t asInt64 () const
 
bool asBool () const
 
double asFloat () const
 
virtual String asString () const
 
DateTime asDate () const
 
DateTime asDateTime () const
 
const uint8_t * asImagePtr () const
 
- Public Member Functions inherited from sptk::BaseVariant
 BaseVariant ()=default
 Default constructor.
 
 BaseVariant (const BaseVariant &other)=default
 Copy constructor. More...
 
 BaseVariant (BaseVariant &&other) noexcept=default
 Move constructor. More...
 
virtual ~BaseVariant ()=default
 Destructor.
 
VariantDataType dataType () const
 
size_t dataSize () const
 
void dataSize (size_t newDataSize)
 
size_t bufferSize () const
 
bool isNull () const
 
template<typename T >
const T & get () const
 Direct and fast const access to variant data. More...
 
template<typename T >
T & get ()
 Direct and fast access to variant data. More...
 
virtual const MoneyDatagetMoney () const
 
virtual const char * getString () const
 
virtual const uint8_t * getExternalBuffer () const
 
virtual const char * getText () const
 
virtual const uint8_t * getImagePtr () const
 
virtual uint32_t getImageNdx () const
 

Friends

class Query
 
class QueryParameterList
 

Additional Inherited Members

- Static Public Member Functions inherited from sptk::BaseVariant
static String typeName (VariantDataType type)
 
static VariantDataType nameType (const char *name)
 
- Protected Member Functions inherited from sptk::VariantAdaptors
void setData (const BaseVariant &other)
 
const char * getBufferPtr () const
 
- Protected Member Functions inherited from sptk::BaseVariant
void dataType (VariantType newDataType)
 
void dataType (VariantDataType newDataType)
 
bool isExternalBuffer () const
 
virtual String moneyDataToString () const
 
- Protected Attributes inherited from sptk::BaseVariant
VariantData m_data
 Internal variant data storage.
 

Detailed Description

SQL query parameter.

Simplifies the ODBC parameter binding. Automatically handles most of the data conversions on assignments.

Constructor & Destructor Documentation

◆ QueryParameter()

sptk::QueryParameter::QueryParameter ( const char *  name,
bool  isOutput = false 
)
explicit

Constructor

Parameters
namechar *, parameter name
isOutputbool, parameter binding type: input or output

◆ ~QueryParameter()

sptk::QueryParameter::~QueryParameter ( )
overridedefault

Destructor

Member Function Documentation

◆ bindAdd()

void sptk::QueryParameter::bindAdd ( uint32_t  bindIndex)

Adds internal parameter binding index

◆ bindCount()

uint32_t sptk::QueryParameter::bindCount ( ) const

Returns internal parameter binding count

◆ bindIndex()

uint32_t sptk::QueryParameter::bindIndex ( uint32_t  ind)

Returns the parameter bing position by index in the binding list

◆ binding()

QueryParameterBinding & sptk::QueryParameter::binding ( )
inline

The last successfull binding information

Returns
binding information

◆ callbackLength()

long & sptk::QueryParameter::callbackLength ( )
inline

An integer reserved to callback parameter data length

◆ conversionBuffer()

uint8_t * sptk::QueryParameter::conversionBuffer ( )
inline

Returns the internal small conversion buffer used to convert the date structure to SPTK.

Please, don't use it directly.

◆ isOutput()

bool sptk::QueryParameter::isOutput ( ) const
inline

Returns true if parameter is output parameter

◆ name()

String sptk::QueryParameter::name ( ) const

Returns parameter name

◆ operator=() [1/11]

QueryParameter & sptk::QueryParameter::operator= ( const Buffer buffer)
inlineoverridevirtual

Assign operator

Parameters
bufferData buffer

Reimplemented from sptk::Variant.

References sptk::BufferStorage::bytes(), and sptk::BufferStorage::data().

◆ operator=() [2/11]

QueryParameter & sptk::QueryParameter::operator= ( const char *  s)
inlineoverridevirtual

Assign operator

Reimplemented from sptk::Variant.

◆ operator=() [3/11]

QueryParameter & sptk::QueryParameter::operator= ( const std::string &  s)
inline

Assign operator

◆ operator=() [4/11]

QueryParameter & sptk::QueryParameter::operator= ( const uint8_t *  value)
inlineoverridevirtual

Assignment operator

Reimplemented from sptk::Variant.

◆ operator=() [5/11]

QueryParameter & sptk::QueryParameter::operator= ( const Variant param)

Assign operator

◆ operator=() [6/11]

QueryParameter & sptk::QueryParameter::operator= ( DateTime  dt)
inlineoverridevirtual

Assign operator

Reimplemented from sptk::Variant.

◆ operator=() [7/11]

QueryParameter & sptk::QueryParameter::operator= ( double  v)
inlineoverridevirtual

Assign operator

Reimplemented from sptk::Variant.

◆ operator=() [8/11]

QueryParameter & sptk::QueryParameter::operator= ( int16_t  v)
inline

Assign operator

◆ operator=() [9/11]

QueryParameter & sptk::QueryParameter::operator= ( int32_t  v)
inlineoverridevirtual

Assign operator

Reimplemented from sptk::Variant.

◆ operator=() [10/11]

QueryParameter & sptk::QueryParameter::operator= ( int64_t  v)
inlineoverridevirtual

Assign operator

Reimplemented from sptk::Variant.

◆ operator=() [11/11]

QueryParameter & sptk::QueryParameter::operator= ( uint16_t  v)
inline

Assign operator

◆ setOutput()

void sptk::QueryParameter::setOutput ( )

Set parameter type to output

◆ setString() [1/3]

virtual void sptk::QueryParameter::setString ( const char *  value)
inlinevirtual

String assignment method

In contrast to CVariant::setString() method, this method tries not to decrease the allocated buffer.

Parameters
valueconst char*, string to assign

◆ setString() [2/3]

virtual void sptk::QueryParameter::setString ( const char *  value,
size_t  maxlen 
)
virtual

String assignment method

In contrast to CVariant::setString() method, this method tries not to decrease the allocated buffer.

Parameters
valueconst char*, string to assign
maxlensize_t, maximum length of the assigned string

◆ setString() [3/3]

void sptk::QueryParameter::setString ( const String value)
inlineoverridevirtual

String assignment method

In contrast to CVariant::setString() method, this method tries not to decrease the allocated buffer.

Parameters
valueconst string&, string to assign

Reimplemented from sptk::VariantAdaptors.


The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:44: SPTK 5.4.1