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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/odb.tables.r

Description

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

Usage

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

Author(s)

Sylvain Mareschal

See Also

dbColumnInfo, odb.comments

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  # 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)

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