Description Usage Arguments Value Note
stored_procedure
is the workhorse of pocr
. However, the strings
it produces are only useful if the local machine is correctly configured to
connect to a POC SQL server, the database(s) involved are up to date, and
if the stored procedures called by the strings are valid.
sp_test
creates the SQL call strings for all available stored
procedures and tests the results of attempting to use each one to retrieve
data from a specified POC SQL server.
This function allows you to quickly check if the strings produced by
stored_procedure
can be used to get valid results on the local
machine.
More specifically, the function will let you determine if:
The provided POC SQL server connection works for accessing the needed database(s) and table(s).
Each of the available stored procedures return valid results.
1 | sp_test(connection, target_server = "test_annie", close_connection = TRUE)
|
connection |
An RODBC connection or a character vector that can be
passed to |
target_server |
POC has a few different servers you may want to test against, test-annie (use MySQL) and poc (uses SQL server). You need to specify which to test against: 'test_annie' or 'mysql' (equivalent), 'poc' or 'sqlserver' (equivalent). |
close_connection |
Boolean specifying if the provided or created
connection should be closed by the sp_test function. Defaults to |
When run, the function sends messages to the console describing the phases the function is running through. If the function completes without any connection or package errors, it returns a list with three pieces.
The first piece is a data frame ($sp_summary) summarizing the fate of each stored procedure call to the target server. This provides a quick summary of whether each stored procedure returned a data frame and states the number of columns and rows in the return.
The second is a data frame ($sp_strings) of the stored procedure names and the strings prepared for each by the stored_procedure function. This is useful for checking that valid strings were prepared and for seeing exactly what was passed to the server.
The third is a named list ($sp_details) of the data returned by each stored procedure call. This is useful for investigating stored procedures that were problematic and for manual inspection of stored procedure results in general.
sp_test
is configured to use its own print method. By default,
printing the results of sp_test
will only return the summary object
($sp_summary).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.