MCPcopy Create free account
hub / github.com/YACReader/yacreader / insertComicsInLabel

Method insertComicsInLabel

YACReaderLibrary/db_helper.cpp:1561–1584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1559}
1560
1561void DBHelper::insertComicsInLabel(const QList<ComicDB> &comicsList, qulonglong labelId, QSqlDatabase &db)
1562{
1563 QSqlQuery getNumComics(QString("SELECT count(*) FROM comic_label WHERE label_id = %1;").arg(labelId), db);
1564 getNumComics.next();
1565
1566 int numComics = getNumComics.value(0).toInt();
1567
1568 db.transaction();
1569
1570 QSqlQuery query(db);
1571 query.prepare("INSERT INTO comic_label (label_id, comic_id, ordering) "
1572 "VALUES (:label_id, :comic_id, :ordering)");
1573
1574 for (const auto &comic : comicsList) {
1575 query.bindValue(":label_id", labelId);
1576 query.bindValue(":comic_id", comic.id);
1577 query.bindValue(":ordering", numComics++);
1578 query.exec();
1579 }
1580
1581 QLOG_TRACE() << query.lastError();
1582
1583 db.commit();
1584}
1585
1586void DBHelper::insertComicsInReadingList(const QList<ComicDB> &comicsList, qulonglong readingListId, QSqlDatabase &db)
1587{

Callers

nothing calls this directly

Calls 4

bindValueMethod · 0.80
execMethod · 0.80
QStringClass · 0.70
nextMethod · 0.45

Tested by

no test coverage detected