Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter all category trees to show only relevant entries #426

Merged
merged 3 commits into from Mar 12, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

SQLiteDatabase: Add method for "SELECT COUNT(*)" queries

  • Loading branch information...
ubruhin committed Mar 10, 2019
commit 354f77c65a3e41e992a18aed2270d06a1f00096b
@@ -160,6 +160,21 @@ QSqlQuery SQLiteDatabase::prepareQuery(const QString& query) const {
return q;
}

int SQLiteDatabase::count(QSqlQuery& query) {
exec(query); // can throw

int count = 0;
bool success = query.next() && query.value(0).isValid();
if (success) {
count = query.value(0).toInt(&success);
}
if (success) {
return count;
} else {
throw LogicError(__FILE__, __LINE__);
}
}

int SQLiteDatabase::insert(QSqlQuery& query) {
exec(query); // can throw

@@ -77,6 +77,7 @@ class SQLiteDatabase final : public QObject {

// General Methods
QSqlQuery prepareQuery(const QString& query) const;
int count(QSqlQuery& query);
int insert(QSqlQuery& query);
void exec(QSqlQuery& query);
void exec(const QString& query);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.