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

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/odb.close.r

Description

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

Usage

1
  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.

Note

To take data in a first file and save it in an other, copy the file before using odb.open.

Author(s)

Sylvain Mareschal

See Also

odb.open

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  # 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)

ODB documentation built on March 26, 2020, 7:46 p.m.