Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages   Examples  

OCICPP::Cursor Class Reference

Representation of a database cursor. More...

Collaboration diagram for OCICPP::Cursor:

Collaboration graph
[legend]
List of all members.

Public Methods

 Cursor ()
 Cursor (OCIEnv *,OCISvcCtx *,OCIError *er, int prefetch, int Type=DEFAULT)
void init (OCIEnv *,OCISvcCtx *,OCIError *er, int prefetch, int Type=DEFAULT)
 ~Cursor ()
void drop ()
void setPrefetch (unsigned nRows)
int prepare (const string &)
void exec ()
void describe ()
void define ()
void hashHead ()
void execute (int prefetch=1)
void bind (const string &par, char *buf, int buflen, short *isNull=0)
void bind (const string &par, const string &val, short *isNull=0)
void bind (const string &par, int &val, short *isNull=0)
void bind (const string &par, double &val, short *isNull=0)
void bind (const string &par, RowID &val, short *isNull=0)
void bind (const string &par, Cursor &val, short *isNull=0)
void bind (const string &par, Lob &val, short *isNull=0)
bool fetch ()
void getStr (int col, string &,bool *isNull=0) const
void getInt (int col, int &val, bool *isNull=0, const int *null_value=0) const
void getDouble (int col, double &val, bool *isNull=0, const double *null_value=0) const
void getStrMon (int col, string &val) const
void getSec (int col, int &val) const
void getMin (int col, int &val) const
void getHour (int col, int &val) const
void getDay (int col, int &val) const
void getMonth (int col, int &val) const
void getYear (int col, int &val) const
void getCLOB (int col, Lob &) const
void getBLOB (int col, Lob &) const
void getFILE (int col, BFile &) const
void getRowID (int col, RowID &) const
void getCursor (int col, Cursor &) const
string getStr (int col, bool *isNull=0) const
int getInt (int col, bool *isNull=0, const int *null_value=0) const
double getDouble (int col, bool *isNull=0, const double *null_value=0) const
void getStr (const string &col, string &val, bool *isNull=0) const
void getInt (const string &col, int &val, bool *isNull=0, const int *null_value=0) const
void getDouble (const string &col, double &val, bool *isNull=0, const double *null_value=0) const
void getStrMon (const string &,string &) const
void getSec (const string &,int &) const
void getMin (const string &,int &) const
void getHour (const string &,int &) const
void getDay (const string &,int &) const
void getMonth (const string &,int &) const
int getDay (int col) const
int getMonth (int col) const
int getYear (int col) const
int getHour (int col) const
int getSec (int col) const
int getMin (int col) const
int getDay (const string &col) const
int getMonth (const string &col) const
int getYear (const string &col) const
int getHour (const string &col) const
int getSec (const string &col) const
int getMin (const string &col) const
void getYear (const string &,int &) const
void getCLOB (const string &col, Lob &lob) const
void getBLOB (const string &col, Lob &lob) const
void getFILE (const string &col, BFile &bfile) const
void getRowID (const string &col, RowID &rid) const
void getCursor (const string &col, Cursor &cur) const
string getStr (const string &col, bool *isNull=0) const
int getInt (const string &col, bool *isNull=0, const int *null_value=0) const
double getDouble (const string &col, bool *isNull=0, const double *null_value=0) const
int getNCols () const
void getColName (int col, string &) const
int getColSize (int col) const
int getColSize (const string &) const
int getColType (int col) const
int getColType (const string &) const
void getColTypeName (int col, string &) const
void getColTypeName (const string &,string &) const
bool isNull (int col) const
bool isNull (const string &) const
void setNullText (const string &)

Detailed Description

Representation of a database cursor.

This class represents a database cursor, which is used to access a set or list of database rows from a single entity or a join of multiple entities.

A cursor may be generate by issuing for example a 'SELECT'-statement, e.g.

  SELECT OWNER,CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME FROM USER_CONSTRAINTS
  

An brief example:

  Connection con;
  Connection::connect( tnsname, user, password, con);
  Cursor *csr = con.execQuery("SELECT OWNER,CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME FROM USER_CONSTRAINTS");
  while ( csr->fetch() ) {
    cout << csr->getStr( 0 ) << "." << csr->getStr( "CONSTRAINT_NAME" ) << endl;
  }

