Commit c8f22a7f authored by Konrad Czapla's avatar Konrad Czapla
Browse files

Add possibility to concatenating column name with table name.

parent fbc32aa3
...@@ -650,6 +650,11 @@ QString QueryBuilder::getTable() const ...@@ -650,6 +650,11 @@ QString QueryBuilder::getTable() const
return mTable; return mTable;
} }
QString QueryBuilder::getTableWithColumn(const QString &column) const
{
return mTable + QLatin1Char('.') + column;
}
QString QueryBuilder::getTableQuery(const QSqlQuery& query, const QString &alias) QString QueryBuilder::getTableQuery(const QSqlQuery& query, const QString &alias)
{ {
Q_ASSERT_X(query.isValid() && query.isSelect(), "QueryBuilder::getTableQuery", "Table subquery use only for valid SELECT queries"); Q_ASSERT_X(query.isValid() && query.isSelect(), "QueryBuilder::getTableQuery", "Table subquery use only for valid SELECT queries");
......
...@@ -258,6 +258,13 @@ public: ...@@ -258,6 +258,13 @@ public:
*/ */
QString getTable() const; QString getTable() const;
/**
* Returns concatenated table name with column name.
* @param column Column name.
* @note Pass only @p column that are not prefixed by table name.
*/
QString getTableWithColumn(const QString &column) const;
private: private:
void buildQuery(QString *query); void buildQuery(QString *query);
void bindValue(QString *query, const QVariant &value); void bindValue(QString *query, const QVariant &value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment