retrieve_key_value: Read a value stored in a database.

View source: R/retrieve-key-value.R

retrieve_key_valueR Documentation

Read a value stored in a database.

Description

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

Usage

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.

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

Value

A character vector with one element.

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(s)

Will Beasley

Examples

## Not run: 
value <- retrieve_key_value("file-server", "bbmc", "BbmcSecurity")

## End(Not run)

OuhscBbmc/OuhscMunge documentation built on Dec. 5, 2024, 4:34 a.m.