Learn R Programming

ODB (version 1.2.1)

odb.tables: Gets description of every table in an ODB database.

Description

Gets description of every tables in the database through an "odb" connection : table names, column names, column SQL and R types.

Usage

odb.tables(odb)

Arguments

odb

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

Value

Returns a named list, whith an element for every table in the database. Data.frames are returned by dbColumnInfo, updated with comments returned by odb.comments.

See Also

dbColumnInfo, odb.comments

Examples

Run this code
# NOT RUN {
  # New empty .odb file
  odbFile <- tempfile(fileext=".odb")
  odb.create(odbFile, overwrite="do")
  odb <- odb.open(odbFile)
  
  # New tables
  SQL <- c(
    "CREATE TABLE fruits (
      name VARCHAR(6) PRIMARY KEY,
      color VARCHAR(32)
      )",
    "CREATE TABLE vegetables (
      name VARCHAR(6) PRIMARY KEY,
      color VARCHAR(32)
      )"
    )
  odb.write(odb, SQL)
  
  # Print tables
  print(odb.tables(odb))
  
  # Writes to the file and closes the connection
  odb.close(odb, write=TRUE)
# }

Run the code above in your browser using DataLab