fatalmind::SQL::RTSQLSelect< TM > Class Template Reference

#include <RTSQLSelect.hh>

Inherits fatalmind::SQL::BindInterface, and fatalmind::SQL::BindOutInterface.

List of all members.


Detailed Description

template<class TM>
class fatalmind::SQL::RTSQLSelect< TM >

A command to issue a select statement against an SQL database.

The general workflow to issue an SQL select statement is:

Please refer to the select.cc example to see it in action.

Public Member Functions

 RTSQLSelect (const ResourcePool< ResourceType< TM > > &p, const SQLStatement &sql, SQL::SQLFetcher &fetcher)
 RTSQLSelect (const RTSQLSelect< TM > &rho)
virtual void bind (const unsigned int pos, const char &val, bool isnull=false)
 Binds an actual input value for an placeholder in the SQL statement.
virtual void bind (const unsigned int pos, const signed char &val, bool isnull=false)
virtual void bind (const unsigned int pos, const unsigned char &val, bool isnull=false)
virtual void bind (const unsigned int pos, const short int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const unsigned short int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const unsigned int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const long int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const unsigned long int &val, bool isnull=false)
virtual void bind (const unsigned int pos, const float &val, bool isnull=false)
virtual void bind (const unsigned int pos, const double &val, bool isnull=false)
virtual void bind (const unsigned int pos, const long double &val, bool isnull=false)
virtual void bind (const unsigned int pos, const std::string &val, bool isnull=false)
virtual void bindout (const unsigned int pos, char &val, bool &isnull=BindOutInterface::notnullconstant)
 Specify where the output data of an select statement are to be stored.
virtual void bindout (const unsigned int pos, signed char &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, unsigned char &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, short int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, unsigned short int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, unsigned int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, long int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, unsigned long int &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, float &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, double &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, long double &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void bindout (const unsigned int pos, std::string &val, bool &isnull=BindOutInterface::notnullconstant)
virtual void clearParameters ()
void execute (typename ResourceType< TM >::resource_t &hand)
virtual void outputoperator (std::ostream &) const
virtual const Clone * getPlainSpecializedCommand () const

Static Public Attributes

static bool notnullconstant

Protected Member Functions

virtual Clone * DoClone () const


Member Function Documentation

template<class TM>
void fatalmind::SQL::RTSQLSelect< TM >::bind ( const unsigned int  pos,
const char &  val,
bool  isnull = false 
) [inline, virtual]

Binds an actual input value for an placeholder in the SQL statement.

All binding is done by value! This means the passed data are copied to internal storage. Changing your original copy of your data after passing it to bind() is therefore safe.

Parameters:
pos The position indicator. The number of placeholder (?) in the SQL string. Counted from the left starting at 0.
val the actual value.
nul NULL inidcator, if set to yes the actual value to be bound will be NULL. Please note that you still need to provide a valid value!

Implements fatalmind::SQL::BindInterface.

template<class TM>
void fatalmind::SQL::RTSQLSelect< TM >::bindout ( const unsigned int  pos,
char &  val,
bool &  isnull = BindOutInterface::notnullconstant 
) [inline, virtual]

Specify where the output data of an select statement are to be stored.

You need to specify an place where the columns for an select statement are to be stored. After each fetch those variables will be propagated with the actual values received from the select statement. You can also specify a bool which will be used as indicator if the fatched column is NULL. If you omit this third, optional parameter an Exception will be thrown in case a fetched column is NULL.

Parameters:
pos The column number to be bound. Numbering starts with the leftmost column at 0.
val The variable which should contain the value of this column after the fetch. Each time a row is retrieved the according column value value will be available in that variable. The content of the variable will not be changed in case the column is NULL or the execution failed because of an exception. Exclusive access is expected, so there are no synchronization effords taken by the select commands. The variable must be availalbe throughout the whole time of execution.
isnull The optional third argument specifies a bool variable which will be set to true if the fetched column is NULL or to false otherwise. You must supply this indicator variable if you might retrieve NULL for this column. Not supplying an indicator varaible will cause an
Indicator variable required but not supplied.
exception. Well, so if you are sure your result will never be NULL, it's save to not provide the third arguement. In case you were wrong, you will receive an exception.

Implements fatalmind::SQL::BindOutInterface.


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