Skip to content

Commit 5adda0f

Browse files
committed
Proofread
1 parent 8b22798 commit 5adda0f

1 file changed

Lines changed: 44 additions & 23 deletions

File tree

  • content/en/docs/marketplace/platform-supported-content/modules

content/en/docs/marketplace/platform-supported-content/modules/oql-module.md

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ description: "Describes the configuration and usage of the OQL module, which is
66

77
## Introduction
88

9-
The [OQL Module](https://marketplace.mendix.com/link/component/66876) executes [OQL](https://docs.mendix.com/refguide/oql/) queries and returns the results as a list of Mendix objects, a count of results in the database or a CSV file.
9+
The [OQL Module](https://marketplace.mendix.com/link/component/66876) adds microflow actions which execute [OQL](https://docs.mendix.com/refguide/oql/) queries and return the results as a list of Mendix objects, a count of results in the database, or a CSV file. This means that you do not need to write your own Java actions to execute OQL queries.
1010

1111
### Typical Use Cases
1212

13-
This module allows users to run arbitrary OQL queries without having to write Java code.
14-
It is also an alternative to [View Entities](/refguide/view-entities/) with support for running dynamic OQL queries and using OQL parameters.
15-
Unless these features are necessary, it is recommended to use View Entities.
13+
This module allows users to run OQL queries directly from a string or from a [dataset](/refguide/data-sets/) without having to write Java code.
1614

17-
Alternatively, this module can be used to interactively investigate data problems in a running app.
15+
It is also an alternative to [View Entities](/refguide/view-entities/) where you need support for running dynamic OQL queries and using OQL parameters. Unless these features are necessary, Mendix recommends that you use View Entities.
16+
17+
You can also use this module to interactively investigate data problems in a running app.
1818

1919
{{% alert color="warning" %}}
2020
The OQL Module does not validate the input query and does not apply user role access controls when executing queries.
@@ -23,58 +23,72 @@ Care should be taken to guarantee that the query is valid and does not expose ap
2323

2424
### Features
2525

26-
* Execute an OQL query directly or load a query from a dataset
26+
The OQL module has the following features:
27+
28+
* Executes an OQL query directly or loads a query from a dataset
2729
* Supports running queries with limit and offset
2830
* Supports OQL named query parameters
29-
* Option to return data directly or generate a CSV file
30-
* Option to compress the generated CSV file in a Zip file
31-
* Customize CSV files to use different characters for quoting strings, separating values, and escaping special characters
32-
* Customize CSV files to remove new line sequences from string values
31+
* Returns data directly or generates a CSV file
32+
* If you opt to generate a CSV file, this can be created with the following characteristics:
33+
* Compressed in a Zip file
34+
* Customized to use different characters for quoting strings, separating values, and escaping special characters
35+
* Customized to remove new line sequences from string values
3336

3437
## Available OQL Actions
3538

36-
All actions support defining [Named Parameters](#named-parameters) for queries.
37-
Only `SELECT` queries are supported and all queries are executed without access rules.
39+
{{% alert color="info" %}}
3840

39-
### ExecuteOQLStatement {#executeoqlstatement}
41+
* Only `SELECT` queries are supported
42+
* All actions support defining named parameters for queries – see [Named Parameters](#named-parameters), below, for more information
43+
* All queries are executed without access rules
44+
45+
{{% /alert %}}
4046

41-
This action executes an OQL query, either directly or by loading one from a dataset. If you wish to use a dataset, you need to provide its fully qualified name (example "MyFirstModule.Dataset", instead of just "Dataset").
47+
### ExecuteOQLStatement {#executeoqlstatement}
4248

43-
Returns: A list of Mendix objects of type `returnEntity` with each query column stored in an attribute or association of the same name. Note:
44-
- Attributes and associations of the `returnEntity` that are not present in the query are ignored
45-
- Only associations owned by the `returnEntity` are considered when setting associations
49+
This action executes an OQL query, either directly or by loading one from a dataset. If you wish to use a dataset, you need to provide its fully-qualified name (for example "MyFirstModule.Dataset", rather than just "Dataset").
4650

4751
This action takes the following parameters:
52+
4853
* `statement`: OQL Query or fully qualified name of a Dataset (module and Dataset name) to be executed
4954
* `returnEntity`: Entity type to be used to store results
5055
* `amount`: If not `empty` or 0, will limit the number of results to at most this amount. It is recommended to use an explicit sorting order in the OQL query when using amount
5156
* `offset`: If not `empty` or 0, will offset the results of the query by this quantity. It is recommended to use an explicit sorting order in the OQL query when using offset
5257
* `preserveParameters`: If false, all parameters defined for this query will be cleared
5358

54-
### CountRowsOQLStatement {#countrowsoqlstatement}
59+
It returns the following:
5560

56-
Similar to `ExecuteOQLStatement` above, but returns only the number of results. Useful to obtain information from the database without the overhead of generating Mendix objects.
61+
* A list of Mendix objects of type `returnEntity` using the following rules:
62+
* Each query result column is stored in an attribute or association of the same name
63+
* Attributes and associations of the `returnEntity` that are not present in the query are given the default value
64+
* Only associations owned by the `returnEntity` are considered when setting associations
65+
66+
### CountRowsOQLStatement {#countrowsoqlstatement}
5767

58-
Returns: The number of results of executing `statement`
68+
Similar to `ExecuteOQLStatement`, above, but returns only the number of results. Use this to obtain information from the database without the overhead of generating Mendix objects.
5969

60-
This action does not support datasets
70+
This action does not support datasets.
6171

6272
[Named parameters](#named-parameters) are always reset on completion.
6373

6474
This action takes the following parameters:
75+
6576
* `statement`: OQL Query to be executed
6677
* `amount`: Limits the number of results to at most this amount. If there are more results in the query than this limit, this amount is returned instead. If set to 0, no limit is applied
6778
* `offset`: This parameter is ignored and might be removed in a future version
6879

80+
It returns the following:
81+
82+
* The number of results of executing `statement`
83+
6984
### ExportOQLToCSV {#exportoqltocsv}
7085

7186
This action executes an OQL query and saves the result in a CSV file.
7287

73-
Returns: An object of type `FileDocument` (or a specialization of it) containing the CSV file with the results of executing `statement`
74-
7588
[Named parameters](#named-parameters) are always reset on completion.
7689

7790
This action takes the following parameters:
91+
7892
* `statement`: OQL Query or fully qualified name of a Dataset (module and Dataset name) to be executed
7993
* `returnEntity`: A FileDocument or one of its specializations where the resulting file will be stored
8094
* `removeNewLinesFromValues`: Indicates if new lines inside string values should be replaced with spaces
@@ -84,14 +98,21 @@ This action takes the following parameters:
8498
* `quoteChar`: Indicates what character should be used to quote string values. May be left empty if `escapeChar` is defined
8599
* `escapeChar`: Indicates what character should be used to escape spaces and other special characters if string values are unquoted. Only applicable if `escapeChar` is not defined
86100

101+
It returns the following:
102+
103+
* An object of type specified in the `returnEntity` parameter containing the CSV file with the results of executing `statement`
104+
87105
## Named Parameters {#named-parameters}
88106

89107
If you wish to use named parameters inside an OQL query, you must call the following actions to set their values before calling the actions above:
108+
90109
* `AddBooleanParameter`: For Boolean parameters
91110
* `AddDateTimeParameter`: For Date and Time parameters
92111
* `AddDecimalParameter`: For parameters of type Decimal
93112
* `AddIntegerLongValue`: For parameters of type Integer/Long
94113
* `AddObjectParameter`: For parameters that reference a Mendix Object
95114
* `AddStringParameter`: For String parameters
96115

116+
{{% alert color="info" %}}
97117
If you wish to keep the same parameters across multiple calls to the [ExecuteOQLStatement](#executeoqlstatement) action, you must set `preserveParameters` to `true`. All other OQL actions above will clear all defined parameters after every call.
118+
{{% /alert %}}

0 commit comments

Comments
 (0)