Learn R Programming

ODB (version 1.2.1)

odb.close: Closes an "ODB" connection and updates the .odb file

Description

Closes the connection to the embedded HSQLDB, removing temporary files and updating the .odb file if asked to do so.

Usage

odb.close(odb, write = TRUE)

Arguments

odb

An '>ODB object, as produced by odb.open.

write

Single logical value, defining if the modifications has to be saved in the original .odb file or not. Notice they will be definitively lost if closing with write=FALSE.

Value

Invisibly returns TRUE if succeeds, raises an error if not.

See Also

odb.open

Examples

Run this code
# NOT RUN {
  # New empty .odb file
  odbFile <- tempfile(fileext=".odb")
  odb.create(odbFile, overwrite="do")
  odb <- odb.open(odbFile)
  
  # New table
  odb.write(odb, "CREATE TABLE fruits (name VARCHAR(6) PRIMARY KEY)")
  odb.insert(odb, "fruits", c("banana", "pear", "peach"))
  
  # Writes to the file and closes the connection
  odb.close(odb, write=TRUE)
# }

Run the code above in your browser using DataLab