BiodbEditable-class {biodb}R Documentation

An interface to model an editable database.

Description

A database class that implements this interface allows the addition of new entries, the removal of entries and the modification of entries. If you want your modifications to be persistent, the database class must also be writable (see interface BiodbWritable), you must call the method write on the connector.

Methods

addNewEntry(entry)

:

Adds a new entry to the database. The passed entry must have been previously created from scratch using BiodbFactory::createNewEntry() or cloned from an existing entry using BiodbEntry::clone().

entry: The new entry to add. It must be a valid BiodbEntry object.

Returned value: None.

allowEditing()

:

Allows editing for this database.

Returned value: None.

disallowEditing()

:

Disallows editing for this database.

Returned value: None.

editingIsAllowed()

:

Tests if editing is allowed.

Returned value: TRUE if editing is allowed for this database, FALSE otherwise.

setEditingAllowed(allow)

:

Allow or disallow editing for this database.

allow: A logical value.

Returned value: None.

See Also

BiodbConn and BiodbWritable.

Examples

# Create an instance with default settings:
mybiodb <- biodb::newInst()

# Create an empty MASS SQLite database
mydb <- mybiodb$getFactory()$createConn('mass.sqlite')

# Create new entry object
entry <- mybiodb$getFactory()$createNewEntry('mass.sqlite')
entry$setFieldValue('accession', '0')
entry$setFieldValue('name', 'Some Entry')

# Add the new entry
mydb$allowEditing()
mydb$addNewEntry(entry)

# Terminate instance.
mybiodb$terminate()
mybiodb <- NULL


[Package biodb version 1.0.4 Index]