| 1535 | } |
| 1536 | |
| 1537 | void DBHelper::insertComicsInFavorites(const QList<ComicDB> &comicsList, QSqlDatabase &db) |
| 1538 | { |
| 1539 | QSqlQuery getNumComicsInFavoritesQuery("SELECT count(*) FROM comic_default_reading_list WHERE default_reading_list_id = 1;", db); |
| 1540 | getNumComicsInFavoritesQuery.next(); |
| 1541 | |
| 1542 | int numComics = getNumComicsInFavoritesQuery.value(0).toInt(); |
| 1543 | |
| 1544 | db.transaction(); |
| 1545 | |
| 1546 | QSqlQuery query(db); |
| 1547 | query.prepare("INSERT INTO comic_default_reading_list (default_reading_list_id, comic_id, ordering) " |
| 1548 | "VALUES (1, :comic_id, :ordering)"); |
| 1549 | |
| 1550 | for (const auto &comic : comicsList) { |
| 1551 | query.bindValue(":comic_id", comic.id); |
| 1552 | query.bindValue(":ordering", numComics++); |
| 1553 | query.exec(); |
| 1554 | } |
| 1555 | |
| 1556 | QLOG_TRACE() << query.lastError(); |
| 1557 | |
| 1558 | db.commit(); |
| 1559 | } |
| 1560 | |
| 1561 | void DBHelper::insertComicsInLabel(const QList<ComicDB> &comicsList, qulonglong labelId, QSqlDatabase &db) |
| 1562 | { |