fastcgi++
Public Member Functions | Static Public Member Functions | Protected Member Functions
ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type > Struct Template Reference

Query specialization for results of Data::SetContainer type and parameters of Data::Set type. More...

#include <query.hpp>

Inheritance diagram for ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >:
ASql::QueryPar

List of all members.

Public Member Functions

 Query ()
 Query (const Query &x)
Parameters & createParameters ()
 Create the parameter set for the query object.
void setParameters (Parameters *parameters)
 Set's the parameter data to point to the passed single row parameter set.
Parameters * parameters ()
 Returns a pointer to the parameter set.
const Parameters * parameters () const
 Returns a const pointer to the parameter set.
Parameters * relinquishParameters ()
 Relinquishes control over the parameter set.
Results & createResults ()
 Create the result set container for the query object.
void setResults (Results *results)
 Set's the result data to point to the passed single row result set container.
Results * results ()
 Returns a pointer to the result set container.
const Results * results () const
 Returns a const pointer to the result set container.
Results * relinquishResults ()
 Relinquishes control over the result set container.
unsigned int insertId () const
 Returns the insert ID returned from the query or 0 if nothing.
unsigned int rows () const
 Returns the rows affected/available from the query or 0 if nothing.
bool busy () const
 Returns true if copies of this query still exist (query is still working in another thread).
Error error () const
 Return the error object associated with the query.
void setCallback (boost::function< void()> callback=boost::function< void()>())
 Set the callback function to be called at the end of the query.
bool isCallback ()
 Return true if a callback is associated with this query.
boost::function< void()> getCallback ()
 Get the callback function.
void keepAlive (bool x)
 Set true if you want the query to not be cancelled when the original object is destroyed.
void cancel ()
 Call this function to cancel the query.
void enableRows ()
 Call this function to enable the retrieval of a row count (affected/available rows)
void enableInsertId ()
 Call this function to enable the retrieval of an auto-increment insert ID.
void reset ()
 Resets the object as though it was destroyed and reconstructed anew.

Static Public Member Functions

static QuerystaticRebuild (QueryPar &x)
 Takes a QueryPar reference and return a statically generated Query reference.
static QuerydynamicRebuild (QueryPar &x)
 Takes a QueryPar reference and return a dynamically generated Query reference.

Protected Member Functions

void setResults (void *results)
 Set's the shared data to point to the passed pointer.
void setParameters (void *parameters)
 Set's the shared data to point to the passed pointer.

Detailed Description

template<class Parameters, class Results>
struct ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >

Query specialization for results of Data::SetContainer type and parameters of Data::Set type.

Template Parameters:
ParametersType used to store parameter data. This specialization cover those types derived from Data::Set
ResultsType used to store result data. This specialization cover those types derived from Data::SetContainer

Definition at line 454 of file query.hpp.


Constructor & Destructor Documentation

template<class Parameters , class Results >
ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::Query ( )
inline

Definition at line 456 of file query.hpp.

template<class Parameters , class Results >
ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::Query ( const Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type > &  x)
inline

Definition at line 457 of file query.hpp.


Member Function Documentation

bool ASql::QueryPar::busy ( ) const
inlineinherited

Returns true if copies of this query still exist (query is still working in another thread).

Definition at line 263 of file query.hpp.

References ASql::QueryPar::m_sharedData.

void ASql::QueryPar::cancel ( )
inlineinherited

Call this function to cancel the query.

This will cancel the query at the earliest opportunity. Calling a cancel will rollback any changes in the associated transaction.

Definition at line 301 of file query.hpp.

References ASql::QueryPar::m_sharedData.

Referenced by ASql::QueryPar::~QueryPar().

template<class Parameters , class Results >
Parameters& ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::createParameters ( )
inline

Create the parameter set for the query object.

Returns:
A reference to the newly created parameter set.

Definition at line 469 of file query.hpp.

References ASql::QueryPar::parameters(), and ASql::QueryPar::setParameters().

template<class Parameters , class Results >
Results& ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::createResults ( )
inline

Create the result set container for the query object.

Returns:
A reference to the newly created result set container.

Definition at line 502 of file query.hpp.

References ASql::QueryPar::results(), and ASql::QueryPar::setResults().

template<class Parameters , class Results >
static Query& ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::dynamicRebuild ( QueryPar x)
inlinestatic

Takes a QueryPar reference and return a dynamically generated Query reference.

Definition at line 463 of file query.hpp.

void ASql::QueryPar::enableInsertId ( )
inlineinherited

Call this function to enable the retrieval of an auto-increment insert ID.

Definition at line 311 of file query.hpp.

References ASql::QueryPar::m_sharedData.

void ASql::QueryPar::enableRows ( )
inlineinherited

Call this function to enable the retrieval of a row count (affected/available rows)

Definition at line 304 of file query.hpp.

References ASql::QueryPar::m_sharedData.

Error ASql::QueryPar::error ( ) const
inlineinherited

Return the error object associated with the query.

Note this will be a default Error object if there was no error.

Definition at line 269 of file query.hpp.

References ASql::QueryPar::m_sharedData.

boost::function<void()> ASql::QueryPar::getCallback ( )
inlineinherited

Get the callback function.

Definition at line 285 of file query.hpp.

References ASql::QueryPar::m_sharedData.

