Learn R Programming

PivotalR (version 0.1.18.5)

eql-methods: Test if two objects point to the same table

Description

This function checks if two '>db.obj objects are the equivalent. For objects of class '>db.data.frame, they need to have the same associated table. For objects of other types, they need to have identical expressions and the same associated table.

Usage

# S4 method for db.obj,db.obj
eql(e1,e2)

Arguments

e1, e2

The signature of the method. Both arguments are '>db.obj objects to be checked for equality.

Value

A logical. Returns TRUE is the objects are equal.

Details

Objects of type '>db.data.frame are considered equal if they have the same content representation, and their associated tables have the same name, connected datbase, and type. Objects of other types derived from db.obj are considered equal if they have the same values for content representation, @.source, @.parent, @.expression, @.where, @.conn.id, @.col.data_type, @.is.factor and @.col.name. Two objects of different types are always considered not equal.

See Also

lk or lookat Displays the actual data in a '>db.obj object.

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)
as.db.data.frame(abalone, "abalone", conn.id = cid, verbose = FALSE)

x <- db.data.frame('abalone', conn.id = cid, key = 'id') # use default connection 1

y <- db.data.frame('abalone', conn.id = cid)

## Check for equality
eql(x,y) # This returns true

## create a db.Rquery object
z <- x[,] # x is a db.data.frame object, but z is not

eql(x,z) # This returns false

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

Run the code above in your browser using DataLab