| 255 | } |
| 256 | |
| 257 | int SQLiteDB::create() |
| 258 | { |
| 259 | int total_objects = 0; |
| 260 | |
| 261 | db.transaction(); |
| 262 | |
| 263 | if(!insertVirtualEntries()) { |
| 264 | db.rollback(); |
| 265 | return -1; |
| 266 | } |
| 267 | |
| 268 | for(int i = 0, max = sizeof(ohfi_array) / sizeof(int); i < max; i++) { |
| 269 | QString base_path = getBasePath(ohfi_array[i]); |
| 270 | int dir_count = recursiveScanRootDirectory(base_path, NULL, ohfi_array[i], ohfi_array[i]); |
| 271 | |
| 272 | if(dir_count < 0) { |
| 273 | db.rollback(); |
| 274 | return -1; |
| 275 | } |
| 276 | |
| 277 | //qDebug("Added %i objects for OHFI %#02X", dir_count, ohfi_array[i]); |
| 278 | |
| 279 | total_objects += dir_count; |
| 280 | } |
| 281 | db.commit(); |
| 282 | return total_objects; |
| 283 | } |
| 284 | |
| 285 | QString SQLiteDB::getBasePath(int root_ohfi) |
| 286 | { |
nothing calls this directly
no outgoing calls
no test coverage detected