oos::condition Class Reference

Represents a sql query condition. More...

#include <condition.hpp>

Public Member Functions

 condition ()
 
 condition (const std::string &c)
 
template<class T >
conditionequal (const T &val)
 
template<class T >
conditionnot_equal (const T &val)
 
template<class T >
conditiongreater (const T &val)
 
template<class T >
conditiongreater_equal (const T &val)
 
template<class T >
conditionless (const T &val)
 
template<class T >
conditionless_equal (const T &val)
 
conditionnot_null ()
 
conditionnull ()
 
conditionor_ (const condition &cond)
 
conditionand_ (const condition &cond)
 
std::string str (bool prepared) const
 
std::string column () const
 
unsigned long size () const
 
data_type_t type () const
 
bool valid () const
 

Detailed Description

Represents a sql query condition.

This class represents a condition part of a sql query or update statement. Each compare method returns a reference to the condition itself. That way one can concatenate conditions together.

Constructor & Destructor Documentation

oos::condition::condition ( )
inline

Creates an empty unknown condition.

oos::condition::condition ( const std::string &  c)
inline

Creates a new condition for the given column c

Parameters
cThe column name.

Member Function Documentation

condition& oos::condition::and_ ( const condition cond)

Concatenate to conditions with logical and.

Returns
A reference to the condition.
std::string oos::condition::column ( ) const
inline

Returns the column name.

Returns
Returns the column name.
template<class T >
condition& oos::condition::equal ( const T &  val)
inline

Evalutes the value of the column with the given value to equal.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
template<class T >
condition& oos::condition::greater ( const T &  val)
inline

Evalutes the value of the column with the given value to greater than.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
template<class T >
condition& oos::condition::greater_equal ( const T &  val)
inline

Evalutes the value of the column with the given value to equal or greater than.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
template<class T >
condition& oos::condition::less ( const T &  val)
inline

Evalutes the value of the column with the given value to less than.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
template<class T >
condition& oos::condition::less_equal ( const T &  val)
inline

Evalutes the value of the column with the given value to equal or less than.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
template<class T >
condition& oos::condition::not_equal ( const T &  val)
inline

Evalutes the value of the column with the given value to not equal.

Template Parameters
TThe type of the value.
Parameters
valThe value to compares
Returns
A reference to the condition.
condition& oos::condition::not_null ( )
inline

Evalutes the value of the column to not null.

Returns
A reference to the condition.
condition& oos::condition::null ( )
inline

Evalutes the value of the column to null.

Returns
A reference to the condition.
condition& oos::condition::or_ ( const condition cond)

Concatenate to conditions with logical or.

Returns
A reference to the condition.
unsigned long oos::condition::size ( ) const
inline

Returns the size of the data

Returns
The size of the data.
std::string oos::condition::str ( bool  prepared) const
inline

Returns the string representation of the condition. With the prepared flag set to true the condition string is put together for preppared statements.

Parameters
preparedIndicates wether the condition is for prepared statements or not.
Returns
A reference to the condition.
data_type_t oos::condition::type ( ) const
inline

Returns the data type.

Returns
The data type.
bool oos::condition::valid ( ) const
inline

Returns wether the condition is in a valid state. This means a column name, an operator and a value must be set.

Returns
True if the condition is in a valid state.

The documentation for this class was generated from the following file:
  • database/condition.hpp