bool LinkedNotebookTable::update(LinkedNotebook &notebook, 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;
}
Exemple #2
0
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();
}
Exemple #3
0
bool LinkedNotebookTable::update(LinkedNotebook &notebook, 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;
}
Exemple #4
0
// Return a notebook given the GUID as a std::string
bool LinkedNotebookTable::get(LinkedNotebook &notebook, string guid) {
    qint32 lid = getLid(guid);
    return get(notebook, lid);
}
Exemple #5
0
// Given a notebook's GUID, we return the LID
qint32 LinkedNotebookTable::getLid(string guid) {
    QString s(QString::fromStdString(guid));
    return getLid(s);
}
Exemple #6
0
// Determine if a note is dirty given a guid
bool NoteTable::exists(string guid) {
    qint32 lid = getLid(guid);
    return exists(lid);
}
Exemple #7
0
// Determine if a note is dirty given a guid
bool NoteTable::isDirty(QString guid) {
    qint32 lid = getLid(guid);
    return isDirty(lid);
}
Exemple #8
0
// Return a note given the GUID as a std::string
bool NoteTable::get(Note &note, string guid, bool loadResources, bool loadResourceRecognition) {
    qint32 lid = getLid(guid);
    return get(note, lid, loadResources, loadResourceRecognition);
}
Exemple #9
0
// Given a note's GUID, we return the LID
qint32 NoteTable::getLid(string guid) {
    QString s(QString::fromStdString(guid));
    return getLid(s);
}