In this example, a cursor is being generated, that can be used to retreive the four columns OWNER , CONSTRAINT_NAME , CONSTRAINT_TYPE , TABLE_NAME from the USER_CONSTRAINTS table. The columns of this cursor may be accessed either by their ordering ( from left to right starting with index 0 ) or by using their column name to index them (be sure to use capital letters when accessing them )


Constructor & Destructor Documentation

OCICPP::Cursor::Cursor ( )
 

Default Constructor: Create a cursor variable, which is not bound to any query (yet). A cursor create in such a manner can for example be used for Connection::execQuery(const string &,Cursor &,int)

OCICPP::Cursor::~Cursor ( )
 

Destructor


Member Function Documentation

void OCICPP::Cursor::drop ( )
 

Clear the content of the cursor. This function may be used to free a cursor variable before reusing it again.

bool OCICPP::Cursor::fetch ( )
 

Fetch the content of the cursor's next row(s) from the database server

Returns:
0 if no new row is available

void OCICPP::Cursor::getBLOB ( const string & colName,
Lob & lob ) const
 

Initializes lob with the content of the binary large object (BLOB) from the column named colName from the cursor's current position.

See also:
void getBLOB(const int ,Lob &) const

void OCICPP::Cursor::getBLOB ( int col,
Lob & lob ) const
 

Initializes lob with the content of the binary large object (BLOB) in column col from the cursor's current position.

See also:
void getBLOB(const string &,Lob &) const

void OCICPP::Cursor::getCLOB ( const string & colName,
Lob & lob ) const
 

Initializes lob with the content of the character large object (CLOB) from the column named colName from the cursor's current position.

See also:
void getCLOB(int,Lob &) const

void OCICPP::Cursor::getCLOB ( int col,
Lob & lob ) const
 

Initializes lob with the content of the character large object (CLOB) in column col from the cursor's current position.

See also:
void getCLOB(const string &,Lob &) const

void OCICPP::Cursor::getColName ( int col,
string & ret_col ) const
 

Retreive the name of column col into ret_col .

int OCICPP::Cursor::getColSize ( const string & colName ) const
 

Retrieve the size for the cursor's column named colName .

See also:
int getColSize(int col) const

int OCICPP::Cursor::getColSize ( int col ) const
 

Retrieve the size for the cursor's column indexed by col . The interpretation of the returned figure depends on the type of the column. For example, if a column of type CHAR has a size of 32, it max store 32 characters.

See also:
int getColSize(const string &) const

int OCICPP::Cursor::getColType ( const string & colName ) const
 

Returns the internal Oracle type for column named colName . col is counted starting from 0 for the first column selected within the current cursor.

The possible return value may be SQLT_CHR, SQLT_NUM, SQLT_DAT and many more (please refer to the Oracle OCI documentation for additional details)

See also:
int getColType(int col) const

int OCICPP::Cursor::getColType ( int col ) const
 

Returns the internal Oracle type for column col . col is counted starting from 0 for the first column selected within the current cursor.

The possible return value may be SQLT_CHR, SQLT_NUM, SQLT_DAT and many more. (please refer to the Oracle OCI documentation for additional details)

See also:
int getColType(const string &colName) const

void OCICPP::Cursor::getColTypeName ( const string & colName,
string & typeName ) const
 

Store the description of the type of the data stored in column named colName into typeName .

See also:
void getColTypeName(int,string &) const

void OCICPP::Cursor::getColTypeName ( int col,
string & typeName ) const
 

Store the description of the type of the data stored in column index by col into typeName .

See also:
void getColTypeName(const string &,string &) const

int OCICPP::Cursor::getDay ( const string & col ) const [inline]
 

If used for a Date-Column named colName, this function returns the day (day of month) from this date.

See also:
void getDay(int,int &) const void getDay(const string &,int &) const int getDay(int col) const

int OCICPP::Cursor::getDay ( int col ) const [inline]
 

If used for a Date-Column col, this function returns the day (day of month) from this date.

See also:
void getDay(int,int &) const void getDay(const string &,int &) const int getDay(const string &col) const

void OCICPP::Cursor::getDay ( const string & colName,
int & val ) const
 

If used for a Date-Column named colName, this function reads the day (day of month) from this date.

See also:
void getDay(int,int &) const int getDay(int col) const int getDay(const string &col) const

void OCICPP::Cursor::getDay ( int col,
int & day ) const
 

If used for a Date-Column col, this function reads the day (day of month) from this date.

See also:
void getDay(const string &,int &) const int getDay(int col) const int getDay(const string &col) const

