IronQuery
A SQL-first query builder for C++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
iron_query::Condition Class Referencefinal

A boolean-valued SQL predicate, e.g. the result of a comparison, LIKE/IN/BETWEEN/IS [NOT] NULL, EXISTS, or a logical combination of these. Kept distinct from Expr so that predicate-only positions (WHERE, HAVING, ON, WHEN) cannot silently accept a non-boolean expression, e.g. Where(age) or Where(age + 1). More...

#include <condition.hpp>

Public Member Functions

Condition operator&& (const Condition &other) const
 this AND other.
 
Condition operator|| (const Condition &other) const
 this OR other.
 
Condition operator! () const
 NOT this.
 
std::string Extract (OperatorPrecedence precedence) const
 Renders the condition as SQL text, parenthesizing it if its top-level operator does not bind at least as tightly as precedence.
 
std::string ToString () const
 Renders the condition as a standalone, unparenthesized SQL fragment.
 
 operator Expr () &&
 Converts this predicate into a value expression, e.g. for embedding it where a boolean-valued Expr is expected. Only available on rvalues.
 

Static Public Member Functions

static Condition FromRaw (std::string s)
 Wraps a trusted, developer-written SQL predicate verbatim. Never pass untrusted/dynamic data here.
 

Friends

class Expr
 
Condition operator< (const Expr &a, const Expr &b)
 a < b.
 
Condition operator<= (const Expr &a, const Expr &b)
 a <= b.
 
Condition operator> (const Expr &a, const Expr &b)
 a > b.
 
Condition operator>= (const Expr &a, const Expr &b)
 a >= b.
 
Condition operator== (const Expr &a, const Expr &b)
 a = b.
 
Condition operator!= (const Expr &a, const Expr &b)
 a != b.
 

Detailed Description

A boolean-valued SQL predicate, e.g. the result of a comparison, LIKE/IN/BETWEEN/IS [NOT] NULL, EXISTS, or a logical combination of these. Kept distinct from Expr so that predicate-only positions (WHERE, HAVING, ON, WHEN) cannot silently accept a non-boolean expression, e.g. Where(age) or Where(age + 1).

A boolean-valued column or raw expression can be turned into a Condition explicitly via Expr::IsTrue / Expr::IsFalse / Expr::IsNotNull, or via Condition::FromRaw for a trusted raw fragment.


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