本文整理汇总了C++中QueryBuilder::getQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryBuilder::getQuery方法的具体用法?C++ QueryBuilder::getQuery怎么用?C++ QueryBuilder::getQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::getQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isEmpty
/**
* @brief Repository::isEmpty Verifies if the table is empty.
* @return Return whether the table associated with the inherithing Repository is empty or not.
*/
bool Repository::isEmpty() {
QueryBuilder qb;
qb.select("count(*) AS rows")
->from(getTableName());
DBItem dbItem = Database::instance()->pullFirst(qb.getQuery());
int rowCount = dbItem.getHashMap().value("rows").toInt();
return (rowCount == 0);
}
示例2: insertIntoDefault
int Repository::insertIntoDefault(DBItem *item) {
QueryBuilder qb;
qb.insertIntoDefault(getTableName());
qb.withAsSelect(qb, "id");
QSqlQuery query = qb.getQuery();
int id = Database::instance()->pushWithId(query);
item->setId(id);
return id;
}
示例3: findById
/**
* @brief Repository::findById Constructs a query to find a row by its ID in the child's Repository
* associated table.
* @param id Id of the row to find.
* @return DBItem filled with the retrieved row columns.
*/
DBItem Repository::findById(int id) {
QueryBuilder qb = findByIdQB(id);
DBItem dbItem = Database::instance()->pullFirst(qb.getQuery());
return dbItem;
}
示例4: deleteById
void Repository::deleteById(int id) {
QueryBuilder qb = deleteByIdQb(id);
Database::instance()->push(qb.getQuery());
}