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

Method getReadingLists

YACReaderLibrary/db_helper.cpp:415–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415QList<ReadingList> DBHelper::getReadingLists(qulonglong libraryId)
416{
417 QString libraryPath = DBHelper::getLibraries().getPath(libraryId);
418 QString connectionName = "";
419 QList<ReadingList> list;
420
421 {
422 QSqlDatabase db = DataBaseManagement::loadDatabase(LibraryPaths::libraryDataPath(libraryPath));
423
424 QSqlQuery selectQuery("SELECT * from reading_list WHERE parentId IS NULL ORDER BY name DESC", db);
425
426 selectQuery.exec();
427
428 QSqlRecord record = selectQuery.record();
429
430 int name = record.indexOf("name");
431 int id = record.indexOf("id");
432 int ordering = record.indexOf("ordering");
433
434 while (selectQuery.next()) {
435 ReadingList item(selectQuery.value(name).toString(), selectQuery.value(id).toLongLong(), selectQuery.value(ordering).toInt());
436
437 if (list.isEmpty()) {
438 list.append(item);
439 } else {
440 int i = 0;
441 while (i < list.length() && naturalSortLessThanCI(list.at(i).getName(), item.getName()))
442 i++;
443 list.insert(i, item);
444 }
445 }
446 connectionName = db.connectionName();
447 }
448 // TODO ?
449 QSqlDatabase::removeDatabase(connectionName);
450
451 return list;
452}
453
454QList<ComicDB> DBHelper::getReadingListFullContent(qulonglong libraryId, qulonglong readingListId, bool getFullComicInfoFields)
455{

Callers

nothing calls this directly

Calls 8

naturalSortLessThanCIFunction · 0.85
getPathMethod · 0.80
execMethod · 0.80
toStringMethod · 0.80
isEmptyMethod · 0.80
nextMethod · 0.45
getNameMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected