Query multiple SQL Statements in a single function call. A single statement is permitted and differs from the link{query} and link{send} functions by having providing the profile, progressBar, reportOverallTime, errorReportFile, and runAsBatch arguments that are passed to the link[DatabaseConnector]{executeSql}. If this function is throwing an error, the function will conversely loop over the sql statements individually.

execute_n(
  conn,
  conn_fun,
  sql_statements,
  verbose = TRUE,
  render_sql = TRUE,
  render_only = FALSE,
  profile = FALSE,
  progressBar = TRUE,
  reportOverallTime = TRUE,
  errorReportFile = file.path(getwd(), "errorReportSql.txt"),
  runAsBatch = FALSE
)

Arguments

conn

Connection object

sql_statements

A list or vector of SQL Statements of length 1 or greater.

verbose

If TRUE, details on the activity are returned in the console, such as when the querying starting and was completed.

render_sql

If TRUE, the SQL statement for the operation is returned in the console.

profile

When true, each separate statement is written to file prior to sending to the server, and the time taken to execute a statement is displayed.

progressBar

When true, a progress bar is shown based on the statements in the SQL code.

reportOverallTime

When true, the function will display the overall time taken to execute all statements.

errorReportFile

The file where an error report will be written if an error occurs. Defaults to 'errorReportSql.txt' in the current working directory.

runAsBatch

When true the SQL statements are sent to the server as a single batch, and executed there. This will be faster if you have many small SQL statements, but there will be no progress bar, and no per-statement error messages. If the database platform does not support batched updates the query is executed without batching.