MCPcopy Create free account
hub / github.com/codestation/qcma / insertSourceEntry

Method insertSourceEntry

common/sqlitedb.cpp:517–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517bool 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
547uint SQLiteDB::insertMusicEntry(const QString &path, const QString &name, int id_parent, int type)
548{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected