bool LinkedNotebookTable::update(LinkedNotebook ¬ebook, bool isDirty) { LinkedNotebook oldBook; qint32 lid = getLid(notebook.guid); get(oldBook, lid); if (lid <= 0) return false; expunge(lid); add(lid, notebook, isDirty); // Rename anything in the note list QString oldname = ""; QString newname = ""; if (notebook.shareName.isSet()) newname = notebook.shareName; if (oldBook.shareName.isSet()) oldname = oldBook.shareName; if (oldname != newname) { NSqlQuery query(*db); query.prepare("Update notetable set notebook=:name where notebooklid=:lid"); query.bindValue(":name", newname); query.bindValue(":lid", lid); query.exec(); query.finish(); } return true; }
ssize_t Chunk::read(uint32_t lid, vespalib::DataBuffer & buffer) const { vespalib::ConstBufferRef buf = getLid(lid); if (buf.size() != 0) { buffer.writeBytes(buf.c_str(), buf.size()); } return buf.size(); }
bool LinkedNotebookTable::update(LinkedNotebook ¬ebook, bool isDirty) { LinkedNotebook oldBook; qint32 lid = getLid(notebook.guid); get(oldBook, lid); if (lid <= 0) return false; expunge(lid); add(lid, notebook, isDirty); // Rename anything in the note list if (notebook.shareName != oldBook.shareName) { QSqlQuery query; query.prepare("Update notetable set notebook=:name where notebooklid=:lid"); query.bindValue(":name", QString::fromStdString(notebook.shareName)); query.bindValue(":lid", lid); query.exec(); } return true; }
// Return a notebook given the GUID as a std::string bool LinkedNotebookTable::get(LinkedNotebook ¬ebook, string guid) { qint32 lid = getLid(guid); return get(notebook, lid); }
// Given a notebook's GUID, we return the LID qint32 LinkedNotebookTable::getLid(string guid) { QString s(QString::fromStdString(guid)); return getLid(s); }
// Determine if a note is dirty given a guid bool NoteTable::exists(string guid) { qint32 lid = getLid(guid); return exists(lid); }
// Determine if a note is dirty given a guid bool NoteTable::isDirty(QString guid) { qint32 lid = getLid(guid); return isDirty(lid); }
// Return a note given the GUID as a std::string bool NoteTable::get(Note ¬e, string guid, bool loadResources, bool loadResourceRecognition) { qint32 lid = getLid(guid); return get(note, lid, loadResources, loadResourceRecognition); }
// Given a note's GUID, we return the LID qint32 NoteTable::getLid(string guid) { QString s(QString::fromStdString(guid)); return getLid(s); }