Qx v0.7
Qt Extensions Library
|
The SqlString class is a convenience class for more easily building SQL statements in a natural manner. More...
#include <qx/sql/qx-sqlstring.h>
Public Member Functions | |
SqlString () | |
SqlString (bool b) | |
SqlString (const QString &str) | |
SqlString (const QUuid &id) | |
template<Qx::arithmetic N> | |
SqlString (N n) | |
SqlString (QString &&str) | |
bool | isEmpty () const |
SqlString & | operator+= (const SqlString &s) |
QString | toString () const |
Static Public Member Functions | |
static SqlString | makeIdentifier (const char16_t *str) noexcept |
static SqlString | makeLiteral (const char16_t *str) noexcept |
static SqlString | makeRegular (const char16_t *str) noexcept |
Friends | |
SqlString | operator! (const SqlString &s) |
SqlString | operator!= (const SqlString &a, const SqlQuery &b) |
SqlString | operator!= (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator&& (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator&= (const SqlString &a, const SqlString &b) |
SqlString | operator< (const SqlString &a, const SqlQuery &b) |
SqlString | operator< (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator<= (const SqlString &a, const SqlQuery &b) |
SqlString | operator<= (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator== (const SqlString &a, const SqlQuery &b) |
SqlString | operator== (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator> (const SqlString &a, const SqlQuery &b) |
SqlString | operator> (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator>= (const SqlString &a, const SqlQuery &b) |
SqlString | operator>= (const SqlString &lhs, const SqlString &rhs) |
SqlString | operator|= (const SqlString &a, const SqlString &b) |
SqlString | operator|| (const SqlString &lhs, const SqlString &rhs) |
SqlString | QxSql::operator""_sq (const char16_t *str, size_t size) noexcept |
SqlString | QxSql::operator""_sqi (const char16_t *str, size_t size) noexcept |
SqlString | QxSql::operator""_sqs (const char16_t *str, size_t size) noexcept |
SqlStrings differ from regular strings in two ways.
First, the type features various operators that when used, result in a new string with the SQL equivalent of that operator placed between the two arguments, allowing one to write strings that involve those operators using C++ syntax.
Second, there are several user-defined literals available in the QxSql namespace that make using this type trivial.
Lastly, there are several constructors and user-defined conversion operators in other classes that assist in simplifying the composure of SQL statements.
Simply using:
allows you to use these literals easily.
|
explicit |
Constructs an empty SQL string.
|
explicit |
Move constructs an SQL string using str.
|
explicit |
Constructs an SQL string using str.
Qx::SqlString::SqlString | ( | bool | b | ) |
Constructs an SQL string from b (i.e. TRUE
or FALSE
).
Qx::SqlString::SqlString | ( | const QUuid & | id | ) |
Constructs an SQL string from id (without braces).
The id is treated as a string literal.
|
inline |
Constructs an SQL string from the arithmetic value n.
bool Qx::SqlString::isEmpty | ( | ) | const |
Returns the SQL string as a regular string.
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
Appends s to this string and then returns a reference to this string.
QString Qx::SqlString::toString | ( | ) | const |
Returns the SQL string as a regular string.
Returns a string of "a <> (q)" where q is used as a sub-query"
Returns a string of "a < (q)" where q is used as a sub-query"
Returns a string of "a <= (q)" where q is used as a sub-query"
Returns a string of "a = (q)" where q is used as a sub-query"
Returns a string of "a > (q)" where q is used as a sub-query"
Returns a string of "a >= (q)" where q is used as a sub-query"