📄 occicontrol.h
字号:
Type type,
sb4 size, ub2 *length, sb2 *ind = NULL,
ub2 *rc = NULL) = 0;
virtual void setDataBufferArray(unsigned int paramIndex, void *buffer,
Type type,
ub4 arraySize, ub4 *arrayLength,
sb4 elementSize,
ub2 *elementLength, sb2 *ind = NULL,
ub2 *rc = NULL) = 0;
virtual void setCharSet(unsigned int paramIndex,
const OCCI_STD_NAMESPACE::string & charSet) = 0;
virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int paramIndex)
const = 0;
virtual void setDatabaseNCHARParam(unsigned int paramIndex, bool isNCHAR) = 0;
virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;
virtual void closeStream(Stream *stream) =0;
virtual Stream * getStream(unsigned int paramIndex) = 0;
virtual unsigned int getCurrentStreamParam() const = 0;
virtual unsigned int getCurrentStreamIteration() const = 0;
virtual void setBinaryStreamMode(unsigned int colIndex, unsigned int size) =0;
virtual void setCharacterStreamMode(unsigned int colIndex, unsigned int size) =0;
virtual void setMaxIterations(unsigned int maxIterations) = 0;
virtual unsigned int getMaxIterations() const = 0;
virtual void addIteration() = 0;
virtual unsigned int getCurrentIteration() const = 0;
virtual Status executeArrayUpdate(unsigned int arrayLength) = 0;
// methods for Callable Statements
virtual void registerOutParam(unsigned int paramIndex, Type type,
unsigned int maxSize=0, const OCCI_STD_NAMESPACE::string &sqltype="") = 0;
virtual bool isNull(unsigned int paramIndex) const = 0;
virtual bool isTruncated(unsigned int paramIndex) const
=0;
virtual void setErrorOnNull(unsigned int paramIndex, bool causeException) = 0;
virtual void setErrorOnTruncate(unsigned int paramIndex,
bool causeException) = 0;
virtual int preTruncationLength(unsigned int paramIndex) const
=0;
virtual int getInt(unsigned int paramIndex) = 0;
virtual unsigned int getUInt(unsigned int paramIndex) = 0;
virtual float getFloat(unsigned int paramIndex) = 0;
virtual double getDouble(unsigned int paramIndex) = 0;
virtual Number getNumber(unsigned int paramIndex) = 0;
virtual OCCI_STD_NAMESPACE::string getString(unsigned int paramIndex) = 0;
virtual Bytes getBytes(unsigned int paramIndex) = 0;
virtual Date getDate(unsigned int paramIndex) = 0;
virtual Timestamp getTimestamp(unsigned int paramIndex) = 0;
virtual Bytes getRowid(unsigned int paramIndex) = 0;
virtual PObject * getObject(unsigned int paramIndex) = 0;
virtual Blob getBlob(unsigned int paramIndex) = 0;
virtual Clob getClob(unsigned int paramIndex) = 0;
virtual Bfile getBfile(unsigned int paramIndex) = 0;
virtual IntervalYM getIntervalYM(unsigned int paramIndex) = 0;
virtual IntervalDS getIntervalDS(unsigned int paramIndex) = 0;
virtual RefAny getRef(unsigned int paramIndex) = 0;
virtual ResultSet * getCursor(unsigned int paramIndex) = 0;
virtual Connection* getConnection() const =0;
};
class ResultSet
{
public:
// class constants
enum Status
{
END_OF_FETCH = 0,
DATA_AVAILABLE,
STREAM_DATA_AVAILABLE
};
virtual ~ResultSet(){}
// public methods
virtual Status next(unsigned int numRows = 1) = 0;
virtual Status status() const = 0;
virtual unsigned int getNumArrayRows() const = 0;
virtual void cancel() = 0;
virtual void setMaxColumnSize(unsigned int colIndex, unsigned int max) = 0;
virtual unsigned int getMaxColumnSize(unsigned int colIndex) const = 0;
virtual bool isNull(unsigned int colIndex) const = 0;
virtual bool isTruncated(unsigned int paramIndex) const
=0;
virtual void setErrorOnNull(unsigned int colIndex, bool causeException) = 0;
virtual void setErrorOnTruncate(unsigned int paramIndex,
bool causeException) =0;
virtual int preTruncationLength(unsigned int paramIndex) const
=0;
virtual int getInt(unsigned int colIndex) = 0;
virtual unsigned int getUInt(unsigned int colIndex) = 0;
virtual float getFloat(unsigned int colIndex) = 0;
virtual double getDouble(unsigned int colIndex) = 0;
virtual Number getNumber(unsigned int colIndex) = 0;
virtual OCCI_STD_NAMESPACE::string getString(unsigned int colIndex) = 0;
virtual Bytes getBytes(unsigned int colIndex) = 0;
virtual Date getDate(unsigned int colIndex) = 0;
virtual Timestamp getTimestamp(unsigned int colIndex) = 0;
virtual Bytes getRowid(unsigned int colIndex) = 0;
virtual PObject * getObject(unsigned int colIndex) = 0;
virtual Blob getBlob(unsigned int colIndex) = 0;
virtual Clob getClob(unsigned int colIndex) =0;
virtual Bfile getBfile(unsigned int colIndex) = 0;
virtual IntervalYM getIntervalYM(unsigned int colIndex) =0;
virtual IntervalDS getIntervalDS(unsigned int colIndex) =0;
virtual RefAny getRef(unsigned int colIndex) = 0;
virtual Bytes getRowPosition() const = 0;
virtual ResultSet * getCursor(unsigned int colIndex) = 0;
virtual void setDataBuffer(unsigned int colIndex, void *buffer, Type type,
sb4 size = 0, ub2 *length = NULL,
sb2 *ind = NULL, ub2 *rc = NULL) = 0;
virtual void setCharSet(unsigned int colIndex,
const OCCI_STD_NAMESPACE::string & charSet) = 0;
virtual OCCI_STD_NAMESPACE::string getCharSet(unsigned int colIndex)
const = 0;
virtual void setBinaryStreamMode(unsigned int colIndex, unsigned int size)
= 0;
virtual void setCharacterStreamMode(unsigned int colIndex, unsigned int size)
= 0;
virtual void setDatabaseNCHARParam(unsigned int paramIndex, bool isNCHAR) = 0;
virtual bool getDatabaseNCHARParam(unsigned int paramIndex) const = 0;
virtual Stream * getStream(unsigned int colIndex) = 0;
virtual void closeStream(Stream *stream) =0;
virtual unsigned int getCurrentStreamColumn() const= 0;
virtual unsigned int getCurrentStreamRow() const= 0;
virtual OCCI_STD_NAMESPACE::vector<MetaData> getColumnListMetaData() const = 0;
virtual Statement* getStatement() const=0;
};
class Stream
{
public :
enum Status {READY_FOR_READ, READY_FOR_WRITE, INACTIVE};
virtual ~Stream(){}
virtual int readBuffer(char *buffer, unsigned int size)
=0;
virtual int readLastBuffer(char *buffer, unsigned int size)
=0;
virtual void writeBuffer(char *buffer, unsigned int size)
=0;
virtual void writeLastBuffer(char *buffer, unsigned int size)
=0;
virtual Status status() const =0;
};
/*---------------------------------------------------------------------------
PROTOTYPES USED BY FUNCTION TEMPLATES
-------------------------------------------------------------------------*/
void getVectorOfPObjects( ResultSet *rs, unsigned int index,
OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
void getVectorOfOCIRefs(ResultSet *rs, unsigned int index,
OCCI_STD_NAMESPACE::vector<void *> &vect) ;
void getVectorOfPObjects( Statement *rs, unsigned int index,
OCCI_STD_NAMESPACE::vector<PObject *> &vect) ;
void getVectorOfOCIRefs(Statement *rs, unsigned int index,
OCCI_STD_NAMESPACE::vector<void *> &vect) ;
void setVectorOfPObjects( Statement *stmt, unsigned int paramIndex,
const OCCI_STD_NAMESPACE::vector<PObject *> &vect,
const OCCI_STD_NAMESPACE::string &sqltype) ;
void setVectorOfOCIRefs(Statement *stmt, unsigned int paramIndex,
const OCCI_STD_NAMESPACE::vector<void *> &vect,
const OCCI_STD_NAMESPACE::vector<OCIInd> &vecind,
const OCCI_STD_NAMESPACE::string &sqltype) ;
/*---------------------------------------------------------------------------
EXPORT FUNCTIONS
---------------------------------------------------------------------------*/
/*------------------------ getVector for objects ---------------------------*/
/*
NAME
getVector - overloaded function. Retrieves the attribute in the current
position as a vector of objects
PARAMETERS
rs - ResultSet
vect- reference to vector of objects(OUT parameter).
DESCRIPTION
Retrieves the column in the specified position as a vector of RefAny.
The attribute at the current position should be a collection type (varray or
nested table). The SQL type of the elements in the collection should be
compatible with objects.
RETURNS
nothing
NOTES
compatible SQL types : NTY
will call getVector(..., vector<PObject*>)
*/
#ifdef WIN32COMMON
// and other platforms that do not support
// partial function template specialization
template <class T>
void getVector( ResultSet *rs, unsigned int index,OCCI_STD_NAMESPACE::vector<T>
& vect)
{
OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
getVectorOfPObjects(rs, index, vec_pobj);
vect.clear();
unsigned int size = vec_pobj.size();
vect.reserve( size );
for ( unsigned int i=0; i< size; i++)
vect.push_back((T)vec_pobj[i]);
}
#else
template <class T>
void getVector( ResultSet *rs, unsigned int index, OCCI_STD_NAMESPACE::vector<T
*> &vect)
{
OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
getVectorOfPObjects(rs, index, vec_pobj);
vect.clear();
unsigned int size = vec_pobj.size();
vect.reserve( size );
for (unsigned int i=0; i< size; i++)
vect.push_back((T *)vec_pobj[i]);
}
#endif
/*------------------------ getVector for objects ---------------------------*/
/*
NAME
getVector - overloaded function. Retrieves the attribute in the current
position as a vector of objects
PARAMETERS
stmt - Statement
vect- reference to vector of objects(OUT parameter).
DESCRIPTION
Retrieves the column in the specified position as a vector of RefAny.
The attribute at the current position should be a collection type (varray or
nested table). The SQL type of the elements in the collection should be
compatible with objects.
RETURNS
nothing
NOTES
compatible SQL types : NTY
will call getVector(..., vector<PObject*>)
*/
#ifdef WIN32COMMON
// and other platforms that do not support
// partial function template specialization
template <class T>
void getVector( Statement *stmt, unsigned int index,
OCCI_STD_NAMESPACE::vector<T> &vect)
{
OCCI_STD_NAMESPACE::vector<PObject *> vec_pobj;
getVectorOfPObjects(stmt, index, vec_pobj);
vect.clear();
unsigned int size = vec_pobj.size();
vect.reserve( size );
for (unsigned int i=0; i< size; i++)
vect.push_back((T)vec_pobj[i]);
}
#else
template <class T>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -