Facilitates retrieval of key-value pairs that are stored in a SQL Server database.
retrieve_key_value(key, project_name, dsn_name, channel = NULL)
The key associated with the desired value. Required character vector with one element
The project name associated with the desired value. Required character vector with one element
Name of the locally-defined DSN passed to DBI::dbConnect()
.
An optional connection handle as returned by DBI::dbConnect()
. See Details below. Optional.
A character
vector with one element.
The database table and stored procedure must defined as:
CREATE TABLE security_private.tbl_key_value_static(
id smallint identity(1,1) primary key,
varchar(50) not null,
project attribute varchar(90) not null,
value varchar(200) not null,
date not null,
file_last_updated_date not null
retired bit
)
CREATE PROCEDURE security.prc_key_value_static
varchar(50),
@project varchar(90)
@attribute AS
BEGIN
SET NOCOUNT ON;
SELECT value from security_private.tbl_key_value_static
WHERE project = @project and attribute = @attribute
END
Currently only the 'static' key-value pairs are retrieved through this function. Talk to Will if you need to retrieve the 'rolling' or the 'personal' key-value pairs.
if (FALSE) {
value <- retrieve_key_value("file-server", "bbmc", "BbmcSecurity")
}