| 139 | } |
| 140 | |
| 141 | bool SqlDatabase::doesTableExist(QString table) |
| 142 | { |
| 143 | bool hasRow = false; |
| 144 | QString query = QString("SELECT name FROM sqlite_master WHERE type = 'table' AND name = '%1';").arg(table); |
| 145 | const QByteArray& text = query.toUtf8().constData(); |
| 146 | sqlite3_exec(_handle, text, [](void* _hasRow, int argc, char** argv, char** azColName) { |
| 147 | *(reinterpret_cast<bool*>(_hasRow)) = true; |
| 148 | return 0; |
| 149 | }, &hasRow, NULL); |
| 150 | return hasRow; |
| 151 | } |
| 152 | |
| 153 | bool SqlDatabase::isEmpty() |
| 154 | { |