MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / getSize

Method getSize

sql/notetable.cpp:2613–2633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2611
2612
2613qlonglong NoteTable::getSize(qint32 lid) {
2614 NSqlQuery query(db);
2615 db->lockForRead();
2616 query.prepare("select data from datastore where key=:key and lid=:lid");
2617 query.bindValue(":key", NOTE_CONTENT_LENGTH);
2618 query.bindValue(":lid", lid);
2619 query.exec();
2620 qlonglong returnValue = 0;
2621 if (query.next()) {
2622 returnValue = query.value(0).toLongLong();
2623 }
2624 query.prepare("Select sum(data) from DataStore where key=:key and lid in (select lid from datastore where key=:key2 and data=:lid)");
2625 query.bindValue(":key", RESOURCE_DATA_SIZE);
2626 query.bindValue(":key2", RESOURCE_NOTE_LID);
2627 query.bindValue(":data", lid);
2628 query.exec();
2629 while (query.next()) {
2630 returnValue = returnValue+query.value(0).toLongLong();
2631 }
2632 return returnValue;
2633}

Callers 1

updateNoteContentMethod · 0.95

Calls 5

lockForReadMethod · 0.80
bindValueMethod · 0.80
valueMethod · 0.80
prepareMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected