21 #ifndef ORACLEPARAMETER_H
22 #define ORACLEPARAMETER_H
28 #include "../DataParameter.h"
34 #define __MSXML_LIBRARY_DEFINED__
36 #define sleep(x) Sleep( (x)*1000 )
58 :
DataParameter< T >( paramDirection ), m_hBind( NULL ), m_IndicatorVariable( 0 ) {}
66 :
DataParameter< T >( paramName, paramDirection ), m_hBind( NULL ), m_IndicatorVariable( 0 ) {}
83 inline void setValue( T columnValue )
85 DEBUG2(
"Set value [" << columnValue <<
"]" );
95 inline T getValue()
const
97 DEBUG2(
"Get value [" << m_Value <<
"]" );
105 inline void setDimension(
const unsigned int dimension )
107 DataParameterBase::setDimension( dimension );
114 inline unsigned int getDimension()
const
116 return DataParameterBase::getDimension();
119 inline void push_back(
const string& value ) {
throw logic_error(
"Not supported by this data type"); }
120 inline const string&
getElement(
size_t position )
const {
throw logic_error(
"Not supported by this data type"); }
126 inline void** getBindHandle()
128 return (
void ** )&m_hBind;
131 void* getIndicatorValue()
133 return (
void * )&m_IndicatorVariable;
136 bool isNULLValue()
const
138 return ( m_IndicatorVariable == -1 );
161 return DataType::ARRAY;
173 return m_Value.size();
179 return m_Value[position];
187 return m_Dimension + 1;
195 DEBUG2(
"Set dimension [" << dimension <<
"]" );
196 DataParameterBase::setDimension( dimension );
198 if( m_StoragePointer != NULL )
199 delete[] m_StoragePointer;
201 m_StoragePointer =
new unsigned char[ m_Dimension + 1 ];
202 memset( m_StoragePointer, 0, m_Dimension + 1 );
210 string::size_type paramLength = columnValue.length();
211 DEBUG2(
"Dimension : [" << m_Dimension <<
"] Address : [" << m_StoragePointer <<
"]" );
213 if( m_StoragePointer == NULL )
215 DEBUG2(
"Dimension : [" << m_Dimension <<
"] Address : [" << m_StoragePointer <<
"]" );
217 if( m_Dimension < paramLength )
219 TRACE(
"Parameter storage size is less than source. Data right truncation from " << paramLength <<
" chars to " << m_Dimension );
220 memcpy( m_StoragePointer, columnValue.c_str(), m_Dimension );
225 DEBUG2(
"Storage size ok." );
226 memcpy( m_StoragePointer, columnValue.c_str(), paramLength );
233 string returnValue = string( (
char* )m_StoragePointer, m_Dimension );
237 DEBUG2(
"Get value : [" << returnValue <<
"]" );
249 DEBUG2(
"Destructor" );
250 if( m_StoragePointer != NULL )
252 delete[] m_StoragePointer;
253 m_StoragePointer = NULL;
257 #endif //ORACLEPARAMETER_H