Commit 7a6a37920a936085b87bb03e97ccbe5c1cd17d29
1 parent
0495f89e
updated dbGallery
Showing
1 changed file
with
11 additions
and
11 deletions
sdk/plugins/gallery.cpp
| ... | ... | @@ -474,17 +474,17 @@ class dbGallery : public Gallery |
| 474 | 474 | static QSqlDatabase db; |
| 475 | 475 | if (!db.isValid()) db = QSqlDatabase::addDatabase("QSQLITE"); |
| 476 | 476 | db.setDatabaseName(file); |
| 477 | - if (!db.open()) qFatal("Input::loadDatabase failed to open SQLite database %s.", qPrintable((QString)file)); | |
| 477 | + if (!db.open()) qFatal("Failed to open SQLite database %s.", qPrintable(file.name)); | |
| 478 | 478 | |
| 479 | 479 | if (!import.isNull()) { |
| 480 | - qDebug("Parsing %s", qPrintable((QString)import)); | |
| 480 | + qDebug("Parsing %s", qPrintable(import.name)); | |
| 481 | 481 | QStringList lines = QtUtils::readLines(import); |
| 482 | 482 | QList<QStringList> cells; cells.reserve(lines.size()); |
| 483 | 483 | const QRegExp re("\\s*,\\s*"); |
| 484 | - foreach (const QString &line, lines) | |
| 484 | + foreach (const QString &line, lines) { | |
| 485 | 485 | cells.append(line.split(re)); |
| 486 | - if (cells.size() < 2) qFatal("Input::loadDatabase expected at least two rows in %s.", qPrintable((QString)import)); | |
| 487 | - if (cells[0].size() != cells[1].size()) qFatal("Input::loadDatabase column count mismatch."); | |
| 486 | + if (cells.last().size() != cells.first().size()) qFatal("Column count mismatch."); | |
| 487 | + } | |
| 488 | 488 | |
| 489 | 489 | QStringList columns, qMarks; |
| 490 | 490 | QList<QVariantList> variantLists; |
| ... | ... | @@ -506,21 +506,21 @@ class dbGallery : public Gallery |
| 506 | 506 | qDebug("Creating table %s", qPrintable(table)); |
| 507 | 507 | QSqlQuery q(db); |
| 508 | 508 | if (!q.exec("CREATE TABLE " + table + " (" + columns.join(", ") + ");")) |
| 509 | - qFatal("Input::loadDatabase %s.", qPrintable(q.lastError().text())); | |
| 509 | + qFatal("%s.", qPrintable(q.lastError().text())); | |
| 510 | 510 | if (!q.prepare("insert into " + table + " values (" + qMarks.join(", ") + ")")) |
| 511 | - qFatal("Input::loadDatabase %s.", qPrintable(q.lastError().text())); | |
| 511 | + qFatal("%s.", qPrintable(q.lastError().text())); | |
| 512 | 512 | foreach (const QVariantList &vl, variantLists) |
| 513 | 513 | q.addBindValue(vl); |
| 514 | - if (!q.execBatch()) qFatal("Input::loadDatabase %s.", qPrintable(q.lastError().text())); | |
| 514 | + if (!q.execBatch()) qFatal("%s.", qPrintable(q.lastError().text())); | |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | QSqlQuery q(db); |
| 518 | 518 | if (query.startsWith('\'') && query.endsWith('\'')) |
| 519 | 519 | query = query.mid(1, query.size()-2); |
| 520 | 520 | if (!q.exec(query)) |
| 521 | - qFatal("Input::loadDatabase %s.", qPrintable(q.lastError().text())); | |
| 521 | + qFatal("%s.", qPrintable(q.lastError().text())); | |
| 522 | 522 | if ((q.record().count() == 0) || (q.record().count() > 3)) |
| 523 | - qFatal("Input::loadDatabase query record expected one to three fields, got %d.", q.record().count()); | |
| 523 | + qFatal("Query record expected one to three fields, got %d.", q.record().count()); | |
| 524 | 524 | const bool hasMetadata = (q.record().count() >= 2); |
| 525 | 525 | const bool hasFilter = (q.record().count() >= 3); |
| 526 | 526 | |
| ... | ... | @@ -599,7 +599,7 @@ class dbGallery : public Gallery |
| 599 | 599 | void write(const Template &t) |
| 600 | 600 | { |
| 601 | 601 | (void) t; |
| 602 | - qFatal("Writing to a dbGallery not supported."); | |
| 602 | + qFatal("Writing not supported."); | |
| 603 | 603 | } |
| 604 | 604 | }; |
| 605 | 605 | ... | ... |