connect-RequeteODBC-method: connect method loads a request to the database and returns...

connect,RequeteODBC-methodR Documentation

connect method loads a request to the database and returns either an error or a data.frame

Description

connect method loads a request to the database and returns either an error or a data.frame

Usage

## S4 method for signature 'RequeteODBC'
connect(object)

Arguments

object

an object of class RequeteODBC

Value

An object of class RequeteODBC

Note

assign("showmerequest",1,envir=envir_stacomi) allows to print all queries passing on the class RequeteDB

Author(s)

Cedric Briand cedric.briand@eptb-vilaine.fr

Examples

showClass("RequeteODBC")
## Not run: 
object=new("RequeteODBC")
object@open=TRUE
object@baseODBC=baseODBC
object@sql= "select * from t_lot_lot limit 100"
object<-connect(object)
odbcClose(object@connection)
odbcCloseAll()
  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 if you want 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

## End(Not run)

stacomirtools documentation built on Sept. 9, 2022, 3:07 p.m.