double OCICPP::Cursor::getDouble ( const string & col,
bool * isNull = 0,
const double * null_value = 0 ) const [inline]
 

Return a double value from the column named col . Unless pointing to 0, *isNull set to TRUE if a NULL-value is retreived in this way. The value returned to the application may be specified by having null_value pointing to it.

See also:
void getDouble(int,double &,bool *,const double *) const, double getDouble(int,bool *,const double *) const, void getDouble(const string &,double &,bool *,const double *) const

void OCICPP::Cursor::getDouble ( const string & colName,
double & val,
bool * isNull = 0,
const double * null_value = 0 ) const
 

Read a double value val from the column named colName . Unless pointing to 0, *isNull set to TRUE if a NULL-value is retreived in this way. The value returned to the application may be specified by having null_value pointing to it.

See also:
void getDouble(int,double &,bool *,const double *) const, double getDouble(int,bool *,const double *) const, double getDouble(const string &,bool *, const double *) const

double OCICPP::Cursor::getDouble ( int col,
bool * isNull = 0,
const double * null_value = 0 ) const [inline]
 

Return a double value from the column indexed by col . Unless pointing to 0, *isNull set to TRUE if a NULL-value is retreived in this way. The value returned to the application may be specified by having null_value pointing to it.

See also:
void getDouble(int,double &,bool *,const double *) const, void getDouble(const string &,double &,bool *,const double *) const, double getDouble(const string &,bool *, const double *) const

void OCICPP::Cursor::getDouble ( int col,
double & val,
bool * isNull = 0,
const double * null_value = 0 ) const
 

Read a double value val from the column indexed by col . Unless pointing to 0, *isNull is set to TRUE if the retreived value is NULL in the sence of the database server. A client-specific value to be returned as val may be supplied by having null_value point to this value.

See also:
double getDouble(int,bool *,const double *) const, void getDouble(const string &,double &,bool *,const double *) const, double getDouble(const string &,bool *, const double *) const

void OCICPP::Cursor::getFILE ( const string & colName,
BFile & bfile ) const
 

Initializes bfile with the content of an external binary large object (BFILE) from the column named colName from the cursor's current position.

See also:
void getFILE(const int,BFile &) const

void OCICPP::Cursor::getFILE ( int col,
BFile & bfile ) const
 

Initializes bfile with the content of an external binary large object (BFILE) from the column col from the cursor's current position.

See also:
void getFILE(const string &,BFile &) const

int OCICPP::Cursor::getHour ( const string & col ) const [inline]
 

If used for a Date-Column col, this function returns the hours stored within this date.

See also:
void getHour(const string &,int &) const void getHour(int,int &) const int getHour(int col) const int getHour(const string &col) const

int OCICPP::Cursor::getHour ( int col ) const [inline]
 

If used for a Date-Column col, this function returns the hours stored within this date.

See also:
void getHour(const string &,int &) const void getHour(int,int &) const int getHour(int col) const int getHour(const string &col) const

void OCICPP::Cursor::getHour ( const string & colName,
int & val ) const
 

If used for a Date-Column col, this function reads the hours hour stored within this date.

See also:
void getHour(int,int &) const int getHour(int col) const int getHour(const string &col) const

void OCICPP::Cursor::getHour ( int col,
int & hour ) const
 

If used for a Date-Column col, this function reads the hours hour stored within this date.

See also:
void getHour(const string &,int &) const int getHour(int col) const int getHour(const string &col) const

int OCICPP::Cursor::getInt ( const string & col,
bool * isNull = 0,
const int * null_value = 0 ) const [inline]
 

Return an integer value from the column named col . Unless pointing to 0, *isNull is set to TRUE if the retreived value is NULL in the sence of the database server. A client-specific value to be returned may be supplied by having null_value point to this value.

See also:
void getInt(int,int &,bool *,const int *) const, int getInt(int,bool *,const int *) const, void getInt(const string &,int &,bool *,const int *) const

void OCICPP::Cursor::getInt ( const string & colName,
int & val,
bool * isNull = 0,
const int * null_value = 0 ) const
 

Read an integer value val from the column named colName . Unless pointing to 0, *isNull is set to TRUE if the retreived value is NULL in the sence of the database server. A client-specific value to be returned as val may be supplied by having null_value point to this value.

See also:
void getInt(int,int &,bool *,const int *) const, int getInt(int,bool *,const int *) const, int getInt(const string &,bool *, const int *) const

