stacomirtools (version 0.5.3)

RequeteODBC-class: Class "RequeteODBC"

Description

'ODBC' Query. This class enables to retrieve data from the database. This class is inherited by RequeteODBCwhere and RequeteODBCwheredate

Arguments

Objects from the Class

Objects can be created by calls of the form new("RequeteODBC", sql=character(), query=data.frame()).

baseODBC:

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

connection:

Object of class "ANY" The connection

etat:

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

silent:

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

sql:

Object of class "character" The query

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

Extends

Class "'>ConnectionODBC", directly.

Methods

connect

signature(object = "RequeteODBC"): Connection to the database

See Also

'>ConnectionODBC '>RequeteODBCwhere '>RequeteODBCwheredate

Examples

Run this code
# NOT RUN {
showClass("RequeteODBC")
# }
# NOT RUN {
 object=new("RequeteODBC")
 object@open=TRUE 
 ## this will leave the connection open, 
 ## by default it closes after the query is sent
 ## the following will work only if you have configured and 'ODBC' link
 object@baseODBC=c("myODBCconnection","myusername","mypassword")
 object@sql= "select * from mytable limit 100"
 object<-connect(object)
 odbcClose(object@connection)
 envir_stacomi=new.env()
 ## While testing I like to see the output of sometimes complex queries generated by the program
 assign("showmerequest",1,envir_stacomi) 
 ## You can assign any values (here 1)
 ## just tests the existence of "showmerequest" in envir_stacomi
 object=new("RequeteODBC")
 object@baseODBC=c("myODBCconnection","myusername","mypassword")
 object@sql= "select * from mytable limit 100"
 object<-connect(object)
## the connection is already closed, the query is printed
# }

Run the code above in your browser using DataCamp Workspace