Info |
---|
|
This routine is available starting with SIL Engine™ 2.6.5. |
Syntax
...
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | databaseAvailable(dbstring [, sqlstring]) | Package | sql | Alias | | Pkg Usage | available(dbstring [, sqlstring]) |
|
Description
Excerpt |
---|
|
Checks if the database is available. |
Checks if the database is available. Optionally, it can check also the availability of the results for the SQL passed in as the second parameter.
...
...
Parameters
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
Parameter name | Type | Required | Description |
---|
dbstring |
|
...
...
Yes | Datasource JNDI name or the datasource name. For Jira database, this is set to "jdbc/JiraDS" by default, if exported. | sqlstring |
|
...
...
Return
...
Type
boolean Boolean (true/false)
Examples
Example 1
Let's suppose in our examples `TextField` is a custom field text already configured for the current Jira server instance and `TestDB` represents the database resource name configured in the server context. For more details see SQL Data Source Configuration.
...
data sources.
Code Block |
---|
language | java |
---|
TextField=databaseAvailable("TestDB"); //will set `TextField`'TextField' value to `true`'true' |
Example 2
Code Block |
---|
language | java |
---|
TextField=databaseAvailable("TestDB", "select pname from project"); //will set `TextField`'TextField' value to `true`'true' if the SQL passed in can be executed |
Example 3
Code Block |
---|
language | java |
---|
TextField=databaseAvailable("TestDB", "select pname from inexistentTableName");//will set `TextField`'TextField' value to `false`'false', because the SQL passed in cannot be executed |
Example 4
Code Block |
---|
language | java |
---|
TextField=databaseAvailable("InexistentTestDB", "select pname from project");//will set `TextField`'TextField' value to `false`'false', because the database resource does not exist |
...
Note |
---|
To configure the data source check the SQL |
...
See also
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 25 |
---|
showSpace | false |
---|
cql | label = " |
---|
|
...
...
routine" and space = currentSpace ( ) | labels |
---|
|
...
...