Wolframe, 0.0.3

_Wolframe::db::SubstitutingStatement Class Referenceabstract

An abstract statement class which allows derived classes to provide a simple escaping function which encodes the data which is stored directly in the SQL statement. More...

#include <substitutingStatement.hpp>

Inheritance diagram for _Wolframe::db::SubstitutingStatement:
_Wolframe::db::BaseStatement _Wolframe::db::Statement

Public Member Functions

 SubstitutingStatement ()
 
 SubstitutingStatement (const SubstitutingStatement &o)
 
virtual void init (const std::string &stmtStr)
 Set new SQL statement. More...
 
virtual void clear ()
 Clear current statement. More...
 
virtual void bind (const unsigned int idx, const types::Variant &value)
 Binds parameter at position idx with variant data in the format with Wolframe placeholders. More...
 
- Public Member Functions inherited from _Wolframe::db::BaseStatement
 BaseStatement ()
 
 BaseStatement (const BaseStatement &o)
 
 BaseStatement (const std::string &stmtStr)
 
virtual void substitute (bool checkForMissingPlaceholders=true)
 Trigger substitution (nativeSQL is valid after this call and not before!) More...
 
virtual const std::string originalSQL () const
 Returns the SQL statement as passed down to the database layer. More...
 
virtual const std::string nativeSQL () const
 Returns the SQL statement with the native database placeholders or the data filled in (this is up to the derived classes). More...
 
- Public Member Functions inherited from _Wolframe::db::Statement
virtual ~Statement ()
 

Protected Member Functions

virtual const std::string convert (const types::Variant &value) const =0
 Function to convert and escape a variant, if single quotes are need, the function should also return those, care must be taken to use the database escape functions to escape the values here (beware of SQL code injection!) More...
 
virtual const std::string replace (const unsigned int idx) const
 Funtion called when the placeholder should be put into the final string (this is either for subsituting data or rewrite placeholders to native syntax) More...
 

Private Attributes

std::map< unsigned int,
std::string > 
m_bind
 Stores the placeholders in calls of bind till they are used to create the substituted SQL statement with the embedded data. More...
 

Additional Inherited Members

- Public Types inherited from _Wolframe::db::BaseStatement
enum  { MaxNofParams = 32 }
 
- Protected Attributes inherited from _Wolframe::db::BaseStatement
std::string m_stmtStr
 The original SQL. More...
 
unsigned int m_maxParam
 The maximum number of parsed placeholders so far. More...
 

Detailed Description

An abstract statement class which allows derived classes to provide a simple escaping function which encodes the data which is stored directly in the SQL statement.

Constructor & Destructor Documentation

_Wolframe::db::SubstitutingStatement::SubstitutingStatement ( )
_Wolframe::db::SubstitutingStatement::SubstitutingStatement ( const SubstitutingStatement o)

Member Function Documentation

virtual void _Wolframe::db::SubstitutingStatement::bind ( const unsigned int  idx,
const types::Variant arg 
)
virtual

Binds parameter at position idx with variant data in the format with Wolframe placeholders.

Reimplemented from _Wolframe::db::BaseStatement.

virtual void _Wolframe::db::SubstitutingStatement::clear ( )
virtual

Clear current statement.

Reimplemented from _Wolframe::db::BaseStatement.

virtual const std::string _Wolframe::db::SubstitutingStatement::convert ( const types::Variant value) const
protectedpure virtual

Function to convert and escape a variant, if single quotes are need, the function should also return those, care must be taken to use the database escape functions to escape the values here (beware of SQL code injection!)

virtual void _Wolframe::db::SubstitutingStatement::init ( const std::string &  stmtStr)
virtual

Set new SQL statement.

Reimplemented from _Wolframe::db::BaseStatement.

virtual const std::string _Wolframe::db::SubstitutingStatement::replace ( const unsigned int  idx) const
protectedvirtual

Funtion called when the placeholder should be put into the final string (this is either for subsituting data or rewrite placeholders to native syntax)

Implements _Wolframe::db::Statement.

Member Data Documentation

std::map< unsigned int, std::string > _Wolframe::db::SubstitutingStatement::m_bind
private

Stores the placeholders in calls of bind till they are used to create the substituted SQL statement with the embedded data.


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