dbpf_devices_sensors_add: Adds new devices_sensors to database

View source: R/dbpf_devices_sensors_add.R

dbpf_devices_sensors_addR Documentation

Adds new devices_sensors to database

Description

Inserts a data frame of new devices_sensors into database.

Usage

dbpf_devices_sensors_add(con, dev_sen, mode = "test")

Arguments

con

DB connection as returned by dbpf_con(). For insert priviledges specific user name and password need to be supplied.

dev_sen

Data frame with these columns (type): oldSerial: logger being removed from thermistor chain newSerial: logger being newly attatched to thermistor chain comment time (POSIXct, UTC)

mode

Can be 'test' (default) or 'insert' (requires login with insert previledges)

Details

Devices_sensors indicate the time when a device was connected to a specific string of sensors. Until assigned to a new string of sensors, the device is then interpreted to be at that sensor. Insertion is done one row at a time and feedback is provided. The default mode (mode='test') only tests the data to be inserted. Insert mode (mode='insert') requires a database connection generated with a login that has insert priviledge. In Test Mode, duplicate rows in the input data are identified and sensors and devices are tested for existance in the DB. The input data frame is retuned with three new columns containing test results.

Value

dev_sen dataframe with pass / fail result and message.

Author(s)

Hannah Macdonell <hannah.macdonell@carleton.ca>

Examples

## Not run: 
con    <- dbpf_con()
devices_sensors <- data.frame(oldSerial='E53128',
                                 newSerial='E53339',
                                 time=2021-08-19 17:20,
                                 comment="")
dbpf_devices_sensors_add(con, devices_sensors, mode="test")
dbDisconnect(con)

## End(Not run)

geocryology/PermafrostDB documentation built on April 17, 2025, 11:54 a.m.