db.existsObject: Test whether an object exists in the database

Description Usage Arguments Value Author(s) See Also Examples

Description

Test whether a table or view exists in the database

Usage

1
db.existsObject(name, conn.id = 1, is.temp = FALSE)

Arguments

name

A string, the name of table or view

conn.id

An integer, default is 1. The ID of the database connection.

is.temp

A logical, default is FALSE. Whether this table/view is a temporary object.

Value

This function returns different types of results depending the input.

If name has the format of myschema.mytable, the return value is a logical. It is TRUE if the table/view exists in the database.

If name has the format of mytable and is.temp = FALSE, the return value is also a logical, which is TRUE if the table/view exists in the database.

If name has the format of mytable and is.temp = TRUE, the return value is a list. The list has two elements. The first is a logical, which is TRUE if the table/view exists in the database. The second is a character array with 2 elements, whose first is the temporary schema name and the second is the table/view name.

Author(s)

Author: Predictive Analytics Team at Pivotal Inc.

Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io

See Also

objects to See Also as help, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 


## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

db.list()

db.existsObject("madlibtestdata.lin_ornstein", cid)

db.disconnect(cid, verbose = FALSE)

## End(Not run)

PivotalR documentation built on March 13, 2021, 1:06 a.m.