PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
PODBC::RecordSet Class Reference

    PODBC::RecordSet

This is the main Class to access Data returned by a Select Query. More...

`#include <podbc.h>`

Inheritance diagram for PODBC::RecordSet:
[legend]
Collaboration diagram for PODBC::RecordSet:
[legend]

## Public Member Functions
bool | Post ()
Constructor/Deconstructor
| RecordSet (PODBC &odbc, const PString &query=PString::Empty())
    Constructor
Using the HDBC and TableName/Select SQL Query creates a virtual table in the OBDC driver. More...
| RecordSet (PODBC *odbc, const PString &query)
| ~RecordSet ()
| Destroy the record set and free resources used. More...
Data Storage
bool | Query (const PString &query)
| Set the SQL query for this record set. More...
bool | Select (const PString &table, const PString &whereClause=PString::Empty(), const PString &fields=PString::Empty(), const PString &orderedBy=PString::Empty(), bool descending=false)
| Set the SQL query to a SELECT for this record set. More...
RowIndex | Rows (bool forceCount=true)
| Returns the Number of Rows in the Resultant RecordSet. More...
PINDEX | Columns ()
| Columns. More...
PString | ColumnName (PINDEX column)
| Column Name. More...
PStringArray | ColumnNames ()
| ColumnNames. More...
Row & | NewRow ()
| Add New Row. More...
bool | MoveTo (RowIndex row)
| Move to Specified Row. More...
bool | Move (int offset)
| Move to row relative to current position. More...
bool | First ()
| First record. More...
bool | Next ()
| Next record. More...
bool | Previous ()
| Previous record. More...
bool | Last ()
| Last record. More...
bool | DeleteRow (RowIndex row=0)
| Delete Row 0 indicates Current Row. More...
Row & | operator[] (PINDEX row)
| Row return the fetched row in the Cached RecordSet. More...
Field & | operator() (RowIndex row, PINDEX col)
    Returns the Field data at a predetermined position in the Resultant
RecordSet. More...
Field & | Column (PINDEX column)
    Returns the indicated Column Holder for the RecordSet,
This can be used for iterative Row calls. More...
Field & | Column (const PString &name)
| Returns the indicated Column Holder Name for the RecordSet,. More...
bool | Commit ()
| Commit data to record set. More...
Public Member Functions inherited from PObject
unsigned | GetTraceContextIdentifier () const
| Get PTRACE context identifier. More...
void | SetTraceContextIdentifier (unsigned id)
void | GetTraceContextIdentifier (PObject &obj)
void | GetTraceContextIdentifier (PObject *obj)
void | SetTraceContextIdentifier (const PObject &obj)
void | SetTraceContextIdentifier (const PObject *obj)
virtual | ~PObject ()
virtual PObject * | Clone () const
| Create a copy of the class on the heap. More...
template<class CLS >
CLS * | CloneAs () const
| As for Clone() but converts to specified type. More...
virtual PINDEX | HashFunction () const
| This function yields a hash value required by the `PDictionary` class. More...
virtual const char * | GetClass (unsigned ancestor=0) const
| Get the current dynamic type of the object instance. More...
PBoolean | IsClass (const char *cls) const
virtual PBoolean | InternalIsDescendant (const char *clsName) const
| Determine if the dynamic type of the current instance is a descendent of the specified class. More...
__inline const PObject * | PTraceObjectInstance () const
virtual Comparison | Compare (const PObject &obj) const
| Compare the two objects and return their relative rank. More...
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const
| Determine the byte wise comparison of two objects. More...
bool | operator== (const PObject &obj) const
| Compare the two objects. More...
bool | operator!= (const PObject &obj) const
| Compare the two objects. More...
bool | operator< (const PObject &obj) const
| Compare the two objects. More...
bool | operator> (const PObject &obj) const
| Compare the two objects. More...
bool | operator<= (const PObject &obj) const
| Compare the two objects. More...
bool | operator>= (const PObject &obj) const
| Compare the two objects. More...
virtual void | PrintOn (ostream &strm) const
| Output the contents of the object to the stream. More...
virtual void | ReadFrom (istream &strm)
| Input the contents of the object from the stream. More...

## Protected Attributes
Statement * | m_statement
RowIndex | m_totalRows
Row | m_cursor
Protected Attributes inherited from PObject
unsigned | m_traceContextIdentifier

## Additional Inherited Members
Public Types inherited from PObject
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
| Result of the comparison operation performed by the `Compare()` function. More...
Static Public Member Functions inherited from PObject
static const char * | Class ()
| Get the name of the class as a C string. More...
static __inline const PObject * | PTraceObjectInstance (const char *)
static __inline const PObject * | PTraceObjectInstance (const PObject *obj)
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
| Internal function caled from CompareObjectMemoryDirect() More...
Protected Member Functions inherited from PObject
| PObject ()
| Constructor for PObject, made protected so cannot ever create one on its own. More...
Friends inherited from PObject

