| 515 | } |
| 516 | |
| 517 | bool SQLiteDB::insertSourceEntry(uint object_id, const QString &path, const QString &name) |
| 518 | { |
| 519 | QVariant size, date_created, date_modified; |
| 520 | |
| 521 | QFileInfo info(path, name); |
| 522 | if(info.isFile()) { |
| 523 | size = QVariant(info.size()); |
| 524 | date_created = QVariant(info.birthTime().toUTC().toSecsSinceEpoch()); |
| 525 | } else { |
| 526 | size = QVariant(static_cast<qint64>(0)); |
| 527 | date_created = QVariant(static_cast<qint64>(0)); |
| 528 | } |
| 529 | |
| 530 | date_modified = QVariant(info.lastModified().toUTC().toSecsSinceEpoch()); |
| 531 | |
| 532 | QSqlQuery query; |
| 533 | query.prepare("REPLACE INTO sources (object_id, path, size, date_created, date_modified)" |
| 534 | "VALUES (:object_id, :path, :size, :date_created, :date_modified)"); |
| 535 | query.bindValue(0, object_id); |
| 536 | query.bindValue(1, name); |
| 537 | query.bindValue(2, size); |
| 538 | query.bindValue(3, date_created); |
| 539 | query.bindValue(4, date_modified); |
| 540 | bool ret = query.exec(); |
| 541 | if(!ret) { |
| 542 | qDebug() << query.lastError(); |
| 543 | } |
| 544 | return ret; |
| 545 | } |
| 546 | |
| 547 | uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id_parent, int type) |
| 548 | { |
nothing calls this directly
no outgoing calls
no test coverage detected