PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
Collaboration diagram for PODBC::RecordSet:

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...
 
RowNewRow ()
 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...
 
Rowoperator[] (PINDEX row)
 Row return the fetched row in the Cached RecordSet. More...
 
Fieldoperator() (RowIndex row, PINDEX col)
 
Returns the Field data at a predetermined position in the Resultant

RecordSet. More...

 
FieldColumn (PINDEX column)
 
Returns the indicated Column Holder for the RecordSet,

This can be used for iterative Row calls. More...

 
FieldColumn (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
__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 PObjectPTraceObjectInstance () const
 
virtual PObjectClone () 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

Statementm_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 __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 PObjectPTraceObjectInstance (const char *)
 
static __inline const PObjectPTraceObjectInstance (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...
 
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 

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
Statement* PODBC::RecordSet::m_statement
protected
RowIndex PODBC::RecordSet::m_totalRows
protected

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