@bkmj/node-red-contrib-odbcmj 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/odbc.html +71 -71
- package/package.json +1 -1
package/odbc.html
CHANGED
|
@@ -175,116 +175,116 @@
|
|
|
175
175
|
</div>
|
|
176
176
|
</script>
|
|
177
177
|
<script type="text/markdown" data-help-name="odbc config">
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
A configuration node that manages connections in an `odbc.pool` object.
|
|
179
|
+
[Can take any configuration property recognized by `odbc.pool()`](https://www.npmjs.com/package/odbc/v/2.4.8#constructor-odbcconnectconnectionstring).
|
|
180
|
+
The connection pool will initialize the first time an `odbc` node receives an input message.
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
## Properties
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
* (**required**) **`connectionString`**: <`string`>
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
An ODBC connection string that defines your DSN and/or connection string options.
|
|
187
|
+
Check your ODBC driver documentation for more information about valid connection strings.
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
Example:
|
|
190
|
+
```
|
|
191
|
+
DSN=MyDSN;DFT=2;
|
|
192
|
+
```
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
* (optional) **`initialSize`**: <`number`>
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
The number of connections created in the pool when it is initialized. Default: 5.
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
* (optional) **`incrementSize`**: <`number`>
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
The number of connections that are created when the pool is exhausted. Default: 5.
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
* (optional) **`maxSize`**: <`number`>
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
The maximum number of connections allowed in the pool before it won't create any more. Default: 15.
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
* (optional) **`shrinkPool`**: <`boolean`>
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
Whether the number of connections should be reduced to `initialSize` when they are returned to the pool. Default: true.
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
* (optional) **`connectionTimeout`**: <`number`>
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
The number of seconds for a connection to remain idle before closing. Default: 3.
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
* (optional) **`loginTimeout`**: <`number`>
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
The number of seconds for an attempt to create a connection before returning to the application. Default: 3.
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
* (optional) **`syntaxChecker`**: <`boolean`>
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
Whether the syntax validator is activated or not. If activated, the query string will be
|
|
221
|
+
[parsed](https://www.npmjs.com/package/node-sql-parser#create-ast-for-sql-statement)
|
|
222
|
+
and appended as an object to the output message with a key named `parsedQuery`. Default: false.
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
* (optional) **`syntax`**: <`string`>
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
Dropdown list of the available [SQL flavors available](https://www.npmjs.com/package/node-sql-parser#supported-database-sql-syntax).
|
|
227
|
+
Default: mysql.
|
|
228
228
|
</script>
|
|
229
229
|
|
|
230
230
|
<script type="text/markdown" data-help-name="odbc">
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
A node that runs a query when input is received. Each instance of the node can define its own query string,
|
|
232
|
+
as well as take a query and/or parameters as input. A query sent as an input message will override any query
|
|
233
|
+
defined in the node properties.
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
## Properties
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
* (**required**) **`connection`**: <`odbc config`>
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
The ODBC pool node that defines the connection settings and manages the connection pool used by this node.
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
* (optional) **`queryType`**: <`string`>
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
Selects the type of query to execute. Options are:
|
|
244
|
+
* `query`: A regular SQL query. Parameters can be passed using Mustache templating, a parameter array in `msg.parameters`, or directly in the query string.
|
|
245
|
+
* `statement`: A prepared statement (requires `msg.parameters`).
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
* (optional) **`query`**: <`string`>
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
A valid SQL query string.
|
|
250
|
+
* For `queryType: "query"`, it can contain parameters inserted using Mustache syntax (e.g., `{{{payload}}}`). You can also use placeholders (`?`) and provide an array of values in `msg.parameters`, or embed the parameters directly in the query string.
|
|
251
|
+
* For `queryType: "statement"`, it should use placeholders (`?`) for parameters.
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
* (**required**) **`result to`**: <`dot-notation string`>
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
255
|
+
The JSON nested element structure that will contain the result output. The string must be a valid
|
|
256
|
+
JSON object structure using dot-notation, minus the `msg.` (e.g., `payload.results`) and must not
|
|
257
|
+
start or end with a period. Square bracket notation is not allowed. The node input object is carried
|
|
258
|
+
out to the output, as long as the output object name does not conflict with it. If the targeted output
|
|
259
|
+
JSON object was already present in the input, the result from the query will be appended to it if it
|
|
260
|
+
was itself an object (but not an array); otherwise, the original key/value pair will be overwritten.
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
Example:
|
|
263
263
|
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
* `input msg: {"payload": {"result": {"othervalue": 10} } };`
|
|
265
|
+
* `result to: payload.results.values`
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
In this case, `values` will be appended to `result` without overwriting `othervalue`.
|
|
268
|
+
If `result` had been a string, then it would have been replaced by `values`.
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
## Inputs
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
The `odbc` node accepts a message input that can contain:
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
274
|
+
* **`query`**: <`string`> A valid SQL query string. This overrides the query defined in the node properties.
|
|
275
|
+
* **`payload`**:
|
|
276
|
+
* A JSON string containing a `query` property with the SQL string.
|
|
277
|
+
* An object with a `query` property containing the SQL string.
|
|
278
|
+
* **`parameters`**: <`array` or `object`>
|
|
279
|
+
* Required for prepared statements (`queryType: "statement"`).
|
|
280
|
+
* Can be an array of values or an object mapping parameter names to values.
|
|
281
|
+
* For regular queries (`queryType: "query"`) with placeholders (`?`), provide an array of values.
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
## Outputs
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
Returns a message containing:
|
|
286
286
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
* **`output object`**: <`array`> The `odbc` result array returned from the query.
|
|
288
|
+
* **`odbc`**: <`object`> Contains additional information returned by the `odbc` module.
|
|
289
|
+
* **`parsedQuery`**: <`object`> (Optional) The parsed SQL query if the syntax checker is enabled.
|
|
290
290
|
</script>
|