Common SQL Parameters - 11.x
On this page
The SQL for Confluence (Pro Edition) app version 11.x has removed the support for application server-defined data sources in Confluence 8.x. (Atlassian has ended support for the data source connections in Confluence 8.0. For more information, refer to Configuring a data source connection.)
In Confluence 8.x, we recommend reconfiguring the application server-defined data source profile to the connection string profile. For more information, refer to How to convert an application server defined data source profile to a connection string profile.
SQL for Confluence (Pro Edition) app version 11.x works seamlessly with Confluence 7.x (Confluence 7.4 to Confluence 7.20) versions, including support for application server-defined data sources (JNDI data source connections).
Description
Macros that run SQL scripts and display results 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:
Selecting a value in the macro overrides the default value set by an Administrator. The order of overriding the default setting is:
Macro level parameter > Profile configuration > Global configuration.
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 | 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. This is a required field and some of the data sources may be restricted. | dataSource | |
SQL statement | Use the available select lists to select the tables, views, and respective columns, and add them to your SQL statement. You can:
The tables, views, and columns in the select lists are loaded based on the Data source profile selected. There is no limit to the number of statements you can run.
| |||
SQL script | Method of locating script | None | Specifies the list of options where SQL scripts are located. The results will be based on the scripts present in the selected location.
Special note: How to deal with templates on Confluence 4.3 and later.
| script |
Parameters | p1 through pn | Click + Add 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 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 = ? Values for SQL parameter markers identified by "?" in SQL statements. On untrusted sites, prevent SQL injection attacks by using parameter markers. This is only necessary when the SQL statements are partially constructed from user input. Wiki markup SQL macros support an arbitrary number of parameter markers. An arbitrary number of parameter markers can be provided when using the wiki markup version of the SQL macro. See Wikipedia: SQL injection. | ||
Runtime | Auto commit SQL statements | On | Wikipedia: Autocommit or see your database documentation. | autoCommit |
Transaction isolation level | Default | 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 | Default | 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 | Default | 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.
| 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 | |
Display settings | ||||
Data layout | Output format | html | Specifies how the output is formatted:
| output |
Display rows vertically or horizontally | vertical | Note that most of the styling, formatting, sorting, auto, and similar parameters are applicable to only the vertical orientation setting. | rowOrientation | |
Show results as a table | On | Turn this toggle on to produce single values that you want to include in the text. | table | |
Use database column labels | Off | Choose whether to use a column name or column label for a row header. | columnLabel | |
Show number of rows updated | Off | For update SQL, determines whether or not to show the number of rows updated as a result of the operation. | showUpdateCount | |
Show error if there are no rows | Off | A ResultSet with no rows may indicate an error. Use this parameter to control what should happen in this case. A non-blank message must be available (noDataMessage). | noDataError | |
Text to display when there are no rows | Use @default to show a default error message. The message in this field is displayed only if Show results as a table is selected. | noDataMessage | ||
Advanced formatting | Show generated wiki markup | Off | When the output is wiki-based, choose this option to show the generated wiki markup. | showWiki |
Escape special wiki characters | Off | When the 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. | escape | |
Convert null fields to blank | On | Use this parameter to avoid displaying null values in the column. | convertNull | |
Stop encoding HTML characters | Off | If the SQL is producing HTML, this parameter needs to be selected (On). User must be authorized (via global app configuration or by more fine-grained control using Macro Security for Confluence) to use this option due to security considerations. | disableAntiXss | |
Expand array fields | On | For vertical row orientation, array fields can be expanded to one entry per line. | expandArray | |
Show SQL | Off | Displays SQL in a code macro. | showSql | |
Options for showing SQL code | Since 6.4. A comma-separated list of code or code-pro (Code Pro Macro) parameters used when Show SQL is selected. This allows for customization of how the SQL code is shown. See How to improve the display of SQL source. | showSqlOptions |
Log a request with our support team.
Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.