QxOrm
1.5.0
C++ Object Relational Mapping library
|
qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library, and used by qx::dao::xxx functions to filter elements fetched from database More...
#include <QxSqlQuery.h>
Classes | |
struct | QxSqlResult |
Public Types | |
typedef std::function< void(QString &)> | type_fct_on_before_sql_prepare |
Public Member Functions | |
QxSqlQuery () | |
QxSqlQuery (const char *query, const QVariantList &values=QVariantList()) | |
QxSqlQuery (const QString &query, const QVariantList &values=QVariantList()) | |
QxSqlQuery (const QStringList &query) | |
QxSqlQuery (const QString &type, const QString &query) | |
QxSqlQuery (const QString &type, const QStringList &query) | |
virtual | ~QxSqlQuery () |
QString | query () |
QString | queryAt (int idx) const |
void | queryAt (int idx, const QString &query) |
QVariant | response () const |
QString | type () const |
bool | isEmpty () const |
bool | isDistinct () const |
void | clear () |
void | resolve (QSqlQuery &query, qx::QxCollection< QString, QVariantList > *pLstExecBatch=NULL) const |
void | resolveOutput (QSqlQuery &query, bool bFetchSqlResult) |
void | postProcess (QString &sql) const |
void | setResponse (const QVariant &v) |
void | setType (const QString &s) |
QString | getJoinQuery (const QString &relationKey, const QString &relationAlias) |
QString | getJoinQueryHash () |
QxSqlQuery & | query (const QString &sQuery) |
QxSqlQuery & | bind (const QVariant &vValue, QSql::ParamType paramType=QSql::In) |
QxSqlQuery & | bind (const QString &sKey, const QVariant &vValue, QSql::ParamType paramType=QSql::In) |
QVariant | boundValue (const QString &sKey) const |
QVariant | boundValue (int iPosition) const |
long | getSqlResultRowCount () const |
long | getSqlResultColumnCount () const |
QVariant | getSqlResultAt (long row, long column) const |
QVariant | getSqlResultAt (long row, const QString &column, bool caseSensitive=false) const |
QVector< QVariant > | getSqlResultAt (long row) const |
QVector< QString > | getSqlResultAllColumns () const |
void | dumpSqlResult () |
QxSqlQuery & | setFctOnBeforeSqlPrepare (type_fct_on_before_sql_prepare fct) |
void | onBeforeSqlPrepare (QString &sql) |
virtual QxSqlQuery & | distinct () |
virtual QxSqlQuery & | where (const QString &column) |
virtual QxSqlQuery & | where_OpenParenthesis (const QString &column) |
virtual QxSqlQuery & | and_ (const QString &column) |
virtual QxSqlQuery & | and_OpenParenthesis (const QString &column) |
virtual QxSqlQuery & | or_ (const QString &column) |
virtual QxSqlQuery & | or_OpenParenthesis (const QString &column) |
virtual QxSqlQuery & | openParenthesis () |
virtual QxSqlQuery & | closeParenthesis () |
virtual QxSqlQuery & | orderAsc (const QStringList &columns) |
virtual QxSqlQuery & | orderAsc (const QString &col1) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8) |
virtual QxSqlQuery & | orderAsc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8, const QString &col9) |
virtual QxSqlQuery & | orderDesc (const QStringList &columns) |
virtual QxSqlQuery & | orderDesc (const QString &col1) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8) |
virtual QxSqlQuery & | orderDesc (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8, const QString &col9) |
virtual QxSqlQuery & | groupBy (const QStringList &columns) |
virtual QxSqlQuery & | groupBy (const QString &col1) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8) |
virtual QxSqlQuery & | groupBy (const QString &col1, const QString &col2, const QString &col3, const QString &col4, const QString &col5, const QString &col6, const QString &col7, const QString &col8, const QString &col9) |
virtual QxSqlQuery & | limit (int rowsCount, int startRow=0, bool withTies=false) |
virtual QxSqlQuery & | like (const QString &val) |
virtual QxSqlQuery & | notLike (const QString &val) |
virtual QxSqlQuery & | startsWith (const QString &val) |
virtual QxSqlQuery & | endsWith (const QString &val) |
virtual QxSqlQuery & | containsString (const QString &val) |
virtual QxSqlQuery & | isEqualTo (const QVariant &val) |
virtual QxSqlQuery & | isNotEqualTo (const QVariant &val) |
virtual QxSqlQuery & | isGreaterThan (const QVariant &val) |
virtual QxSqlQuery & | isGreaterThanOrEqualTo (const QVariant &val) |
virtual QxSqlQuery & | isLessThan (const QVariant &val) |
virtual QxSqlQuery & | isLessThanOrEqualTo (const QVariant &val) |
virtual QxSqlQuery & | customOperator (const QString &sCustomOperator, const QVariant &val) |
virtual QxSqlQuery & | in (const QVariantList &values) |
virtual QxSqlQuery & | in (const QVariant &val1) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7, const QVariant &val8) |
virtual QxSqlQuery & | in (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7, const QVariant &val8, const QVariant &val9) |
virtual QxSqlQuery & | notIn (const QVariantList &values) |
virtual QxSqlQuery & | notIn (const QVariant &val1) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7, const QVariant &val8) |
virtual QxSqlQuery & | notIn (const QVariant &val1, const QVariant &val2, const QVariant &val3, const QVariant &val4, const QVariant &val5, const QVariant &val6, const QVariant &val7, const QVariant &val8, const QVariant &val9) |
virtual QxSqlQuery & | in_Select (const QxSqlQuery &query) |
virtual QxSqlQuery & | notIn_Select (const QxSqlQuery &query) |
virtual QxSqlQuery & | isEqualTo_Select (const QxSqlQuery &query) |
virtual QxSqlQuery & | isNotEqualTo_Select (const QxSqlQuery &query) |
virtual QxSqlQuery & | isNull () |
virtual QxSqlQuery & | isNotNull () |
virtual QxSqlQuery & | isBetween (const QVariant &val1, const QVariant &val2) |
virtual QxSqlQuery & | isNotBetween (const QVariant &val1, const QVariant &val2) |
virtual QxSqlQuery & | freeText (const QString &text, const QVariantList &values=QVariantList()) |
virtual QxSqlQuery & | addJoinQuery (const QString &relationKeyOrAlias, const QxSqlQuery &joinQuery) |
Static Public Member Functions | |
static void | dumpBoundValues (const QSqlQuery &query) |
Protected Types | |
typedef std::tuple< QVariant, QSql::ParamType > | type_bind_value |
Protected Attributes | |
QStringList | m_sQuery |
Query SQL with place-holder. | |
QxCollection< QString, type_bind_value > | m_lstValue |
Bind value in this array. | |
qx::dao::detail::IxSqlElement_ptr | m_pSqlElementTemp |
Temporary SQL element. | |
QList < qx::dao::detail::IxSqlElement_ptr > | m_lstSqlElement |
List of all SQL elements to build SQL query. | |
int | m_iSqlElementIndex |
Current index of SQL element. | |
int | m_iParenthesisCount |
Current parenthesis count. | |
bool | m_bDistinct |
Replace SELECT by SELECT DISTINCT in SQL query. | |
std::shared_ptr< QxSqlResult > | m_pSqlResult |
All results returning by SQL query or stored procedure (after calling qx::dao::call_query function) | |
QVariant | m_vResponse |
Can be used to store some responses (from MongoDB database for example in JSON format) | |
QString | m_sType |
Query type (for example : 'aggregate' or 'cursor' for MongoDB database) | |
QHash< QString, std::shared_ptr< QxSqlQuery > > | m_lstJoinQueryUser |
List of SQL queries defined by user to add inside relationships joins (LEFT OUTER JOIN, INNER JOIN), for example : INNER JOIN my_table2 m2 ON (m1.id = m2.parent_id AND (XXX)) | |
QList< std::shared_ptr < QxSqlQuery > > | m_lstJoinQueryToResolve |
List of SQL queries to resolve (in the right order) to add inside relationships joins (LEFT OUTER JOIN, INNER JOIN), for example : INNER JOIN my_table2 m2 ON (m1.id = m2.parent_id AND (XXX)) | |
type_fct_on_before_sql_prepare | m_fctOnBeforeSqlPrepare |
Custom callback function to modify SQL query before preparing in database. | |
Private Member Functions | |
void | verifyQuery () const QX_USED |
void | fetchSqlResult (QSqlQuery &query) |
QxSqlQuery & | addSqlExpression (const QString &column, qx::dao::detail::QxSqlExpression::type type) |
QxSqlQuery & | addSqlCompare (const QVariant &val, qx::dao::detail::QxSqlCompare::type type, const QString &sCustomOperator=QString()) |
QxSqlQuery & | addSqlSort (const QStringList &columns, qx::dao::detail::QxSqlSort::type type) |
QxSqlQuery & | addSqlIn (const QVariantList &values, qx::dao::detail::QxSqlIn::type type) |
QxSqlQuery & | addSqlIsNull (qx::dao::detail::QxSqlIsNull::type type) |
QxSqlQuery & | addSqlIsBetween (const QVariant &val1, const QVariant &val2, qx::dao::detail::QxSqlIsBetween::type type) |
QxSqlQuery & | addFreeText (const QString &text, const QVariantList &values) |
QxSqlQuery & | addEmbedQuery (const QxSqlQuery &query, qx::dao::detail::QxSqlEmbedQuery::type type, bool requirePreviousElement) |
Friends | |
struct | qx::cvt::detail::QxConvert_ToJson< qx::QxSqlQuery > |
struct | qx::cvt::detail::QxConvert_FromJson< qx::QxSqlQuery > |
template<class Archive > | |
void | boost::serialization::qx_save (Archive &ar, const qx::QxSqlQuery &t, const unsigned int file_version) |
template<class Archive > | |
void | boost::serialization::qx_load (Archive &ar, qx::QxSqlQuery &t, const unsigned int file_version) |
QX_DLL_EXPORT QDataStream & | operator<< (QDataStream &stream, const qx::QxSqlQuery &t) |
QX_DLL_EXPORT QDataStream & | operator>> (QDataStream &stream, qx::QxSqlQuery &t) |
QX_DLL_EXPORT QJsonValue | qx::cvt::detail::QxConvert_ToJson_Helper (const qx::QxSqlQuery &t, const QString &format) |
QX_DLL_EXPORT qx_bool | qx::cvt::detail::QxConvert_FromJson_Helper (const QJsonValue &j, qx::QxSqlQuery &t, const QString &format) |
qx::QxSqlQuery : define a user SQL query added to default SQL query builded by QxOrm library, and used by qx::dao::xxx functions to filter elements fetched from database
The class qx::QxSqlQuery (or its typedef qx_query) is used to communicate with database (to filter, to sort, etc.) in two different ways :
With the first method (writing manually SQL query), you can use some optimizations specific for each database. The second method (using C++ code to build SQL query) binds automatically SQL parameters without using qx::QxSqlQuery::bind() function.
Here is an example with qx::QxSqlQuery class writing manually a SQL query :
// Build a SQL query to fetch only 'author' of type 'female' qx::QxSqlQuery query("WHERE author.sex = :sex"); query.bind(":sex", author::female); QList<author> list_of_female; QSqlError daoError = qx::dao::fetch_by_query(query, list_of_female); // Here we can work with the collection provided by database for (long l = 0; l < list_of_female.count(); l++) { ; }
QxOrm library provides 3 styles to write SQL parameters. This style can be modified for a project using the following method qx::QxSqlDatabase::getSingleton()->setSqlPlaceHolderStyle() :
Here is the same example using C++ code of the class qx::QxSqlQuery (or its typedef qx_query) to build query automatically :
// Build a SQL query to fetch only 'author' of type 'female' qx_query query; query.where("author.sex").isEqualTo(author::female); QList<author> list_of_female; QSqlError daoError = qx::dao::fetch_by_query(query, list_of_female); // Here we can work with the collection provided by database for (long l = 0; l < list_of_female.count(); l++) { ; }
With C++ methods of qx::QxSqlQuery class, you don't have to bind any SQL parameter, and the syntax is similar to real SQL. All SQL parameters will be provided to database automatically with the following style : qx::QxSqlDatabase::getSingleton()->getSqlPlaceHolderStyle().
Here is an example with many methods of qx::QxSqlQuery class (or its typedef qx_query) :
qx_query query; query.where("sex").isEqualTo(author::female) .and_("age").isGreaterThan(38) .or_("last_name").isNotEqualTo("Dupont") .or_("first_name").like("Alfred") .and_OpenParenthesis("id").isLessThanOrEqualTo(999) .and_("birth_date").isBetween(date1, date2) .closeParenthesis() .or_("id").in(50, 999, 11, 23, 78945) .and_("is_deleted").isNotNull() .orderAsc("last_name", "first_name", "sex") .limit(50, 150);
This code will produce following SQL for MySQL, PostgreSQL and SQLite databases (for Oracle and SQLServer, there is a specific process for limit() method) :
WHERE sex = :sex_1_0 AND age > :age_3_0 OR last_name <> :last_name_5_0 OR first_name LIKE :first_name_7_0 AND ( id <= :id_10_0 AND birth_date BETWEEN :birth_date_12_0_1 AND :birth_date_12_0_2 ) OR id IN (:id_15_0_0, :id_15_0_1, :id_15_0_2, :id_15_0_3, :id_15_0_4) AND is_deleted IS NOT NULL ORDER BY last_name ASC, first_name ASC, sex ASC LIMIT :limit_rows_count_19_0 OFFSET :offset_start_row_19_0
Here is the list of all functions available to use qx::QxSqlQuery class (or its typedef qx_query) :
// with functions into namespace qx::dao qx::dao::count<T>() qx::dao::fetch_by_query<T>() qx::dao::update_by_query<T>() qx::dao::delete_by_query<T>() qx::dao::destroy_by_query<T>() qx::dao::fetch_by_query_with_relation<T>() qx::dao::fetch_by_query_with_all_relation<T>() qx::dao::update_by_query_with_relation<T>() qx::dao::update_by_query_with_all_relation<T>() qx::dao::update_optimized_by_query<T>() // with qx::QxSession class qx::QxSession::count<T>() qx::QxSession::fetchByQuery<T>() qx::QxSession::update<T>() qx::QxSession::deleteByQuery<T>() qx::QxSession::destroyByQuery<T>() // with qx::QxRepository<T> class qx::QxRepository<T>::count() qx::QxRepository<T>::fetchByQuery() qx::QxRepository<T>::update() qx::QxRepository<T>::deleteByQuery() qx::QxRepository<T>::destroyByQuery()
Note : those functions have 2 other optionals parameters :
Other note : it's possible to call a stored procedure using qx::QxSqlQuery class, for example :
qx_query query("CALL MyStoredProc(:param1, :param2)"); query.bind(":param1", "myValue1"); query.bind(":param2", 5024, QSql::InOut); QSqlError daoError = qx::dao::call_query(query); QVariant vNewValue = query.boundValue(":param2"); query.dumpSqlResult();
If the stored procedure returns a resultset, you can iterate over each rows and fields using the following methods (after calling qx::dao::call_query() function) :
Other note : to add your own SQL query methods (for example, some databases provide non-standard specifics SQL functions) :
Definition at line 244 of file QxSqlQuery.h.
typedef std::tuple<QVariant, QSql::ParamType> qx::QxSqlQuery::type_bind_value [protected] |
Definition at line 271 of file QxSqlQuery.h.
typedef std::function<void (QString &)> qx::QxSqlQuery::type_fct_on_before_sql_prepare |
Definition at line 264 of file QxSqlQuery.h.
qx::QxSqlQuery::QxSqlQuery | ( | ) |
qx::QxSqlQuery::QxSqlQuery | ( | const char * | query, |
const QVariantList & | values = QVariantList() |
||
) |
qx::QxSqlQuery::QxSqlQuery | ( | const QString & | query, |
const QVariantList & | values = QVariantList() |
||
) |
qx::QxSqlQuery::QxSqlQuery | ( | const QStringList & | query | ) |
qx::QxSqlQuery::QxSqlQuery | ( | const QString & | type, |
const QString & | query | ||
) |
qx::QxSqlQuery::QxSqlQuery | ( | const QString & | type, |
const QStringList & | query | ||
) |
virtual qx::QxSqlQuery::~QxSqlQuery | ( | ) | [virtual] |
QxSqlQuery& qx::QxSqlQuery::addEmbedQuery | ( | const QxSqlQuery & | query, |
qx::dao::detail::QxSqlEmbedQuery::type | type, | ||
bool | requirePreviousElement | ||
) | [private] |
QxSqlQuery& qx::QxSqlQuery::addFreeText | ( | const QString & | text, |
const QVariantList & | values | ||
) | [private] |
virtual QxSqlQuery& qx::QxSqlQuery::addJoinQuery | ( | const QString & | relationKeyOrAlias, |
const QxSqlQuery & | joinQuery | ||
) | [virtual] |
QxSqlQuery& qx::QxSqlQuery::addSqlCompare | ( | const QVariant & | val, |
qx::dao::detail::QxSqlCompare::type | type, | ||
const QString & | sCustomOperator = QString() |
||
) | [private] |
QxSqlQuery& qx::QxSqlQuery::addSqlExpression | ( | const QString & | column, |
qx::dao::detail::QxSqlExpression::type | type | ||
) | [private] |
QxSqlQuery& qx::QxSqlQuery::addSqlIn | ( | const QVariantList & | values, |
qx::dao::detail::QxSqlIn::type | type | ||
) | [private] |
QxSqlQuery& qx::QxSqlQuery::addSqlIsBetween | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
qx::dao::detail::QxSqlIsBetween::type | type | ||
) | [private] |
QxSqlQuery& qx::QxSqlQuery::addSqlIsNull | ( | qx::dao::detail::QxSqlIsNull::type | type | ) | [private] |
QxSqlQuery& qx::QxSqlQuery::addSqlSort | ( | const QStringList & | columns, |
qx::dao::detail::QxSqlSort::type | type | ||
) | [private] |
virtual QxSqlQuery& qx::QxSqlQuery::and_ | ( | const QString & | column | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::and_OpenParenthesis | ( | const QString & | column | ) | [virtual] |
QxSqlQuery& qx::QxSqlQuery::bind | ( | const QVariant & | vValue, |
QSql::ParamType | paramType = QSql::In |
||
) |
QxSqlQuery& qx::QxSqlQuery::bind | ( | const QString & | sKey, |
const QVariant & | vValue, | ||
QSql::ParamType | paramType = QSql::In |
||
) |
QVariant qx::QxSqlQuery::boundValue | ( | const QString & | sKey | ) | const |
QVariant qx::QxSqlQuery::boundValue | ( | int | iPosition | ) | const |
void qx::QxSqlQuery::clear | ( | ) |
virtual QxSqlQuery& qx::QxSqlQuery::closeParenthesis | ( | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::containsString | ( | const QString & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::customOperator | ( | const QString & | sCustomOperator, |
const QVariant & | val | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::distinct | ( | ) | [virtual] |
static void qx::QxSqlQuery::dumpBoundValues | ( | const QSqlQuery & | query | ) | [static] |
void qx::QxSqlQuery::dumpSqlResult | ( | ) |
virtual QxSqlQuery& qx::QxSqlQuery::endsWith | ( | const QString & | val | ) | [virtual] |
void qx::QxSqlQuery::fetchSqlResult | ( | QSqlQuery & | query | ) | [private] |
virtual QxSqlQuery& qx::QxSqlQuery::freeText | ( | const QString & | text, |
const QVariantList & | values = QVariantList() |
||
) | [virtual] |
QString qx::QxSqlQuery::getJoinQuery | ( | const QString & | relationKey, |
const QString & | relationAlias | ||
) |
QString qx::QxSqlQuery::getJoinQueryHash | ( | ) |
QVector<QString> qx::QxSqlQuery::getSqlResultAllColumns | ( | ) | const |
QVariant qx::QxSqlQuery::getSqlResultAt | ( | long | row, |
long | column | ||
) | const |
QVariant qx::QxSqlQuery::getSqlResultAt | ( | long | row, |
const QString & | column, | ||
bool | caseSensitive = false |
||
) | const |
QVector<QVariant> qx::QxSqlQuery::getSqlResultAt | ( | long | row | ) | const |
long qx::QxSqlQuery::getSqlResultColumnCount | ( | ) | const |
long qx::QxSqlQuery::getSqlResultRowCount | ( | ) | const |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QStringList & | columns | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1 | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::groupBy | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8, | ||
const QString & | col9 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariantList & | values | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1 | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7, | ||
const QVariant & | val8 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7, | ||
const QVariant & | val8, | ||
const QVariant & | val9 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::in_Select | ( | const QxSqlQuery & | query | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isBetween | ( | const QVariant & | val1, |
const QVariant & | val2 | ||
) | [virtual] |
bool qx::QxSqlQuery::isDistinct | ( | ) | const |
bool qx::QxSqlQuery::isEmpty | ( | ) | const |
virtual QxSqlQuery& qx::QxSqlQuery::isEqualTo | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isEqualTo_Select | ( | const QxSqlQuery & | query | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isGreaterThan | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isGreaterThanOrEqualTo | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isLessThan | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isLessThanOrEqualTo | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isNotBetween | ( | const QVariant & | val1, |
const QVariant & | val2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isNotEqualTo | ( | const QVariant & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isNotEqualTo_Select | ( | const QxSqlQuery & | query | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isNotNull | ( | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::isNull | ( | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::like | ( | const QString & | val | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::limit | ( | int | rowsCount, |
int | startRow = 0 , |
||
bool | withTies = false |
||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariantList & | values | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1 | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7, | ||
const QVariant & | val8 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn | ( | const QVariant & | val1, |
const QVariant & | val2, | ||
const QVariant & | val3, | ||
const QVariant & | val4, | ||
const QVariant & | val5, | ||
const QVariant & | val6, | ||
const QVariant & | val7, | ||
const QVariant & | val8, | ||
const QVariant & | val9 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notIn_Select | ( | const QxSqlQuery & | query | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::notLike | ( | const QString & | val | ) | [virtual] |
void qx::QxSqlQuery::onBeforeSqlPrepare | ( | QString & | sql | ) |
virtual QxSqlQuery& qx::QxSqlQuery::openParenthesis | ( | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::or_ | ( | const QString & | column | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::or_OpenParenthesis | ( | const QString & | column | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QStringList & | columns | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1 | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderAsc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8, | ||
const QString & | col9 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QStringList & | columns | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1 | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8 | ||
) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::orderDesc | ( | const QString & | col1, |
const QString & | col2, | ||
const QString & | col3, | ||
const QString & | col4, | ||
const QString & | col5, | ||
const QString & | col6, | ||
const QString & | col7, | ||
const QString & | col8, | ||
const QString & | col9 | ||
) | [virtual] |
void qx::QxSqlQuery::postProcess | ( | QString & | sql | ) | const |
QString qx::QxSqlQuery::query | ( | ) |
QxSqlQuery& qx::QxSqlQuery::query | ( | const QString & | sQuery | ) |
QString qx::QxSqlQuery::queryAt | ( | int | idx | ) | const |
void qx::QxSqlQuery::queryAt | ( | int | idx, |
const QString & | query | ||
) |
void qx::QxSqlQuery::resolve | ( | QSqlQuery & | query, |
qx::QxCollection< QString, QVariantList > * | pLstExecBatch = NULL |
||
) | const |
void qx::QxSqlQuery::resolveOutput | ( | QSqlQuery & | query, |
bool | bFetchSqlResult | ||
) |
QVariant qx::QxSqlQuery::response | ( | ) | const |
QxSqlQuery& qx::QxSqlQuery::setFctOnBeforeSqlPrepare | ( | type_fct_on_before_sql_prepare | fct | ) |
void qx::QxSqlQuery::setResponse | ( | const QVariant & | v | ) |
void qx::QxSqlQuery::setType | ( | const QString & | s | ) |
virtual QxSqlQuery& qx::QxSqlQuery::startsWith | ( | const QString & | val | ) | [virtual] |
QString qx::QxSqlQuery::type | ( | ) | const |
void qx::QxSqlQuery::verifyQuery | ( | ) | const [private] |
virtual QxSqlQuery& qx::QxSqlQuery::where | ( | const QString & | column | ) | [virtual] |
virtual QxSqlQuery& qx::QxSqlQuery::where_OpenParenthesis | ( | const QString & | column | ) | [virtual] |
void boost::serialization::qx_load | ( | Archive & | ar, |
qx::QxSqlQuery & | t, | ||
const unsigned int | file_version | ||
) | [friend] |
void boost::serialization::qx_save | ( | Archive & | ar, |
const qx::QxSqlQuery & | t, | ||
const unsigned int | file_version | ||
) | [friend] |
QX_DLL_EXPORT QDataStream& operator<< | ( | QDataStream & | stream, |
const qx::QxSqlQuery & | t | ||
) | [friend] |
QX_DLL_EXPORT QDataStream& operator>> | ( | QDataStream & | stream, |
qx::QxSqlQuery & | t | ||
) | [friend] |
friend struct qx::cvt::detail::QxConvert_FromJson< qx::QxSqlQuery > [friend] |
Definition at line 257 of file QxSqlQuery.h.
QX_DLL_EXPORT qx_bool qx::cvt::detail::QxConvert_FromJson_Helper | ( | const QJsonValue & | j, |
qx::QxSqlQuery & | t, | ||
const QString & | format | ||
) | [friend] |
friend struct qx::cvt::detail::QxConvert_ToJson< qx::QxSqlQuery > [friend] |
Definition at line 256 of file QxSqlQuery.h.
QX_DLL_EXPORT QJsonValue qx::cvt::detail::QxConvert_ToJson_Helper | ( | const qx::QxSqlQuery & | t, |
const QString & | format | ||
) | [friend] |
bool qx::QxSqlQuery::m_bDistinct [protected] |
Replace SELECT by SELECT DISTINCT in SQL query.
Definition at line 279 of file QxSqlQuery.h.
Custom callback function to modify SQL query before preparing in database.
Definition at line 285 of file QxSqlQuery.h.
int qx::QxSqlQuery::m_iParenthesisCount [protected] |
Current parenthesis count.
Definition at line 278 of file QxSqlQuery.h.
int qx::QxSqlQuery::m_iSqlElementIndex [protected] |
Current index of SQL element.
Definition at line 277 of file QxSqlQuery.h.
QList<std::shared_ptr<QxSqlQuery> > qx::QxSqlQuery::m_lstJoinQueryToResolve [protected] |
List of SQL queries to resolve (in the right order) to add inside relationships joins (LEFT OUTER JOIN, INNER JOIN), for example : INNER JOIN my_table2 m2 ON (m1.id = m2.parent_id AND (XXX))
Definition at line 284 of file QxSqlQuery.h.
QHash<QString, std::shared_ptr<QxSqlQuery> > qx::QxSqlQuery::m_lstJoinQueryUser [protected] |
List of SQL queries defined by user to add inside relationships joins (LEFT OUTER JOIN, INNER JOIN), for example : INNER JOIN my_table2 m2 ON (m1.id = m2.parent_id AND (XXX))
Definition at line 283 of file QxSqlQuery.h.
QList<qx::dao::detail::IxSqlElement_ptr> qx::QxSqlQuery::m_lstSqlElement [protected] |
List of all SQL elements to build SQL query.
Definition at line 276 of file QxSqlQuery.h.
QxCollection<QString, type_bind_value> qx::QxSqlQuery::m_lstValue [protected] |
Bind value in this array.
Definition at line 274 of file QxSqlQuery.h.
Temporary SQL element.
Definition at line 275 of file QxSqlQuery.h.
std::shared_ptr<QxSqlResult> qx::QxSqlQuery::m_pSqlResult [protected] |
All results returning by SQL query or stored procedure (after calling qx::dao::call_query function)
Definition at line 280 of file QxSqlQuery.h.
QStringList qx::QxSqlQuery::m_sQuery [protected] |
Query SQL with place-holder.
Definition at line 273 of file QxSqlQuery.h.
QString qx::QxSqlQuery::m_sType [protected] |
Query type (for example : 'aggregate' or 'cursor' for MongoDB database)
Definition at line 282 of file QxSqlQuery.h.
QVariant qx::QxSqlQuery::m_vResponse [protected] |
Can be used to store some responses (from MongoDB database for example in JSON format)
Definition at line 281 of file QxSqlQuery.h.