diff --git a/YACReaderLibrary/db_helper.cpp b/YACReaderLibrary/db_helper.cpp index 3af2b8b4..973d7af1 100644 --- a/YACReaderLibrary/db_helper.cpp +++ b/YACReaderLibrary/db_helper.cpp @@ -159,6 +159,48 @@ QString DBHelper::getLibraryName(int id) { return getLibraries().getName(id); } + +QList DBHelper::getLabelComics(qulonglong libraryId, qulonglong labelId) +{ + QString libraryPath = DBHelper::getLibraries().getPath(libraryId); + QSqlDatabase db = DataBaseManagement::loadDatabase(libraryPath+"/.yacreaderlibrary"); + + QList list; + + { + QSqlQuery selectQuery(db); + selectQuery.prepare("SELECT ci.number,ci.title,c.fileName,ci.numPages,c.id,c.parentId,c.path,ci.hash,ci.read,ci.isBis,ci.currentPage,ci.rating,ci.hasBeenOpened " + "FROM comic c INNER JOIN comic_info ci ON (c.comicInfoId = ci.id) " + "INNER JOIN comic_label cl ON (c.id == cl.comic_id) " + "WHERE cl.label_id = :parentLabelId " + "ORDER BY cl.ordering"); + selectQuery.bindValue(":parentLabelId", labelId); + selectQuery.exec(); + + while (selectQuery.next()) + { + ComicDB comic; + + QList data; + QSqlRecord record = selectQuery.record(); + for(int i=0;i getLibrariesNames(); static QString getLibraryName(int id); + static QList getLabelComics(qulonglong libraryId, qulonglong labelId); //objects management //deletes @@ -75,6 +76,7 @@ public: static QList getSortedComicsFromParent(qulonglong parentId, QSqlDatabase & db); static QList getComicsFromParent(qulonglong parentId, QSqlDatabase & db, bool sort = true); static QList getLabelItems(qulonglong libraryId); + //load static Folder loadFolder(qulonglong id, QSqlDatabase & db); static Folder loadFolder(const QString & folderName, qulonglong parentId, QSqlDatabase & db);