| 225 | } |
| 226 | |
| 227 | bool SQLiteDB::initialize() |
| 228 | { |
| 229 | QSqlQuery query; |
| 230 | |
| 231 | for(unsigned int i = 0; i < sizeof(table_list) / sizeof(const char *); i++) { |
| 232 | if(!query.exec(table_list[i])) { |
| 233 | qDebug() << query.lastError(); |
| 234 | return false; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | for(unsigned int i = 0; i < sizeof(trigger_list) / sizeof(const char *); i++) { |
| 239 | if(!query.exec(trigger_list[i])) { |
| 240 | qDebug() << query.lastError(); |
| 241 | return false; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | // force object_id to start at 256 |
| 246 | if(query.exec("INSERT INTO object_node (object_id, data_type, type) VALUES (255, 0, 0)")) { |
| 247 | query.exec("DELETE FROM object_node WHERE object_id = 255"); |
| 248 | } |
| 249 | return true; |
| 250 | } |
| 251 | |
| 252 | QSqlError SQLiteDB::getLastError() |
| 253 | { |
nothing calls this directly
no outgoing calls
no test coverage detected