int OCICPP::Cursor::getInt ( int col,
bool * isNull = 0,
const int * null_value = 0 ) const [inline]
 

Return an integer value from the column indexed by col . Unless pointing to 0, *isNull is set to TRUE if the retreived value is NULL in the sence of the database server. A client-specific value to be returned may be supplied by having null_value point to this value.

See also:
void getInt(int,int &,bool *,const int *) const, void getInt(const string &,int &,bool *,const int *) const, int getInt(const string &,bool *, const int *) const

void OCICPP::Cursor::getInt ( int col,
int & val,
bool * isNull = 0,
const int * null_value = 0 ) const
 

Read an integer value val from the column indexed by col . Unless pointing to 0, *isNull is set to TRUE if the retreived value is NULL in the sence of the database server. A client-specific value to be returned as val may be supplied by having null_value point to this value.

See also:
int getInt(int,bool *,const int *) const, void getInt(const string &,int &,bool *,const int *) const, int getInt(const string &,bool *, const int *) const

int OCICPP::Cursor::getMin ( const string & col ) const [inline]
 

If used for a Date-Column named colName, this function returns the minutes stored within this date.

See also:
void getMin(const string &,int &) const void getMin(int,int &) const int getMin(int col) const

int OCICPP::Cursor::getMin ( int col ) const [inline]
 

If used for a Date-Column col, this function returns the minutes stored within this date.

See also:
void getMin(const string &,int &) const void getMin(int,int &) const int getMin(const string &col) const

void OCICPP::Cursor::getMin ( const string & colName,
int & val ) const
 

If used for a Date-Column named colName, this function reads the minutes min stored within this date.

See also:
void getMin(int,int &) const int getMin(int col) const int getMin(const string &col) const

void OCICPP::Cursor::getMin ( int col,
int & min ) const
 

If used for a Date-Column col, this function reads the minutes min stored within this date.

See also:
void getMin(const string &,int &) const int getMin(int col) const int getMin(const string &col) const

int OCICPP::Cursor::getMonth ( const string & col ) const [inline]
 

If used for a Date-Column named colName, this function returns the month (month of the year) from this date.

See also:
void getMonth(int,int &) const, void getMonth(const string &,int &) const int getMonth(int col) const int getMonth(const string &col) const void getStrMon(int col,string &mon) const, void getStrMon(const string &,string &) const

int OCICPP::Cursor::getMonth ( int col ) const [inline]
 

If used for a Date-Column col, this function returns the month (month of the year) from this date.

See also:
void getMonth(int,int &) const, void getMonth(const string &,int &) const int getMonth(const string &col) const void getStrMon(int col,string &mon) const void getStrMon(const string &,string &) const

void OCICPP::Cursor::getMonth ( const string & colName,
int & val ) const
 

If used for a Date-Column named colName, this function reads the month val (month of the year) from this date.

See also:
void getMonth(int,int &) const, int getMonth(int col) const int getMonth(const string &col) const void getStrMon(int col,string &mon) const, void getStrMon(const string &,string &) const

void OCICPP::Cursor::getMonth ( int col,
int & mon ) const
 

If used for a Date-Column col, this function reads the month mon (month of the year) from this date.

See also:
void getMonth(const string &,int &) const int getMonth(int col) const int getMonth(const string &col) const void getStrMon(int col,string &mon) const void getStrMon(const string &,string &) const

int OCICPP::Cursor::getNCols ( ) const
 

Returns the number of columns within this cursor.

int OCICPP::Cursor::getSec ( const string & col ) const [inline]
 

If used for a Date-Column named colName, this function returns the seconds stored within this date.

See also:
void getSec(const string &,int &) const void getSec(int,int &) const int getSec(const string &col) const

int OCICPP::Cursor::getSec ( int col ) const [inline]
 

If used for a Date-Column col, this function returns the seconds stored within this date.

See also:
void getSec(const string &,int &) const void getSec(int,int &) const int getSec(int col) const

void OCICPP::Cursor::getSec ( const string & colName,
int & val ) const
 

If used for a Date-Column named colName, this function reads the seconds val stored within this date.

See also:
void getSec(int,int &) const int getSec(int col) const int getSec(const string &col) const

void OCICPP::Cursor::getSec ( int col,
int & sec ) const
 

If used for a Date-Column col, this function reads the seconds sec stored within this date.

