Qx v0.7
Qt Extensions Library
|
The qx-sql header file offers a straightforward interface for querying an SQL database. More...
#include "qx/sql/qx_sql_export.h"
#include <QSqlDatabase>
#include <QUuid>
#include <QSqlQuery>
#include "qx/sql/qx-sqlconcepts.h"
#include "qx/sql/qx-sqlerror.h"
#include "qx/sql/qx-sqlresult.h"
#include "qx/sql/qx-sqlstring.h"
#include "qx/sql/__private/qx-sqlquery_p.h"
#include "qx/sql/__private/qx-sqlstring_helpers.h"
#include "qx/utility/qx-macros.h"
Go to the source code of this file.
Classes | |
class | Qx::AbstractSqlQuery< Derived > |
AbstractSqlQuery is a common base class from which all query types are derived, and provides common SQL keywords. More... | |
class | Qx::SqlDmlQuery |
The SqlDmlQuery class represents SQL queries that fit into the data manipulation language sub-language. More... | |
class | Qx::SqlDqlQuery |
The SqlDqlQuery class represents SQL queries that fit into the data query language sub-language. More... | |
class | Qx::SqlQuery |
SqlQuery is a base class from which all query types derive. More... | |
Namespaces | |
namespace | Qx |
The Qx namespace is the main namespace through which all non-global functionality of the Qx library is accessed. | |
Macros | |
#define | QX_SQL_MEMBER(member) |
#define | QX_SQL_MEMBER_ALIASED(member, field) |
#define | QX_SQL_MEMBER_OVERRIDE(Struct, member, ...) |
#define | QX_SQL_QUERY_STRUCT(struct_name, id, ...) |
#define | QX_SQL_STRUCT(id, ...) |
#define | QX_SQL_STRUCT_FULL(id, query_struct, ...) |
#define | QX_SQL_STRUCT_OUTSIDE(Struct, id, ...) |
#define | QX_SQL_STRUCT_OUTSIDE_FRIEND(struct_type) |
#define | QX_SQL_STRUCT_OUTSIDE_FULL(Struct, id, query_struct, ...) |
#define | QX_SQL_STRUCT_OUTSIDE_X(Struct, id, ...) |
#define | QX_SQL_STRUCT_X(id, ...) |
Most significantly this file provides access to Qx Declarative SQL.
#define QX_SQL_MEMBER | ( | member | ) |
Used to denote a SQL struct member whose name matches its field when using QX_SQL_STRUCT_X().
#define QX_SQL_MEMBER_ALIASED | ( | member, | |
field ) |
Used to denote a SQL struct member with a field that is different from its name when using QX_SQL_STRUCT_X().
field is to be a string literal.
#define QX_SQL_MEMBER_OVERRIDE | ( | Struct, | |
member, | |||
... ) |
Used to define a member/field specific value parsing/serialzing override for a SQL-tried struct. The specified member will be processed using the provided functions instead of potentially available generic ones for that type.
Must be used in namespace scope, outside of the struct definition.
#define QX_SQL_QUERY_STRUCT | ( | struct_name, | |
id, | |||
... ) |
Creates a struct named struct_name
that is intended to reflect the same members from the original struct as quoted strings, for conveniently using them as identifiers in an SQL statement.
Additionally, an identifier for the struct itself is created as the member _
using id.
Technically however, this struct isn't directly tied to the original, so it can bear any name and placed anywhere.
#define QX_SQL_STRUCT | ( | id, | |
... ) |
Specifies that the surrounding struct is a SQL-tied struct, which enables support for automatic parsing/serializing or binding of a corresponding SQL row.
The name of each included member (varargs) must match the name their corresponding SQL field.
id is the identifier of the table that the struct represent in the database.
#define QX_SQL_STRUCT_FULL | ( | id, | |
query_struct, | |||
... ) |
Same as QX_SQL_STRUCT(), but also invokes QX_SQL_QUERY_STRUCT() for you at the same time, using query_struct as the query struct name.
#define QX_SQL_STRUCT_OUTSIDE | ( | Struct, | |
id, | |||
... ) |
Same as QX_SQL_STRUCT(), but is used outside of a struct instead of inside, with Struct used to identify the target struct.
This is useful for hiding the SQL parsing implementation details of a public struct within a different source file.
#define QX_SQL_STRUCT_OUTSIDE_FRIEND | ( | struct_type | ) |
Place this inside of a class to enable the use of QX_SQL_STRUCT_OUTSIDE() and QX_SQL_STRUCT_OUTSIDE_X() with a struct/class with private data members.
QX_SQL_STRUCT() and QX_SQL_STRUCT_X() have no need for this in either case.
#define QX_SQL_STRUCT_OUTSIDE_FULL | ( | Struct, | |
id, | |||
query_struct, | |||
... ) |
Same as QX_SQL_STRUCT_OUTSIDE(), but also invokes QX_SQL_QUERY_STRUCT() for you at the same time, using query_struct as the query struct name.
#define QX_SQL_STRUCT_OUTSIDE_X | ( | Struct, | |
id, | |||
... ) |
Same as QX_SQL_STRUCT_X(), but is used outside of a struct instead of inside.
#define QX_SQL_STRUCT_X | ( | id, | |
... ) |
Same as QX_SQL_STRUCT(), but allows for customization of member fields.
Each member must be wrapped in QX_SQL_MEMBER() or QX_SQL_MEMBER_ALIASED().