Facilitates retrieval of key-value pairs that are stored in a SQL Server database.

retrieve_key_value(key, project_name, dsn_name, channel = NULL)

Arguments

key

The key associated with the desired value. Required character vector with one element

project_name

The project name associated with the desired value. Required character vector with one element

dsn_name

Name of the locally-defined DSN passed to DBI::dbConnect().

channel

An optional connection handle as returned by DBI::dbConnect(). See Details below. Optional.

Value

A character vector with one element.

Details

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

Note

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.

Author

Will Beasley

Examples

if (FALSE) {
value <- retrieve_key_value("file-server", "bbmc", "BbmcSecurity")
}