本文整理汇总了C++中QueryBuilder::select方法的典型用法代码示例。如果您正苦于以下问题:C++ QueryBuilder::select方法的具体用法?C++ QueryBuilder::select怎么用?C++ QueryBuilder::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findByIdQB
/**
* @brief Repository::findByIdQB Constructs a query to find one row by its id from the child's
* repository associated table.
* @param id Id of the row to find.
* @return QueryBuilder
*/
QueryBuilder Repository::findByIdQB(int id) {
QueryBuilder qb;
qb.select("*")
->from(getTableName())
->where("id = " + QString::number(id));
return qb;
}
示例2: 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);
}
示例3: findAllQB
/**
* @brief Repository::findAllQB Constructs a query to retrieve all the rows from the child's
* Repository associated table.
* @return QueryBuilder
*/
QueryBuilder Repository::findAllQB() {
QueryBuilder qb;
qb.select("*")->from(getTableName());
return qb;
}