Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

CDBquery Class Reference

The next database library query and execution class. More...

#include <CDB.h>


Public Member Functions

int bind (const CDBstring &name, const Ttime &data)
int bind (const CDBstring &name, const Tdate &data)
int bind (const CDBstring &name, const Tdatetime &data)
int bind (const CDBstring &name, const CDBstring &data)
int bind (const CDBstring &name, double data)
int bind (const CDBstring &name, float data)
int bind (const CDBstring &name, int16_t data)
int bind (const CDBstring &name, int data)
int bind (int pos, const Ttime &data)
int bind (int pos, const Tdate &data)
int bind (int pos, const Tdatetime &data)
int bind (int pos, const CDBstring &data)
int bind (int pos, double data)
int bind (int pos, float data)
int bind (int pos, int64_t data)
int bind (int pos, int data)
int bind_count ()
bool bind_filled (int pos)
bool bind_finished ()
int bind_get_pos_by_name (const CDBstring &name, int *res, int *res_size)
int bind_reset ()
int bind_to_next ()
 CDBquery (CDBconnection *c)
 CDBquery ()
void close ()
 Close current query and release all associated memory.
int cols ()
 Get number of columns in rowset.
int exec (const CDBstring &str_sql)
 Method to execute sql statements without resultset.
char * getBuffer (int size)
int open (const CDBstring &str_sql)
 Method to execute sql statements with resultset.
CDBqueryoperator<< (CDBrow r)
 (experimental) Fill missing bindvariables with values from other row.
CDBqueryoperator<< (const CDB_NULL_T &n)
 Fill next bindvariable with NULL value.
CDBqueryoperator<< (const Tdatetime &dt)
 Fill next bindvariable with Tdatetime value.
CDBqueryoperator<< (const Ttime &t)
 Fill next bindvariable with Ttime value.
CDBqueryoperator<< (const Tdate &d)
 Fill next bindvariable with Tdate value.
CDBqueryoperator<< (const CDBstring &s)
 Fill next bindvariable with string (const char*) value.
CDBqueryoperator<< (double f)
 Fill next bindvariable with double value.
CDBqueryoperator<< (float f)
 Fill next bindvariable with float value.
CDBqueryoperator<< (int64_t i)
 Fill next bindvariable with int64_t value.
CDBqueryoperator<< (int i)
 Fill next bindvariable with int value.
CDBrow operator[] (int i)
 Retrieve specified row.
int process ()
int rows ()
 Get number of rows in resultset.
CDBstring sqlerr ()
 Retrieve erros thrown by sql backend or catched previosly by driver.
 ~CDBquery ()

Data Fields

CDBconnectionmDB
Tptr mres

Private Attributes

std::list< char * > mBuffVec
char opened


Detailed Description

The next database library query and execution class.

This class implements the main functionality of database operations. It executes statements and/or retrieve resultsets. With many operators You can fill bindvariables or retrieve rowsets. It is recommened to allocated this class with the new operator. If you allocate this class statically, you can run into memory problems during exception handling. Think about it.


Constructor & Destructor Documentation

CDBquery  ) 
 

CDBquery CDBconnection c  ) 
 

~CDBquery  ) 
 


Member Function Documentation

int bind const CDBstring name,
const Ttime data
 

int bind const CDBstring name,
const Tdate data
 

int bind const CDBstring name,
const Tdatetime data
 

int bind const CDBstring name,
const CDBstring data
 

int bind const CDBstring name,
double  data
 

int bind const CDBstring name,
float  data
 

int bind const CDBstring name,
int16_t  data
 

int bind const CDBstring name,
int  data
 

int bind int  pos,
const Ttime data
 

int bind int  pos,
const Tdate data
 

int bind int  pos,
const Tdatetime data
 

int bind int  pos,
const CDBstring data
 

int bind int  pos,
double  data
 

int bind int  pos,
float  data
 

int bind int  pos,
int64_t  data
 

int bind int  pos,
int  data
 

int bind_count  ) 
 

bool bind_filled int  pos  ) 
 

bool bind_finished  ) 
 

int bind_get_pos_by_name const CDBstring name,
int *  res,
int *  res_size
 

int bind_reset  ) 
 

int bind_to_next  ) 
 

void close  ) 
 

Close current query and release all associated memory.

Call this method before reopen or reexec an query instance.

int cols  ) 
 

Get number of columns in rowset.

int exec const CDBstring str_sql  ) 
 

Method to execute sql statements without resultset.

This method is used to execute sql statementes that does not return a resultset like a 'update ...' statement does. It is not recommend to execute statements like 'select ...' or else which does return a resultset.

Parameters:
str_sql The sql string which should be eecuted.
Returns:
0 or -1 if error (but impossible to retrieve because exception thrown on error)

char* getBuffer int  size  ) 
 

int open const CDBstring str_sql  ) 
 

Method to execute sql statements with resultset.

This method is used to execute sql statementes that return a resultset like a 'select ...' statement does. It is not recommend to execute statements like 'update ...' or else which does not return a resultset.

Parameters:
str_sql The sql string which should be eecuted.
Returns:
0 or -1 if error (but impossible to retrieve because exception thrown on error)

CDBquery& operator<< CDBrow  r  ) 
 

(experimental) Fill missing bindvariables with values from other row.

This operator searches for a field named like the next missing bindvariable. Then it calls the associated conversion method from the field which selects the correct bind operator. This operator should be an efficiently way to fill binvariables with values from another rowset.

CDBquery& operator<< const CDB_NULL_T n  ) 
 

Fill next bindvariable with NULL value.

CDBquery& operator<< const Tdatetime dt  ) 
 

Fill next bindvariable with Tdatetime value.

CDBquery& operator<< const Ttime t  ) 
 

Fill next bindvariable with Ttime value.

CDBquery& operator<< const Tdate d  ) 
 

Fill next bindvariable with Tdate value.

CDBquery& operator<< const CDBstring s  ) 
 

Fill next bindvariable with string (const char*) value.

CDBquery& operator<< double  f  ) 
 

Fill next bindvariable with double value.

CDBquery& operator<< float  f  ) 
 

Fill next bindvariable with float value.

CDBquery& operator<< int64_t  i  ) 
 

Fill next bindvariable with int64_t value.

CDBquery& operator<< int  i  ) 
 

Fill next bindvariable with int value.

CDBrow operator[] int  i  ) 
 

Retrieve specified row.

Retrieve specified number of row. The first row has 0. Use rows()-method to determine how many rows are returned.

int process  ) 
 

int rows  ) 
 

Get number of rows in resultset.

CDBstring sqlerr  ) 
 

Retrieve erros thrown by sql backend or catched previosly by driver.


Field Documentation

std::list<char*> mBuffVec [private]
 

CDBconnection* mDB
 

Tptr mres
 

char opened [private]
 


Generated on Mon Feb 6 00:30:32 2006 for CDB by  doxygen 1.4.4