executeSQL: This function executes one single SQL statement

Description Usage Arguments Details Value Examples

Description

This function renders, translates and executes one single SQL statement that produces a result

Usage

1
executeSQL(connection, schema, query, targetDBMS)

Arguments

connection

The connection to the database server.

schema

The database schema being used.

query

The SQL statement to retrieve the data.

targetDBMS

The target DBMS for SQL to be rendered in.

Details

Renders, translates, and executes a single SQL statement that is expeting to produce and result.

Value

An object containing the data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

  library("SqlRender")
  library("DatabaseConnector")
  library("Aphordite")
  connectionDetails <- createConnectionDetails(dbms="mysql", server="localhost",
         user="root", password="blah" ,schema="cdm_v5")
  conn <- connect(connectionDetails)

  concept_of_interest <- executeSQL(connection, schema, paste("SELECT concept_id,
         concept_name FROM @cdmSchema.concept WHERE lower(concept_name) =
         lower('myocardial infarction') AND standard_concept = 'S' AND
         invalid_reason IS NULL AND domain_id = 'Condition';" ,sep = ""),dbms)

  dbDisconnect(conn)

## End(Not run)

OHDSI/Aphrodite documentation built on Sept. 18, 2020, 10:26 p.m.