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,
project varchar(50) not null,
attribute varchar(90) not null,
value varchar(200) not null,
file_last_updated_date date not null,
retired bit not null
)
CREATE PROCEDURE security.prc_key_value_static
@project varchar(50),
@attribute varchar(90)
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) { # \dontrun{
value <- retrieve_key_value("file-server", "bbmc", "BbmcSecurity")
} # }