fatalmind::SQL::SQLFetcher Class Reference

#include <SQLFetcher.hh>

Inherited by fatalmind::mysql::EscalateWarnings, fatalmind::SQL::NopSQLFetcher, and PrintFetcher.

List of all members.


Detailed Description

This class allows fetching of data (rows) from SQLSelect or SQLSelectRow commands.

To fetch data you must derive a "Fetcher" from this class and pass it to SQLSelect or SQLSelectRow constructor. For each retrieved row the bound output parameters are set and the process() method is invoked. Implementations can stop the retrieval by returning "false" from their process() implementation.

Optionally you can also overwrite the done() method which is called when the retrieval has finished.

The usage of a Fetcher is the only way to retrieve multiple rows and it is therefore an mandatory parameter to all SQLSelect constructors. For single row fetching via SQLSelectRow a fetcher class is an optional parameter, alternativley you can just access the output parameters after completion of the SQLSelectRow command.

It is best current pratice to let your SQLFetcher implementation own the actual bindout varaibles. Please have a look at the select.cc example.

Please also not that it is currently the callers responsibility to make sure the SQLFetcher instance which is passed to SQLSelect or SQLSelectRow remains valid for the complete lifetime of the respective SQLSelect object since it is used by reference (very bad practice).

Since:
0.99.22

Public Member Functions

virtual bool process (int row)=0
 This method is to be overwritten by the user and will be invoked for each row.
virtual void done (bool more, int fetched)
 This method is called if all records were fetched succesfully.

Member Function Documentation

virtual bool fatalmind::SQL::SQLFetcher::process ( int  row  )  [pure virtual]

This method is to be overwritten by the user and will be invoked for each row.

The variables you have bound are filled accordingly.

As implementor of this method you may chose to stop fetching of more data. You can do so by returning false.

Parameters:
[in] row The rownumber to be processed. Starting at 0.
Returns:
true - to proceed fetching of further records

false - to stop fetching and terminate the SQLSelect execution

virtual void fatalmind::SQL::SQLFetcher::done ( bool  more,
int  fetched 
) [inline, virtual]

This method is called if all records were fetched succesfully.

This method will NOT be called if execution was aborted because of an exception.

The default implementation does nothing.

Parameters:
[in] more Indicates if all data was fetched (false) or if (eventually) more data could have been fetched (true).
[in] fetched The number of records fetched


The documentation for this class was generated from the following file:
Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3