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

Transitional representation for UPDATE query. More...

#include <update.hpp>

Public Member Functions

 Update (const Table &tbl)
 Starts an UPDATE tbl query.
 
Update Set (const Expr &column, const Expr &value) &&
 Adds a column = value assignment to the SET clause.
 
Update From (const VirtualTable &tbl) &&
 Sets the FROM clause, so SET/WHERE expressions may reference columns of tbl. tbl may be a table, a join, or anything VirtualTable::As has aliased.
 
Update Where (Condition exp) &&
 Sets the WHERE clause.
 
Update Returning (SelectItem item) &&
 Sets the RETURNING clause to a single entry.
 
Update Returning (std::initializer_list< SelectItem > items) &&
 Sets the RETURNING clause to a comma-separated list of entries.
 
std::string ToString () const
 

Detailed Description

Transitional representation for UPDATE query.

See also
https://www.postgresql.org/docs/current/sql-update.html

Member Function Documentation

◆ From()

Update iron_query::Update::From ( const VirtualTable tbl) &&

Sets the FROM clause, so SET/WHERE expressions may reference columns of tbl. tbl may be a table, a join, or anything VirtualTable::As has aliased.

Exceptions
LogicErrorif tbl is a subquery without an alias, or if the FROM clause was already set.

◆ Returning() [1/2]

Update iron_query::Update::Returning ( SelectItem  item) &&

Sets the RETURNING clause to a single entry.

Exceptions
LogicErrorif the RETURNING clause was already set.

◆ Returning() [2/2]

Update iron_query::Update::Returning ( std::initializer_list< SelectItem items) &&

Sets the RETURNING clause to a comma-separated list of entries.

Exceptions
LogicErrorif the RETURNING clause was already set.

◆ Set()

Update iron_query::Update::Set ( const Expr column,
const Expr value 
) &&

Adds a column = value assignment to the SET clause.

Note
Does not check that column names an actual column of tbl, nor that value's type matches that column's declared type.

◆ ToString()

std::string iron_query::Update::ToString ( ) const
Exceptions
LogicErrorif no SET assignment was added.

◆ Where()

Update iron_query::Update::Where ( Condition  exp) &&

Sets the WHERE clause.

Exceptions
LogicErrorif the WHERE clause was already set.

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