See also:
void getSec(const string &,int &) const int getSec(int col) const int getSec(const string &col) const

string OCICPP::Cursor::getStr ( const string & col,
bool * isNull = 0 ) const [inline]
 

Convenience function to retreive a string value from the cursor's current position put of column named colName . If isNull is not pointing to 0, *isNull is set to TRUE if the value retreived in this way was NULL in the database

See also:
void getStr(const string &,string &,bool *) const, void getStr(int,string &,bool *) const, string getStr(int,bool *) const

void OCICPP::Cursor::getStr ( const string & colName,
string & val,
bool * isNull = 0 ) const
 

Retrieve a string value val from the column named colName out of the current cursor position. If isNull is not pointing to 0, it is set according to the returned value.

See also:
void getStr(int,string &,bool *) const, string getStr(const string &,bool *) const, string getStr(int,bool *) const

string OCICPP::Cursor::getStr ( int col,
bool * isNull = 0 ) const [inline]
 

Convenience function to retreive a string value from the cursor's current position put of column col . If isNull is not pointing to 0, *isNull is set to TRUE if the value retreived in this way was NULL in the database

See also:
void getStr(const string &,string &,bool *) const, void getStr(int,string &,bool *) const, string getStr(const string &,bool *) const

void OCICPP::Cursor::getStr ( int col,
string & str,
bool * isNull = 0 ) const
 

Retrieve content from column number col into the string str. If isNull is not pointing to 0, this boolean reflects, if the cell's content was NULL or not.

See also:
void getStr(const string &,string &,bool *) const, string getStr(const string &,bool *) const, string getStr(int,bool *) const

void OCICPP::Cursor::getStrMon ( const string & colName,
string & val ) const
 

Reads the month from a date column named colName and returns the value as mon . mon will be one of the following:

  • "JAN"
  • "FEB"
  • "MAR"
  • "APR"
  • "MAY"
  • "JUN"
  • "JUL"
  • "AUG"
  • "SEP"
  • "OCT"
  • "NOV"
  • "DEC"
See also:
void getMonth(const string &,int &) const, void getMonth(int,int &) const, void getStrMon(int col,string &mon) const

void OCICPP::Cursor::getStrMon ( int col,
string & mon ) const
 

Reads the month from a date column col and returns the value as mon . mon will be one of the following:

  • "JAN"
  • "FEB"
  • "MAR"
  • "APR"
  • "MAY"
  • "JUN"
  • "JUL"
  • "AUG"
  • "SEP"
  • "OCT"
  • "NOV"
  • "DEC"
See also:
void getMonth(const string &,int &) const, void getMonth(int,int &) const, void getStrMon(const string &,string &) const

void OCICPP::Cursor::getYear ( const string & colName,
int & val ) const
 

If used for a Date-Column named colName, this function returns the year from this date.

See also:
void getYear(int ,int &) const int getYear(int col) const int getYear(const string &col) const

int OCICPP::Cursor::getYear ( const string & col ) const [inline]
 

If used for a Date-Column named colName, this function returns the year from this date.

See also:
void getYear(int ,int &) const void getYear(const string &,int &) const int getYear(const string &col) const

int OCICPP::Cursor::getYear ( int col ) const [inline]
 

If used for a Date-Column col, this function reads the year from this date.

See also:
void getYear(int ,int &) const void getYear(const string &,int &) const int getYear(const string &col) const

void OCICPP::Cursor::getYear ( int col,
int & year ) const
 

If used for a Date-Column col, this function reads the year from this date.

See also:
void getYear(const string &,int &) const int getYear(int col) const int getYear(const string &col) const

bool OCICPP::Cursor::isNull ( const string & colName ) const
 

Returns TRUE if the value stored within column named colName is not set in the row the cursor is currently pointing to (equivalent to a NULL-value in SQL-Terms)

See also:
bool isNull(int) const

bool OCICPP::Cursor::isNull ( int col ) const
 

Returns TRUE if the value stored within column col is not set in the row the cursor is currently pointing to (equivalent to a NULL-value in SQL-Terms)

See also:
bool isNull(const string &) const

void OCICPP::Cursor::setNullText ( const string & nulltext )
 

Set's text which will be returned on request of null cell default "" (empty text)


The documentation for this class was generated from the following files:
Generated at Tue Jun 12 10:37:30 2001 for OCI C++ Library by doxygen1.2.4-20010128 written by Dimitri van Heesch, © 1997-2001