BiodbWritable-class {biodb}R Documentation

An abstract class (more like an interface) to model a writable database.

Description

A database class that implements this interface must allow the addition of new entries.

Methods

allowWriting()

:

Allows the connector to write into this database.

Returned value: None.

disallowWriting()

:

Disallows the connector to write into this database.

Returned value: None.

setWritingAllowed(allow)

:

Allows or disallows writing for this database.

allow: If set to TRUE, allows writing.

Returned value: None.

write()

:

Writes into the database. All modifications made to the database since the last time write() was called will be saved.

Returned value: None.

writingIsAllowed()

:

Tests if the connector has access right to the database.

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

See Also

BiodbConn.

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)

# Write the database
mydb$allowWriting()
mydb$setUrl('base.url', 'mydatabase.sqlite')
mydb$write()

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


[Package biodb version 1.0.4 Index]