stacomirtools (version 0.5.2)

RequeteODBCwhere-class: Class "RequeteODBCwhere"

Description

SQL Query with WHERE and ORDER BY clauses.

Arguments

Objects from the Class

Objects can be created by calls of the form new("RequeteODBCwhere", where=character(),and=vector(),order_by=character()).

select:

Object of class "character" The "SELECT" part of the query

where:

Object of class "character" The "WHERE" part of the query

and:

Object of class "vector" The "AND" part of the query

order_by:

Object of class "character" The "ORDER BY" part of the query

sql:

Object of class "character" The query built by aggregating "select","where","and", and "order_by" slots

query:

Object of class "data.frame" The result of the query

open:

Object of class "logical" Should the connection remain open, choosing this ensures more rapid multiple queries

baseODBC:

Object of class "vector" The name, user and password of the database

silent:

Object of class "logical" TRUE if the query must be executed silently, FALSE else

etat:

Object of class "character" The state of the query (Connecting, successful,...)

connection:

Object of class "ANY" The database connection

Extends

Class "'>RequeteODBC", directly. Class "'>ConnectionODBC", by class "RequeteODBC", distance 2.

Methods

connect

signature(object = "RequeteODBCwhere"): Connect to the database

See Also

'>ConnectionODBC '>RequeteODBC '>RequeteODBCwheredate

Examples

Run this code
# NOT RUN {
showClass("RequeteODBCwhere")
# }
# NOT RUN {
 test<-0
 object=new("RequeteODBCwhere")
 object@baseODBC=c("myodbcconnection","myusername","mypassword")
 object@select= "select * from mytable limit 100"
 # assuming mycol, mycol1 and mycol2 are numeric
 object@where=paste(" where mycol>",test,sep="")
 object@and=paste(" and mycol2>",test," and mycol3<",test,sep="")
 object@order_by=" order by mycol1" 
 object<-connect(object)
 ## now object@sql contains the syntax of the query. 
 ## By changing the test variable, one can see how the
 ## function might be usefull
 ##  object@query contains the resulting data.frame
 
# }

Run the code above in your browser using DataCamp Workspace