PTLib
Version 2.18.8
|
PODBC::RecordSet
This is the main Class to access Data returned by a Select Query. More...
#include <podbc.h>
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 | |
Field & | Column (PINDEX column) |
Returns the indicated Column Holder for the RecordSet, | |
Field & | Column (const PString &name) |
Returns the indicated Column Holder Name for the RecordSet,. More... | |
bool | Commit () |
Commit data to record set. More... | |
![]() | |
__inline unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
__inline void | SetTraceContextIdentifier (unsigned id) |
__inline void | SetTraceContextIdentifier (const PObject &obj) |
__inline void | SetTraceContextIdentifier (const PObject *obj) |
__inline void | CopyTraceContextIdentifier (PObject &obj) const |
__inline void | CopyTraceContextIdentifier (PObject *obj) const |
virtual | ~PObject () |
__inline const char * | GetClass () const |
__inline bool | IsClass (const char *name) const |
__inline const PObject * | PTraceObjectInstance () const |
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 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 |
![]() | |
unsigned | m_traceContextIdentifier |
Additional Inherited Members | |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
![]() | |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject *from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject *from) |
static __inline const char * | Class () |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
template<typename T > | |
static Comparison | Compare2 (T v1, T v2) |
Compare two types, returning Comparison type. More... | |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
PODBC::RecordSet
This is the main Class to access Data returned by a Select Query.
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 | ( | ) |
Destroy the record set and free resources used.
|
inline |
Returns the indicated Column Holder for the RecordSet,
This can be used for iterative Row calls.
References PODBC::Row::Column(), and m_cursor.
Returns the indicated Column Holder Name for the RecordSet,.
References PODBC::Row::Column(), and m_cursor.
|
inline |
Column Name.
References PODBC::Row::ColumnName(), and m_cursor.
|
inline |
ColumnNames.
Return the list of column Names of the Resultant RecordSet
References PODBC::Row::ColumnNames(), and m_cursor.
|
inline |
Columns.
Returns the Number of Columns in the Resultant RecordSet
References PODBC::Row::Columns(), and m_cursor.
|
inline |
Commit data to record set.
References PODBC::Row::Commit(), and m_cursor.
|
inline |
First record.
References PODBC::Row::First(), and m_cursor.
|
inline |
Last record.
References PODBC::Row::Last(), and m_cursor.
|
inline |
Move to row relative to current position.
References m_cursor, and PODBC::Row::Move().
|
inline |
Move to Specified Row.
References m_cursor, and PODBC::Row::MoveTo().
|
inline |
Next record.
References m_cursor, and PODBC::Row::Next().
Row& PODBC::RecordSet::operator[] | ( | PINDEX | row | ) |
Row return the fetched row in the Cached RecordSet.
An Array of PODBC::Field Index is 1 based.
|
inline |
References PODBC::Row::Commit(), and m_cursor.
|
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.
fields | '*' if empty |
|
protected |
Referenced by Column(), ColumnName(), ColumnNames(), Columns(), Commit(), First(), Last(), Move(), MoveTo(), Next(), Post(), and Previous().
|
protected |
|
protected |