U1db.Database

Database implements on-disk storage for documents and indexes. More...

Import Statement: import U1Db .
Instantiates: Database

Properties

Methods

Detailed Description

In a ListView the Database can be used as a model which includes all documents in the database. For listing only a subset of documents Query can be used.

ListView {
model: Database {
id: myDatabase
}
delegate: ListItem.Subtitled {
text: docId
subText: contents.color
}
}

See also Query.

Property Documentation

error : string

The last error as a string if the last operation failed.


path : string

A relative path can be given to store the database in an app-specific writable folder. This is recommended as it ensures to work with confinement. If more control is needed absolute paths or local file URIs can be used. By default or if the path is empty everything is stored in memory.


Method Documentation

void deleteDoc(string)

Deletes the document identified by docId.


Variant getDoc(string)

Returns the contents of a document by docId in a form that QML recognizes as a Variant object, it's identical to Document::getContents() with the same docId.


list<string> listDocs()

Returns a list of all stored documents by their docId.


string putDoc(var, string)

Updates the existing contents of the document identified by docId if there's no error. If no docId is given or docId is an empty string the contents will be stored under an autogenerated name. Returns the new revision of the document, or -1 on failure.