DbResult Class Reference
[Public API]

This class represents result of SQL query. More...

#include <database.h>

Inheritance diagram for DbResult:

Inheritance graph
[legend]
Collaboration diagram for DbResult:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Dataset operations
virtual void cancel ()
 Cancel query processing.
virtual int columns () const =0
 Get number of columns.
virtual bool fetchRow ()=0
 Fetches next row from result.
virtual const DbColumngetColumn (int pIndex) const =0
 Get column description.
Data Access
Those functions returns data from current row converting internal data representation to return data type. Field in row can be specified using column index or field name. Column index starts from zero. If SQL type that driver returned is different from returned type, then SQL type is converted to type to return. If conversion fails, then DataException is thrown.

tm getDate (int pField) const
 Get field as date value.
tm getDate (const char *pField) const
 Get field as date value.
double getDouble (int pField) const
 Get field as double value.
double getDouble (const char *pField) const
 Get field as double value.
long getInt (int pField) const
 Get field as int value.
long getInt (const char *pField) const
 Get field as int value.
const char * getString (int pField) const
 Get field as string value.
const char * getString (const char *pField) const
 Get field as string value.
bool isNull (int pField) const
 Check if field contains null value.
bool isNull (const char *pField) const
 Check if field contains null value.

Static Public Attributes

static const struct tm sInvalidTm
 Invalid date and time structure returned for NULL values.

Protected Member Functions

 DbResult ()
 Default constructor.
virtual bool doCheckNull (int pField) const =0
 Driver specific implementation for isNull.
virtual struct tm doGetDate (int pField) const =0
 Driver specific implementation for getDate.
virtual double doGetDouble (int pField) const =0
 Driver specific implementation for getDouble.
virtual long doGetInt (int pField) const =0
 Driver specific implementation for getInt.
virtual const char * doGetString (int pField) const =0
 Driver specific implementation for getString.
virtual int getColumnIndex (const char *pColumnName) const =0
 Driver specific implementation for getting column index by name.

Detailed Description

This class represents result of SQL query.

It allows to discover column names and get data from database as one of four C types.


Member Function Documentation

virtual void cancel  )  [virtual]
 

Cancel query processing.

This operation can be one only once for DbResult and currently is supported for ODBC driver only.

virtual int columns  )  const [pure virtual]
 

Get number of columns.

Returns:
number of columns in result.

virtual struct tm doGetDate int  pField  )  const [protected, pure virtual]
 

Driver specific implementation for getDate.

Parameters:
pField index of column
Returns:
value of field from result
See also:
getDate

virtual double doGetDouble int  pField  )  const [protected, pure virtual]
 

Driver specific implementation for getDouble.

Parameters:
pField index of column
Returns:
value of field from result
See also:
getDouble

virtual long doGetInt int  pField  )  const [protected, pure virtual]
 

Driver specific implementation for getInt.

Parameters:
pField index of column
Returns:
value of field from result
See also:
getInt

virtual const char* doGetString int  pField  )  const [protected, pure virtual]
 

Driver specific implementation for getString.

Parameters:
pField index of column
Returns:
value of field from result
See also:
getString

virtual bool fetchRow  )  [pure virtual]
 

Fetches next row from result.

If database does not support processing multiple queries send on the same connection fetchRow() must return false before next query can be send on the same connection.

Returns:
true if row was successfully fetched or false otherwise.

virtual const DbColumn& getColumn int  pIndex  )  const [pure virtual]
 

Get column description.

Parameters:
pIndex number of column (in query order), starting from zero.
Returns:
i-th column description.

virtual int getColumnIndex const char *  pColumnName  )  const [protected, pure virtual]
 

Driver specific implementation for getting column index by name.

Parameters:
pColumnName name of searched column
Returns:
index of column that has given name
Remarks:
if column is not found then driver should call handleError of DBA_DB_ERROR type

struct tm getDate int  pField  )  const
 

Get field as date value.

Parameters:
pField field index

struct tm getDate const char *  pField  )  const
 

Get field as date value.

Parameters:
pField field name

double getDouble int  pField  )  const
 

Get field as double value.

Parameters:
pField field index

double getDouble const char *  pField  )  const
 

Get field as double value.

Parameters:
pField field name

long getInt int  pField  )  const
 

Get field as int value.

Parameters:
pField field index

long getInt const char *  pField  )  const
 

Get field as int value.

Parameters:
pField field name

const char* getString int  pField  )  const
 

Get field as string value.

Parameters:
pField field index

const char* getString const char *  pField  )  const
 

Get field as string value.

Parameters:
pField field name

bool isNull int  pField  )  const
 

Check if field contains null value.

Parameters:
pField field index
Returns:
true if field is null, false otherwise

bool isNull const char *  pField  )  const
 

Check if field contains null value.

Parameters:
pField field name
Returns:
true if field is null, false otherwise

The documentation for this class was generated from the following file:

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:19 2008