TSdbiMethods {TSodbc}R Documentation

TSdbi ODBC Methods

Description

Methods for TSdbi ODBC time series dtabase connection.

Usage

    ## S4 method for signature 'ODBCDriver, character':
    TSconnect(drv, dbname, ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSget(serIDs, con, 
       TSrepresentation=getOption("TSrepresentation"),
       tf=NULL, start=tfstart(tf), end=tfend(tf),
       names=serIDs, TSdescription=FALSE, TSdoc=FALSE, TSlabel=FALSE,
       vintage=getOption("TSvintage"), panel=getOption("TSpanel"),   ...)
    ## S4 method for signature 'ANY, character,
    ##	 TSodbcConnection':
    TSput(x, serIDs, con, Table=NULL, 
       TSdescription.=TSdescription(x), TSdoc.=TSdoc(x), TSlabel.=TSlabel(x),  
       vintage=getOption("TSvintage"), panel=getOption("TSpanel"),  ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSdates(serIDs, con,  
       vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSdelete(serIDs, con,  
   vintage=getOption("TSvintage"), panel=getOption("TSpanel"), ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSdescription(x, con, ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSdoc(x, con, ...)
    ## S4 method for signature 'character,
    ##	 TSodbcConnection':
    TSlabel(x, con, ...)

    ## S4 method for signature 'RODBC':
    dbDisconnect(conn,...)
    ## S4 method for signature 'RODBC, character':
    dbExistsTable(conn, name, ...)
    ## S4 method for signature 'RODBC, character':
    dbGetQuery(conn, statement, ...)
    ## S4 method for signature 'RODBC':
    dbListTables(conn,...)
    ## S4 method for signature 'ODBCDriver':
    dbUnloadDriver(drv, ...)

    ## Default S3 method:
    ODBC()

Arguments

drv A ODBCDriver.
dbname A character string indicating a database name.
con A database connection.
conn A database connection.
name A database table.
statement Character string with an SQL statement.
serIDs identifiers for series to extract.
x data series to put on the database, or a series identifier for TSdescription and TSdoc.
TSrepresentation time series representation to use for the result.
names Optional character vector to use for series names.
tf Optional tframe to use for truncating data. (See tfwindow.)
start Optional start date to use for truncating data. (See tfwindow.)
end Optional end date to use for truncating data. (See tfwindow.)
TSdescription TRUE or FALSE indicating whether description should be extracted
TSdescription. Description to put on the database.
TSdoc TRUE or FALSE indicating whether documentation should be extracted.
TSdoc. Documentation to put on the database.
TSlabel TRUE or FALSE indicating whether series label should be extracted.
TSlabel. Short series label to put on the database.
Table Database table indication (necessary if it cannot be determined automatically).
vintage Vintage to be supplied (if supported by db).
panel Panel to be supplied (if supported by db).
... Arguments passed to other methods.

Details

These are ODBC methods for TSdbi. See the TSdbi for details and see the vignette distributed with this package for more complete examples.

Value

depends.

See Also

TSdbi-package, dbConnect, TSput sqlQuery

Examples

    con <- try(TSconnect(dbDriver("ODBC"), dbname="test"))
    if(! inherits(con, "try-error")) {
      z <- ts(rnorm(100), start=c(1975,1), frequency=12)
      seriesNames(z) <- "random1"
      if(TSexists("random1", con)) TSreplace(z, con) else
      TSput(z, con)
      z1 <- TSget("random1", con)
      tfplot(z1)
      z <- ts(matrix(rnorm(100),50,2), start=c(1975,1), frequency=4)
      seriesNames(z) <- c("random2","random3")
      if(TSexists("random2", con) |
         TSexists("random3", con) ) TSreplace(z, con) else
      TSput(z, con)
      z2 <- TSget("random2", con)
      tfplot(z2)
      TSdates("D1", con)
      TSdates("random2", con)
      TSdates(c("random1","random2","random3"), con)
      TSmeta("random2", con)
      options(TSconnection=con)
      z2 <- TSget(c("random2","random3"))
      z <- TSdates(c("D1","random2","random3"))
      print(z)
      TSmeta("random2")
      TSdelete("random1", con)
      TSdelete("random2")
      dbDisconnect(con)
      }
    con <- try(TSconnect(dbDriver("ODBC"), dbname="ets"))
    if(! inherits(con, "try-error")) {
      TSmeta("B103", con)
      z1 <- TSget("B103", con)
      tfplot(z1)
      z2 <- TSget(c("B103", "B104"), con)
      tfplot(z2)
      options(TSconnection=con)
      TSmeta("B103")
      z2 <- TSget(c("B103","B104"))
      TSmeta(z2)
      TSdates("D1", con)
      TSdates("B103", con)
      TSdates(c("D1","B103","B104"), con)
      z <- TSdates(c("D1","B103","B104"))
      print(z)
      start(z)
      end(z)
      dbDisconnect(con)
      }

[Package TSodbc version 2009.5-1 Index]