Referenced by ASql::ConnectionPar< T >::intHandler().

unsigned int ASql::QueryPar::insertId ( ) const
inlineinherited

Returns the insert ID returned from the query or 0 if nothing.

Definition at line 253 of file query.hpp.

References ASql::QueryPar::m_sharedData.

bool ASql::QueryPar::isCallback ( )
inlineinherited

Return true if a callback is associated with this query.

Definition at line 282 of file query.hpp.

References ASql::QueryPar::m_sharedData.

Referenced by ASql::ConnectionPar< T >::intHandler().

void ASql::QueryPar::keepAlive ( bool  x)
inlineinherited

Set true if you want the query to not be cancelled when the original object is destroyed.

Note that the default is to cancel and this must be called from the original query object.

Definition at line 294 of file query.hpp.

References ASql::QueryPar::FLAG_KEEPALIVE, and ASql::QueryPar::m_flags.

Referenced by ASql::QueryPar::reset().

template<class Parameters , class Results >
Parameters* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::parameters ( )
inline

Returns a pointer to the parameter set.

Reimplemented from ASql::QueryPar.

Definition at line 481 of file query.hpp.

References ASql::QueryPar::parameters().

template<class Parameters , class Results >
const Parameters* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::parameters ( ) const
inline

Returns a const pointer to the parameter set.

Reimplemented from ASql::QueryPar.

Definition at line 484 of file query.hpp.

References ASql::QueryPar::parameters().

template<class Parameters , class Results >
Parameters* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::relinquishParameters ( )
inline

Relinquishes control over the parameter set.

Calling this will disassociate the query object (and it's copies) from the parameter set but won't delete it. Use this if you are done with your query object but want to keep your parameter set around. The end result in the query object (and it's copies) is to have no parameter set associated with it.

Returns:
Pointer to the disassociated parameter set

Reimplemented from ASql::QueryPar.

Definition at line 496 of file query.hpp.

References ASql::QueryPar::relinquishParameters().

template<class Parameters , class Results >
Results* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::relinquishResults ( )
inline

Relinquishes control over the result set container.

Calling this will disassociate the query object (and it's copies) from the result set container but won't delete it. Use this if you are done with your query object but want to keep your result set container around. The end result in the query object (and it's copies) is to have no result set container associated with it.

Returns:
Pointer to the disassociated result set container

Reimplemented from ASql::QueryPar.

Definition at line 529 of file query.hpp.

References ASql::QueryPar::relinquishResults().

void ASql::QueryPar::reset ( )
inlineinherited

Resets the object as though it was destroyed and reconstructed anew.

Definition at line 318 of file query.hpp.

References ASql::QueryPar::FLAG_ORIGINAL, ASql::QueryPar::keepAlive(), ASql::QueryPar::m_flags, and ASql::QueryPar::m_sharedData.

template<class Parameters , class Results >
Results* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::results ( )
inline

Returns a pointer to the result set container.

Reimplemented from ASql::QueryPar.

Definition at line 514 of file query.hpp.

References ASql::QueryPar::results().

template<class Parameters , class Results >
const Results* ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::results ( ) const
inline

Returns a const pointer to the result set container.

Reimplemented from ASql::QueryPar.

Definition at line 517 of file query.hpp.

References ASql::QueryPar::results().

unsigned int ASql::QueryPar::rows ( ) const
inlineinherited

Returns the rows affected/available from the query or 0 if nothing.

Note that if using for the number of rows from a query this will represent the number of rows available before a LIMIT.

Definition at line 260 of file query.hpp.

References ASql::QueryPar::m_sharedData.

void ASql::QueryPar::setCallback ( boost::function< void()>  callback = boost::function<void()>())
inlineinherited

Set the callback function to be called at the end of the query.

Note that this will be called even if there is an error or the query can cancelled.

Definition at line 275 of file query.hpp.

References ASql::QueryPar::callback(), and ASql::QueryPar::m_sharedData.

Referenced by ASql::ConnectionPar< T >::intHandler().

void ASql::QueryPar::setParameters ( void *  parameters)
inlineprotectedinherited
template<class Parameters , class Results >
void ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::setParameters ( Parameters *  parameters)
inline

Set's the parameter data to point to the passed single row parameter set.

Note that the Query object assumes responsibility for destroying the parameter set unless explicitly released with relinquishParameters().

Parameters:
[in]parametersA pointer to the parameter data set

Definition at line 478 of file query.hpp.

References ASql::QueryPar::setParameters().

void ASql::QueryPar::setResults ( void *  results)
inlineprotectedinherited
template<class Parameters , class Results >
void ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::setResults ( Results *  results)
inline

Set's the result data to point to the passed single row result set container.

Note that the Query object assumes responsibility for destroying the result set container unless explicitly released with relinquishResults().

Parameters:
[in]resultsA pointer to the result data set container

Definition at line 511 of file query.hpp.

References ASql::QueryPar::setResults().

template<class Parameters , class Results >
static Query& ASql::Query< Parameters, Results, typename boost::enable_if< boost::is_base_of< Data::Set, Parameters > >::type, typename boost::enable_if< boost::is_base_of< Data::SetContainer, Results > >::type >::staticRebuild ( QueryPar x)
inlinestatic

Takes a QueryPar reference and return a statically generated Query reference.

Definition at line 460 of file query.hpp.


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