SQL-based MS backend without active database connection
Source:R/MsBackendOfflineSql.R
MsBackendOfflineSql.Rd
The MsBackendOfflineSql
backend extends the MsBackendSql()
backend
directly and inherits thus all of its functions as well as properties.
The only difference between the two backend is that MsBackendSql
keeps
an active connection to the SQL database inside the object while the
MsBackendOfflineSql
backends reconnects to the SQL database for each
query. While the performance of the latter is slightly lower (due to the
need to connect/disconnect to the database for each function call) it can
also be used in a parallel processing environment.
Usage
MsBackendOfflineSql()
# S4 method for class 'MsBackendOfflineSql'
backendInitialize(
object,
drv = NULL,
dbname = character(),
user = character(),
password = character(),
host = character(),
port = NA_integer_,
data,
...
)
Arguments
- object
A
MsBackendOfflineSql
object.- drv
A DBI database driver object (such as
SQLite()
from theRSQLite
package orMariaDB()
from theRMariaDB
package). SeedbConnect()
for more information.- dbname
character(1)
with the name of the database. Passed directly todbConnect()
.- user
character(1)
with the user name for the database. Passed directly todbConnect()
.- password
character(1)
with the password for the database. Note that this password is stored (unencrypted) within the object. Passed directly todbConnect()
.- host
character(1)
with the host running the database. Passed directly todbConnect()
.- port
integer(1)
with the port number (optional). Passed directly todbConnect()
.- data
For
backendInitialize()
: optionalDataFrame
with the full spectra data that should be inserted into a (new)MsBackendSql
database. If provided, it is assumed that the provided database connection information if for a (writeable) empty database into whichdata
should be inserted.data
could be the output ofspectraData
from another backend.- ...
ignored.
Creation of backend objects
An empty instance of an MsBackendOfflineSql
class can be created using the
MsBackendOfflineSql()
function. An existing MsBackendSql SQL database
can be loaded with the backendInitialize()
function. This function takes
parameters drv
, dbname
, user
, password
, host
and port
, all
parameters that are passed to the dbConnect()
function to connect to
the (existing) SQL database.
See MsBackendSql()
for information on how to create a MsBackend SQL
database.