Learn R Programming

PivotalR (version 0.1.18.5)

content: Print the content of a db.obj object

Description

A db.data.frame object's content is the table/view name that it points to. A db.Rquery object's content is the SQL query that represents the operations applied on an existing db.data.frame. This function is mainly for debugging. Normal user who is not familiar with SQL does not need to use it.

Usage

content(x)

Arguments

x

A db.obj object, whose content will be returned.

Value

A string, the content of db.obj object x. A db.data.frame object's content is the table/view name that it points to. A db.Rquery object's content is the SQL query that represents the operations applied on an existing db.data.frame.

See Also

'>db.obj, '>db.data.frame, '>db.table, '>db.view, '>db.Rquery explain the definitions of the class hierarchy of this package.

Examples

Run this code
# NOT RUN {
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## 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)

delete("abalone", conn.id = cid)
y <- as.db.data.frame(abalone, "abalone", conn.id = cid) # create a table
x <- db.data.frame("abalone", conn.id = cid, key = "id")

## actually, x and y are pointing the same table
eql(x, y) # returns TRUE

content(x)
content(x$id)
content(x$id < 10)
content(x[,1:5])
content(x == y) # this is different from eql(x, y)
content(sort(x, INDICES = x$id))
content(x[x$id<10,])
content(x[1:10,])
content(colSums(x))
content(by(x, NULL, sum))
content(by(x, x$sex, sum))

db.disconnect(cid, verbose = FALSE)
# }

Run the code above in your browser using DataLab