From version < 8.1 >
edited by nlo
on 09.05.2019, 09:58
To version < 6.2 >
edited by awa
on 11.04.2019, 16:44
< >
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.nlo
1 +XWiki.awa
Content
... ... @@ -8,32 +8,13 @@
8 8  
9 9  == Creating a database query ==
10 10  
11 +{{figure image="001En.png" width="300"}}
12 +Creating a database query in {{formcycle/}}
13 +{{/figure}}
11 11  
12 -
13 -* Für die Datenbank-Abfrage selbst, werden folgende Daten benötigt:
14 -** **Name**: Name der Datenbank-Abfrage
15 -** **Beschreibung**: Eine optionale Beschreibung der Datenbank-Abfrage
16 -** **Verbindung**: Die [[DB-Verbindung>>doc:DBConnections]], die verwendet werden soll
17 -
18 -* Die eigentliche **SQL-Abfrage** wird im Editor in der Mitte einegeben (siehe [[Abbildung>>||anchor="data_db_query"]]).
19 -
20 -Das eingegebene Statement wird als //Prepared-Statement// ausgeführt, so dass keine sogenannte //SQL-Injection// moglich ist. Verwenden Sie daher auch keine Hochkommas. Prinzipiell können auch Übergabeparameter verwendet werden. In der Abfrage setzen Sie an die Stelle des Übergabeparameters ein Fragezeichen {{code}}?{{/code}}.
21 -
22 -
23 -
24 -
25 -{{id name="data_db_query"/}}
26 -{{figure image="data_db_query_de.png"}}Configuration screen for creating a database query in: (1) list of existing DB queries, (2) editor for defining the SQL query, (3) settings of the DB query, (4) mask for testing the DB query.{{/figure}}
27 -
28 -* Open the module "Database queries" and click "New" {{ficon name="plus-circle-outline"/}} in the header of the list (see [[figure>>||anchor="fig_data_db_query"]]).
29 -* Für die Datenbank-Abfrage selbst, werden folgende Daten benötigt:
30 -** **Name**: Ein eindeutiger Name der Datenbank-Abfrage
31 -** **Beschreibung**: Eine optionale Beschreibung der Datenbank-Abfrage
32 -** **Verbindung**: Die [[DB-Verbindung>>doc:DBConnections]], die verwendet werden soll
33 -
34 34  * Enter a unique name.
35 35  * Select a database connection
36 -* Enter the SQL statement to be executed for the query in the editor (see [[figure>>||anchor="data_db_query"]]).
17 +* Enter the SQL statement to be executed for the query
37 37  
38 38  The entered SQL statement is executed as a prepared statement, which prevents SQL injection attacks. You should not and need not use inverted commas (` or '). Also, you can use question marks ( ? ) as placeholders to build queries dynamically.
39 39  
... ... @@ -45,8 +45,7 @@
45 45  http://<server>/formcycle/datenabfragedb
46 46  {{/code}}
47 47  
48 -The servlet URL is displayed beneath the settings (see [[figure>>||anchor="data_db_query"]]).
49 -The following URL parameters are supported:
29 +The following URL parameters are supported.
50 50  
51 51  |=Name of the paramter|=Description|=Required
52 52  |name|Must match the name of the database query.|Yes
... ... @@ -57,7 +57,7 @@
57 57  |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
58 58  |delimiter|The delimiter for the placeholder values, see //queryParameter//. Defaults to a comma {{code}},{{/code}}|No
59 59  
60 -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}}.
40 +When accessing a database servlet from a form, always use the database URL contained in the global object //XFC_METADATA//, see also the [[form-specific JavaScript objects>>doc:Formcycle.FormDesigner.CodingPanel.ScriptTab.FormMetadata]]. For example: {{code language="javascript"}}XFC_METADATA.urls.datasource_db{{/code}}.
61 61  
62 62  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//.
63 63  
Copyright 2000-2024