...
...
...
...
Description
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
On this page
|
Description
A number of macros that run SQL queries and display data in the form of a table share common capabilities as described below. A JavaScript enabled browser is required to enable most of these capabilities.
In the macro editor window, all these common capabilities are logically grouped into various tabs based on the functionality for easy access and styling.
SQL settings:
Display settings:
Common SQL parameters
The following parameters are available on all SQL macros. Some parameters may have values that are restricted by your administrator for security or operational reasons.
Tabs |
---|
Macro Editor Label | Default |
---|
Description |
---|
dataSource
- may be restricted
Macro Parameter | ||||
---|---|---|---|---|
SQL settings | ||||
SQL statement | Data source |
profile | Specify the data source name. It represents an application server defined data source (Pro Edition) or data source profile defined by your administrator. |
Determines how the output is formatted:
- HTML — Generates HTML from the ResultSet. Data is HTML encoded unless data encoding is disabled.
- wiki — Generates and renders wiki markup from ResultSet. If the data contains unintended wiki markup characters, set the escape parameter to true.
- XHTML (Pro Edition) — Generates and renders XHTML from ResultSet. Data is HTML encoded unless encoding has been disabled (disableAntiXss).
- unrenderedWiki (Pro Edition) — Generates wiki markup from ResultSet, similar to wiki, without rendering. Wraps with a table-plus macro suitable for copying to another system.
Parameter will not work with our SQL-file Macro.
Additional SQL statements can be added after the macro body sql by specifying another location:
This is a required field and some of the data sources may be restricted | dataSource | |||||
SQL statement | Enter the SQL statements you want to execute. There is no limit to the number of statements you can run.
| sql-editor-query-input | ||||
SQL script | Method of locating script | Specifies the list of options where CSV data is located. The included data will follow the body data based on the location selected. Attachment - Data is read from the list of options selected for the following parameters:
|
Escape special wiki characters
When output is wiki-based, choose this option to escape special characters in wiki markup. Use this to prevent unintended wiki characters from interfering with table formatting.
p1 through p10
| dataLocation | ||||
p1 through pn | Click + Add a parameter (s) to create a set of optional data parameters to refine your SQL statements during Runtime. Each parameter field allows you to create a set of optional data parameters to refine your query. Parameters apply to your SQL statements during Runtime. Simply enter the number of parameters you want to create in the Start with parameter (s) field and click + Add a parameter (s) to define the parameters. You can define multiple parameters by clicking + Add value;there is no limit to the number of parameters you can add. For example, select * from example where name = ? or department = ?
|
row-number |
Runtime |
select
*
from
example
where name
= ?
or
department = ?
Auto commit SQL statements | On | Wikipedia:Autocommit or see your database documentation. |
- READ_COMMITTED
- READ_UNCOMMITTED
- REPEATABLE_READ
- SERIALIZABLE
- NONE
autoCommit | ||||
Transaction isolation level | Most DBMSs offer a number of transaction isolation levels, which control the degree of locking that occurs when selecting data. You can select among a list of 5 kinds of transaction isolation levels:
To know more about what you can do with each type, refer to Wikipedia: Isolation or See your database documentation. | transactionIsolation | ||
Maximum number of rows to retrieve and display |
Specify the upper limit for the number of rows your SQL query returns. Administrators can configure the limit. |
limit |
Maximum number of seconds for query to |
run | Time in seconds that a query runs before a forced timeout. The default value is set by your Confluence administrator in the global configuration for SQL for Confluence. Since 5.1. Select a value from the list to override the default setting. Your database and JDBC driver must support the selected value to use this parameter. This parameter can be managed by Macro Security for Confluence App. Requires database/JDBC enablement. |
queryTimeout | ||||
Render wiki markup macros in body | Off | If requested, the body will be rendered to expand wiki markup macros. The rendered macros must produce valid SQL syntax. This is useful to run macros from Scripting for Confluence or similar that can produce SQL output. | macros |