Learn R Programming

ODB (version 1.2.1)

odb.export: Exports an ODB database to a SQL file.

Description

Produces SQL queries describing the structure of the database and its content, and saves it to a file.

Usage

odb.export(odb, file)

Arguments

odb

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

file

Path to the file in which export the SQL queries.

Value

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

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"))
  
  # Export to a file
  sqlFile <- tempfile(fileext=".odb")
  odb.export(odb, sqlFile)
  
  # Writes to the file and closes the connection
  odb.close(odb, write=TRUE)
# }

Run the code above in your browser using DataLab