| opm_dbput {opmextra} | R Documentation | 
Methods for inserting, querying and deleting
OPMX objects into or from
(SQL-based) relational databases using
RODBC.
  ## S4 method for signature 'integer,RODBC'
opm_dbclear(object, conn, map.tables = NULL, klass = "OPM_DB")
  ## S4 method for signature 'character,RODBC'
opm_dbfind(object, conn, map.tables = NULL, klass = "OPM_DB")
  ## S4 method for signature 'integer,RODBC'
opm_dbget(object, conn,
    map.tables = NULL, include = 2L, klass = c(opm_dbclass(include), "MOPMX")) 
  ## S4 method for signature 'DBTABLES,RODBC'
opm_dbnext(object, conn, map.tables = NULL)
  ## S4 method for signature 'DBTABLES,RODBC'
opm_dbput(object, conn,
    map.tables = NULL, start = opm_dbnext(object, conn, map.tables)) 
object | 
 
  | 
conn | 
 Database connection object.   | 
map.tables | 
 Passed as   | 
klass | 
 Character vector indicating one or several class names. For PM data this argument should not be changed.  | 
include | 
 Integer scalar indicating whether
aggregated data (1) or aggregated and discretised data
(2) or neither (0) should be added to the result. The
numeric method of   | 
start | 
 Integer vector determining the minimum
primary keys to which those in   | 
... | 
 Optional arguments passed between the methods.  | 
The RODBC methods use a simple quoting scheme for
table and column names.
Note that the deletion mechanism is based on ON
  DELETE CASCADE. To enable this in SQLite,
PRAGMA foreign_keys = ON; has to be called each
time a database is opened. See the according demo
entry.
The main functions are those for create, search, read and delete operations:
opm_dbput
returns an integer vector containing the primary keys of
the inserted plates. 
opm_dbfind returns an
integer vector containing the primary keys of the found
plates. 
opm_dbget returns a
MOPMX object with one element per plate
type. 
opm_dbclear invisibly returns the
result of dbGetQuery (which is usually
NULL). 
 Regarding the helper functions,
opm_dbnext returns an integer scalar that is
suitable as start argument of opm_dbput,
whereas opm_dbclass returns a character scalar
with the name of the intermediary class (derived from
OPM_DB) to be created for database I/O.
These need not normally be called by an opm user.
For checking whether a database (connection) is correctly
set up, opm_dbcheck is available in the opm
package, which returns a character vector whose elements
are either ok or a description of the error that
has occurred at that step of the checking process.
DBI::make.db.names pkgutils::by opm::opm_dbcheck
Other res: cor.test
# The SQL files for generating the expected database tables. Tables can
# be renamed, but then an according 'map.tables' argument must be used.
library(opm)
opm_files("sql")
## [1] "/usr/local/lib/R/library/opm/auxiliary/001_rdbms_drop.sql"  
## [2] "/usr/local/lib/R/library/opm/auxiliary/002_rdbms_create.sql"
## [3] "/usr/local/lib/R/library/opm/auxiliary/003_rdbms_delete.sql"
# Usage examples are given in these demos. An according database must be
# made accessible beforehand.
if (interactive())
  demo(package = "opmextra")