| 127 | } |
| 128 | |
| 129 | bool SqlDatabase::doesColumnExist(QString table, QString column) |
| 130 | { |
| 131 | bool hasRow = false; |
| 132 | QString query = QString("SELECT * FROM pragma_table_info('%1') WHERE name='%2';").arg(table).arg(column); |
| 133 | const QByteArray& text = query.toUtf8().constData(); |
| 134 | sqlite3_exec(_handle, text, [](void* _hasRow, int argc, char** argv, char** azColName) { |
| 135 | *(reinterpret_cast<bool*>(_hasRow)) = true; |
| 136 | return 0; |
| 137 | }, &hasRow, NULL); |
| 138 | return hasRow; |
| 139 | } |
| 140 | |
| 141 | bool SqlDatabase::doesTableExist(QString table) |
| 142 | { |