BiodbWritable-class {biodb} | R Documentation |
A database class that implements this interface must allow the addition of new entries.
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.
# 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