Lightweight 0.1.0
|
Query builder for building UPDATE ... queries. More...
#include <Update.hpp>
Public Member Functions | |
SqlUpdateQueryBuilder (SqlQueryFormatter const &formatter, std::string table, std::string tableAlias, std::vector< SqlVariant > *inputBindings) noexcept | |
SqlSearchCondition & | SearchCondition () noexcept |
SqlQueryFormatter const & | Formatter () const noexcept |
Returns the SQL query formatter. | |
template<typename ColumnValue > | |
SqlUpdateQueryBuilder & | Set (std::string_view columnName, ColumnValue const &value) |
Adds a single column to the SET clause. | |
template<std::size_t N> | |
SqlUpdateQueryBuilder & | Set (std::string_view columnName, char const (&value)[N]) |
Adds a single column to the SET clause with the value being a string literal. | |
SqlUpdateQueryBuilder & | Set (std::string_view columnName, MFCStringLike auto const *value) |
Adds a single column to the SET clause with the value being a MFC like CString. | |
std::string | ToSql () const |
Finalizes building the query as UPDATE ... query. | |
![]() | |
SqlUpdateQueryBuilder & | And () noexcept |
Indicates, that the next WHERE clause should be AND-ed (default). | |
SqlUpdateQueryBuilder & | Or () noexcept |
Indicates, that the next WHERE clause should be OR-ed. | |
SqlUpdateQueryBuilder & | Not () noexcept |
Indicates, that the next WHERE clause should be negated. | |
SqlUpdateQueryBuilder & | WhereRaw (std::string_view sqlConditionExpression) |
Constructs or extends a raw WHERE clause. | |
SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, T const &value) |
Constructs or extends a WHERE clause to test for a binary operation. | |
SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, SubSelectQuery const &value) |
Constructs or extends a WHERE clause to test for a binary operation for RHS as sub-select query. | |
SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, char const(&value)[N]) |
Constructs or extends a WHERE clause to test for a binary operation for RHS as string literal. | |
SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, T const &value) |
Constructs or extends a WHERE clause to test for equality. | |
SqlUpdateQueryBuilder & | Where (Callable const &callable) |
Constructs or extends a WHERE/AND clause to test for a group of values. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, T const &value) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Where (Callable const &callable) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, char const(&value)[N]) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, T const &value) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Where (ColumnName const &columnName, std::string_view binaryOp, SubSelectQuery const &value) |
SqlUpdateQueryBuilder & | OrWhere (ColumnName const &columnName, std::string_view binaryOp, T const &value) |
Constructs or extends a WHERE/OR clause to test for a binary operation. | |
SqlUpdateQueryBuilder & | OrWhere (ColumnName const &columnName, T const &value) |
Constructs or extends an WHERE/OR clause to test for equality. | |
SqlUpdateQueryBuilder & | OrWhere (Callable const &callable) |
Constructs or extends an WHERE/OR clause to test for a group of values. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | OrWhere (ColumnName const &columnName, T const &value) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | OrWhere (Callable const &callable) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | OrWhere (ColumnName const &columnName, std::string_view binaryOp, T const &value) |
SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, InputRange const &values) |
Constructs or extends an WHERE/OR clause to test for a value, satisfying std::ranges::input_range. | |
SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, std::initializer_list< T > const &values) |
Constructs or extends an WHERE/OR clause to test for a value, satisfying std::initializer_list. | |
SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, SubSelectQuery const &subSelectQuery) |
Constructs or extends an WHERE/OR clause to test for a value, satisfying a sub-select query. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, InputRange const &values) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, std::initializer_list< T > const &values) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereIn (ColumnName const &columnName, SubSelectQuery const &subSelectQuery) |
SqlUpdateQueryBuilder & | WhereNull (ColumnName const &columnName) |
Constructs or extends an WHERE/OR clause to test for a value to be NULL. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereNull (ColumnName const &columnName) |
SqlUpdateQueryBuilder & | WhereNotNull (ColumnName const &columnName) |
Constructs or extends a WHERE clause to test for a value being not null. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereNotNull (ColumnName const &columnName) |
SqlUpdateQueryBuilder & | WhereNotEqual (ColumnName const &columnName, T const &value) |
Constructs or extends a WHERE clause to test for a value being equal to another column. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereNotEqual (ColumnName const &columnName, T const &value) |
SqlUpdateQueryBuilder & | WhereTrue (ColumnName const &columnName) |
Constructs or extends a WHERE clause to test for a value being true. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereTrue (ColumnName const &columnName) |
SqlUpdateQueryBuilder & | WhereFalse (ColumnName const &columnName) |
Constructs or extends a WHERE clause to test for a value being false. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereFalse (ColumnName const &columnName) |
SqlUpdateQueryBuilder & | WhereColumn (LeftColumn const &left, std::string_view binaryOp, RightColumn const &right) |
Construts or extends a WHERE clause to test for a binary operation between two columns. | |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | WhereColumn (LeftColumn const &left, std::string_view binaryOp, RightColumn const &right) |
SqlUpdateQueryBuilder & | InnerJoin (std::string_view joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn) |
Constructs an INNER JOIN clause. | |
SqlUpdateQueryBuilder & | InnerJoin (std::string_view joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn) |
Constructs an INNER JOIN clause. | |
SqlUpdateQueryBuilder & | InnerJoin (std::string_view joinTable, OnChainCallable const &onClauseBuilder) |
Constructs an INNER JOIN clause with a custom ON clause. | |
SqlUpdateQueryBuilder & | LeftOuterJoin (std::string_view joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn) |
Constructs an LEFT OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | LeftOuterJoin (std::string_view joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn) |
Constructs an LEFT OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | LeftOuterJoin (std::string_view joinTable, OnChainCallable const &onClauseBuilder) |
Constructs an LEFT OUTER JOIN clause with a custom ON clause. | |
SqlUpdateQueryBuilder & | RightOuterJoin (std::string_view joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn) |
Constructs an RIGHT OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | RightOuterJoin (std::string_view joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn) |
Constructs an RIGHT OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | RightOuterJoin (std::string_view joinTable, OnChainCallable const &onClauseBuilder) |
Constructs an RIGHT OUTER JOIN clause with a custom ON clause. | |
SqlUpdateQueryBuilder & | FullOuterJoin (std::string_view joinTable, std::string_view joinColumnName, SqlQualifiedTableColumnName onOtherColumn) |
Constructs an FULL OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | FullOuterJoin (std::string_view joinTable, std::string_view joinColumnName, std::string_view onMainTableColumn) |
Constructs an FULL OUTER JOIN clause. | |
SqlUpdateQueryBuilder & | FullOuterJoin (std::string_view joinTable, OnChainCallable const &onClauseBuilder) |
Constructs an FULL OUTER JOIN clause with a custom ON clause. | |
LIGHTWEIGHT_FORCE_INLINE void | AppendColumnName (ColumnName const &columnName) |
LIGHTWEIGHT_FORCE_INLINE void | AppendLiteralValue (LiteralType const &value) |
LIGHTWEIGHT_FORCE_INLINE SqlUpdateQueryBuilder & | Join (JoinType joinType, std::string_view joinTable, Callable const &onClauseBuilder) |
Query builder for building UPDATE ... queries.
Definition at line 14 of file Update.hpp.
|
inlinenoexcept |
Constructs a new SqlUpdateQueryBuilder object.
formatter | The SQL query formatter to use. One of SqlServerQueryFormatter, OracleSqlQueryFormatter, PostgreSqlFormatter |
table | The name of the table to update. |
tableAlias | The alias of the table to update. |
inputBindings | The input bindings to use for the query. |
Definition at line 24 of file Update.hpp.
|
inlinenoexcept |
Definition at line 36 of file Update.hpp.
|
inlinenoexcept |
Returns the SQL query formatter.
Definition at line 42 of file Update.hpp.
SqlUpdateQueryBuilder & SqlUpdateQueryBuilder::Set | ( | std::string_view | columnName, |
ColumnValue const & | value | ||
) |
Adds a single column to the SET clause.
Definition at line 68 of file Update.hpp.
References SqlQueryFormatter::StringLiteral().