## Detailed Description

    PODBC::RecordSet

This is the main Class to access Data returned by a Select Query.

## Constructor & Destructor Documentation

PODBC::RecordSet::RecordSet | ( | PODBC & | odbc,
|  | const PString & | query = `PString::Empty()`
| ) |  |

    Constructor

Using the HDBC and TableName/Select SQL Query creates a virtual table in the OBDC driver.

PODBC::RecordSet::RecordSet | ( | PODBC * | odbc,
|  | const PString & | query
| ) |  |

PODBC::RecordSet::~RecordSet | ( |  | ) |

Destroy the record set and free resources used.

## Member Function Documentation

Field& PODBC::RecordSet::Column | ( | PINDEX | column | ) |
| inline

    Returns the indicated Column Holder for the RecordSet,

This can be used for iterative Row calls.

References PODBC::Row::Column(), and m_cursor.

Field& PODBC::RecordSet::Column | ( | const PString & | name | ) |
| inline

Returns the indicated Column Holder Name for the RecordSet,.

References PODBC::Row::Column(), and m_cursor.

PString PODBC::RecordSet::ColumnName | ( | PINDEX | column | ) |
| inline

Column Name.

References PODBC::Row::ColumnName(), and m_cursor.

PStringArray PODBC::RecordSet::ColumnNames | ( |  | ) |
| inline

ColumnNames.

Return the list of column Names of the Resultant RecordSet

References PODBC::Row::ColumnNames(), and m_cursor.

PINDEX PODBC::RecordSet::Columns | ( |  | ) |
| inline

Columns.

Returns the Number of Columns in the Resultant RecordSet

References PODBC::Row::Columns(), and m_cursor.

bool PODBC::RecordSet::Commit | ( |  | ) |
| inline

Commit data to record set.

References PODBC::Row::Commit(), and m_cursor.

bool PODBC::RecordSet::DeleteRow | ( | RowIndex | row = `0` | ) |

Delete Row 0 indicates Current Row.

bool PODBC::RecordSet::First | ( |  | ) |
| inline

First record.

References PODBC::Row::First(), and m_cursor.

bool PODBC::RecordSet::Last | ( |  | ) |
| inline

Last record.

References PODBC::Row::Last(), and m_cursor.

bool PODBC::RecordSet::Move | ( | int | offset | ) |
| inline

Move to row relative to current position.

References m_cursor, and PODBC::Row::Move().

bool PODBC::RecordSet::MoveTo | ( | RowIndex | row | ) |
| inline

Move to Specified Row.

References m_cursor, and PODBC::Row::MoveTo().

Row& PODBC::RecordSet::NewRow | ( |  | ) |

Add New Row.

bool PODBC::RecordSet::Next | ( |  | ) |
| inline

Next record.

References m_cursor, and PODBC::Row::Next().

Field& PODBC::RecordSet::operator() | ( | RowIndex | row,
|  | PINDEX | col
| ) |  |

    Returns the Field data at a predetermined position in the Resultant

RecordSet.

It Fetches the Row than isolates the Column from the fetched data.

Row& PODBC::RecordSet::operator[] | ( | PINDEX | row | ) |

Row return the fetched row in the Cached RecordSet.

An Array of PODBC::Field Index is 1 based.

bool PODBC::RecordSet::Post | ( |  | ) |
| inline

References PODBC::Row::Commit(), and m_cursor.

bool PODBC::RecordSet::Previous | ( |  | ) |
| inline

Previous record.

References m_cursor, and PODBC::Row::Previous().

bool PODBC::RecordSet::Query | ( | const PString & | query | ) |

Set the SQL query for this record set.

If `query` matches a table then a simple SELECT is made.

RowIndex PODBC::RecordSet::Rows | ( | bool | forceCount = `true` | ) |

Returns the Number of Rows in the Resultant RecordSet.

Note this can be a very time expensive operation, so only set forceCount if really you want it.

bool PODBC::RecordSet::Select | ( | const PString & | table,
|  | const PString & | whereClause = `PString::Empty()`,
|  | const PString & | fields = `PString::Empty()`,
|  | const PString & | orderedBy = `PString::Empty()`,
|  | bool | descending = `false`
| ) |  |

Set the SQL query to a SELECT for this record set.

Parameters

  fields | '*' if empty

## Member Data Documentation

Row PODBC::RecordSet::m_cursor
| protected

Referenced by Column(), ColumnName(), ColumnNames(), Columns(), Commit(), First(), Last(), Move(), MoveTo(), Next(), Post(), and Previous().

Statement* PODBC::RecordSet::m_statement
| protected

RowIndex PODBC::RecordSet::m_totalRows
| protected

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

- podbc.h