21 #ifndef ODBCPARAMETER_H
22 #define ODBCPARAMETER_H
24 #include "../DataParameter.h"
49 :
DataParameter< T >( paramDirection ), m_StrLen_or_IndPtr( NULL ) {}
65 inline void setValue( T columnValue )
72 inline void push_back(
const string& value ) {
throw logic_error(
"Not supported by this data type"); }
73 inline const string&
getElement(
size_t position )
const {
throw logic_error(
"Not supported by this data type"); }
75 inline T getValue()
const
81 inline void setDimension(
const unsigned int dimension )
83 DataParameterBase::setDimension( dimension );
86 inline unsigned int getDimension()
const
88 return DataParameterBase::getDimension();
91 bool isNULLValue()
const
93 return ( m_StrLen_or_IndPtr == SQL_NULL_DATA );
107 return DataType::ARRAY;
113 return m_Value.size();
119 return m_Value[position];
125 m_Value = columnValue;
126 m_Dimension= m_Value.size();
134 return m_Dimension + 1;
140 DataParameterBase::setDimension( dimension );
142 delete[] m_StoragePointer;
143 m_StoragePointer = NULL;
145 m_StoragePointer =
new unsigned char[ m_Dimension + 1 ];
146 memset( m_StoragePointer, 0, m_Dimension + 1 );
154 memcpy( m_StoragePointer, columnValue.c_str(), m_Dimension );
158 case DataType::CHAR_TYPE:
159 case DataType::LARGE_CHAR_TYPE:
160 case DataType::DATE_TYPE:
161 m_StrLen_or_IndPtr = SQL_NTS;
163 case DataType::BINARY :
164 m_StrLen_or_IndPtr = m_Dimension;
172 return string( reinterpret_cast<char*>(m_StoragePointer), m_Dimension );
178 delete[] m_StoragePointer;
182 #endif // ODBCPARAMETER_H