... |
... |
@@ -27,7
+27,7 @@ |
27 |
27 |
|
28 |
28 |
You can access the database query by making a HTTP request to the corresponding database servlet and providing the required parameters as GET parameters. The URL to the database query servlet is as follows. |
29 |
29 |
|
30 |
|
-{{code}} |
|
30 |
+{{code language="none"}} |
31 |
31 |
http://<server>/formcycle/datenabfragedb |
32 |
32 |
{{/code}} |
33 |
33 |
|
... |
... |
@@ -41,9
+41,9 @@ |
41 |
41 |
|sqlParameter|Alias for //queryParameter//. This is deprecated from version 6 and should not be used anymore. It may be removed in future releases.| |
42 |
42 |
|queryParameter|Yes, if placeholders ( ? ) are used in the query. Must be a comma separated list of parameters and match the number of parameters used in the SQL query (from version 6).|No |
43 |
43 |
|varName|Allows you to change name of the JSON response object. If not given, a plain JSON object with the result data is returned.|No |
44 |
|
-|delimiter|The delimiter for the placeholder values, see //queryParameter//. Defaults to a comma {{code}},{{/code}}|No |
|
44 |
+|delimiter|The delimiter for the placeholder values, see //queryParameter//. Defaults to a comma {{code language="none"}},{{/code}}|No |
45 |
45 |
|
46 |
|
-When accessing a database servlet from a form, always use the database URL contained in the global object //XFC_METADATA//, see also the [[metadata>>doc:Formcycle.FormDesigner.CodingPanel.ScriptTab.FormMetadata]]. For example: {{code language="javascript"}}XFC_METADATA.urls.datasource_db{{/code}}. |
|
46 |
+When accessing a database servlet from a form, always use the database URL contained in the global object //XFC_METADATA//, see also the [[metadata>>doc:Formcycle.FormDesigner.CodingPanel.ScriptTab.FormMetadata]]. For example: {{code language="javascript"}}XFC_METADATA.urls.datasource_db{{/code}}. |
47 |
47 |
|
48 |
48 |
Further we recommend you use the script function [[getDataQuery>>doc:Formcycle.FormDesigner.CodingPanel.ScriptTab.AdditionalScriptFunctions.GetDataQuery]], so you do not have to setup the servlet request manually. The result of the database query is returned as //JSON//. |
49 |
49 |
|
... |
... |
@@ -50,7
+50,7 @@ |
50 |
50 |
== Testing the query == |
51 |
51 |
|
52 |
52 |
{{info}} |
53 |
|
-For quick testing of the query the shortcut {{code}}Ctrl + Enter{{/code}} is provided. |
|
53 |
+For quick testing of the query the shortcut {{code language="none"}}Ctrl + Enter{{/code}} is provided. |
54 |
54 |
{{/info}} |
55 |
55 |
|
56 |
56 |
Database queries can be tested directly from the configuration UI. For this purpose a test console is provided below the SQL editor (see [[figure>>||anchor="fig_data_db_query"]]). |
... |
... |
@@ -57,10
+57,10 @@ |
57 |
57 |
In the header of the console there is a row of buttons for controling the query: |
58 |
58 |
|
59 |
59 |
* {{ficon name="database-search"/}}**Perform query** |
60 |
|
-Runs the database query. If //query parameters// ({{code}}?{{/code}}) are provided the user will be prompted to input values vor those parameters. Otherwise the result of the query will be displayed directly in the //table view//. |
|
60 |
+Runs the database query. If //query parameters// ({{code language="none"}}?{{/code}}) are provided the user will be prompted to input values vor those parameters. Otherwise the result of the query will be displayed directly in the //table view//. |
61 |
61 |
{{lightbox image="data_db_query_test_en.png" title="Run the given query"/}} |
62 |
62 |
* {{icon name="question"/}}**Query parameters** |
63 |
|
-Mask for inputting values for query parameters. This option is only available if query parameters ({{code}}?{{/code}}) are used in the SQL query. The individual parameters will be enumerated in the SQL query. Clicking "User parameters for query" {{ficon name="arrow-right-bold-circle-outline2"/}} executes the query with the given parameters. The result will be displayed in the //table view//. |
|
63 |
+Mask for inputting values for query parameters. This option is only available if query parameters ({{code language="none"}}?{{/code}}) are used in the SQL query. The individual parameters will be enumerated in the SQL query. Clicking "User parameters for query" {{ficon name="arrow-right-bold-circle-outline2"/}} executes the query with the given parameters. The result will be displayed in the //table view//. |
64 |
64 |
{{lightbox image="data_db_query_test_param_en.png" title="Query parameters are enumerated"/}} |
65 |
65 |
Actual Query in the SQL editor: |
66 |
66 |
{{lightbox image="data_db_query_example_de.png" title="Example query"/}} |
... |
... |
@@ -106,7
+106,7 @@ |
106 |
106 |
|
107 |
107 |
This SQL statement returns the names of all persons with a certain first name. The first name to search for is specified via an URL parameter. |
108 |
108 |
|
109 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Robinson{{/code}} |
|
109 |
+URL for running the query: {{code language="none"}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Robinson{{/code}} |
110 |
110 |
|
111 |
111 |
|
112 |
112 |
{{code language="sql"}} |
... |
... |
@@ -115,7
+115,7 @@ |
115 |
115 |
|
116 |
116 |
Retrieves the name of a person with a certain ID. The ID is given as an URL parameter. |
117 |
117 |
|
118 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=100{{/code}} |
|
118 |
+URL for running the query: {{code language="none"}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=100{{/code}} |
119 |
119 |
|
120 |
120 |
|
121 |
121 |
{{code language="sql"}} |
... |
... |
@@ -124,7
+124,7 @@ |
124 |
124 |
|
125 |
125 |
Retrieves the names of all persons that live in certain city. The city and the ZIP code are given as URL parameters. |
126 |
126 |
|
127 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Paris,75001{{/code}} |
|
127 |
+URL for running the query: {{code language="none"}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Paris,75001{{/code}} |
128 |
128 |
|
129 |
129 |
|
130 |
130 |
{{code language="sql"}} |
... |
... |
@@ -133,7
+133,7 @@ |
133 |
133 |
|
134 |
134 |
This SQL statement returns the names of all persons who live in a place that **starts **with the given characters. The '%' character serves as a wildcard for any number of characters. Depending on the DBMS used, the syntax may differ slightly (here: MySQL). The requested value is passed via URL parameters. |
135 |
135 |
|
136 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Par{{/code}} |
|
136 |
+URL for running the query: {{code language="none"}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=Par{{/code}} |
137 |
137 |
|
138 |
138 |
|
139 |
139 |
{{code language="sql"}} |
... |
... |
@@ -142,4
+142,4 @@ |
142 |
142 |
|
143 |
143 |
This SQL statement returns the names of all persons who live in a place that **contains **the given characters. Upper/lower case spelling is irrelevant becauce the statement converts both, the value column and the actual filter value to lower case (lower(...)). The requested value is passed via URL parameters. |
144 |
144 |
|
145 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=aRi{{/code}} |
|
145 |
+URL for running the query: {{code language="none"}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&queryParameter=aRi{{/code}} |