@bkmj/node-red-contrib-odbcmj 2.4.1 → 2.5.0

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.
Files changed (4) hide show
  1. package/README.md +21 -12
  2. package/odbc.html +44 -17
  3. package/odbc.js +59 -24
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Node-RED Contrib ODBC MJ
2
2
 
3
- A powerful and robust Node-RED node to connect to any ODBC data source. It features connection pooling, advanced retry logic, secure credential management, dynamic query sources, and result set streaming.
3
+ A powerful and robust Node-RED node to connect to any ODBC data source. It features connection pooling, advanced retry logic, secure credential management, dynamic query sources, result set streaming, and configurable timeouts.
4
4
 
5
5
  This node is a fork with significant enhancements to provide stability and advanced features for enterprise use cases.
6
6
 
@@ -11,10 +11,11 @@ This node is a fork with significant enhancements to provide stability and advan
11
11
  - **Secure Credential Storage**: Passwords are saved using Node-RED's built-in credential system.
12
12
  - **Connection Tester**: Instantly validate your connection settings from the configuration panel.
13
13
  - **Dynamic Inputs**: Source your SQL query and parameters from message properties, flow/global context, or environment variables.
14
- - **Advanced Retry Logic**: Automatically handles connection errors with configurable delays and retries to ensure flow resilience.
15
- - **Result Streaming**: Process queries with millions of rows without exhausting memory by streaming results as chunks.
14
+ - **Intelligent Error Handling & Retry Logic**: Differentiates between SQL errors and actual connection problems. Automatically handles connection errors with configurable delays and retries to ensure flow resilience.
15
+ - **Result Streaming**: Process queries with millions of rows without exhausting memory by streaming results as chunks, with a clear completion signal.
16
+ - **Configurable Timeouts**: Set timeouts for login, query execution, and internal close operations to prevent hangs.
17
+ - **Optional Fast Shutdown**: Provides a "fire-and-forget" option for pool closing to handle problematic drivers during Node-RED shutdown/deploy.
16
18
  - **Syntax Checker**: Optionally parse the SQL query to validate its structure.
17
- - **Query Timeout**: Configure a timeout for query execution to prevent indefinite hangs.
18
19
 
19
20
  ---
20
21
 
@@ -26,8 +27,6 @@ A configuration node that manages the connection to your database.
26
27
 
27
28
  #### Connection Modes
28
29
 
29
- Version 2.0 introduces two ways to configure your connection:
30
-
31
30
  ##### 1. Structured Fields Mode (Recommended)
32
31
 
33
32
  This is the easiest and most secure way to set up a connection for common databases.
@@ -55,15 +54,25 @@ A **Test Connection** button in the configuration panel allows you to instantly
55
54
  - **`Increment Pool Size`** `<number>` (optional): The number of connections to create when the pool is exhausted. Default: 5.
56
55
  - **`Max Pool Size`** `<number>` (optional): The maximum number of connections allowed in the pool. Default: 15.
57
56
  - **`Shrink Pool`** `<boolean>` (optional): If checked, reduces the number of connections to `Initial Pool Size` when they are returned to the pool if the pool has grown. Default: true.
58
- - **`Idle Timeout`** `<number>` (optional): The number of seconds for a connection in the pool to remain idle before closing. Default: 3 seconds. (Refers to the `connectionTimeout` property of the `odbc` library's pool options).
57
+ - **`Idle Timeout`** `<number>` (optional): The number of seconds for a connection in the pool to remain idle before closing. Default: 3 seconds. (Refers to the `connectionTimeout` property of the `odbc` library's pool options, converted to seconds).
59
58
  - **`Login Timeout`** `<number>` (optional): The number of seconds for an attempt to establish a new connection to succeed. Default: 5 seconds.
60
59
  - **`Query Timeout`** `<number>` (optional): The number of seconds for a query to execute before timing out. A value of **0** means infinite or uses the driver/database default. Default: 0 seconds.
61
60
 
62
61
  #### Error Handling & Retry
63
62
 
64
- - **`Retry with fresh connection`** `<boolean>` (optional): If a query fails using a connection from the pool, the node will try once more with a brand new, direct connection. If this succeeds, the entire connection pool is reset to clear any potentially stale connections. Default: false.
65
- - **`Retry Delay`** `<number>` (optional): If all immediate attempts (pooled and, if enabled, fresh connection) fail, this sets a delay in seconds before another retry is attempted for the incoming message. A value of **0** disables this timed retry mechanism. Default: 5.
66
- - **`Retry on new message`** `<boolean>` (optional): If the node is waiting for a timed retry (due to `Retry Delay`), a new incoming message can, if this is checked, override the timer and trigger an immediate retry of the *original* message that failed. Default: true.
63
+ The node attempts to distinguish between errors related to the SQL query itself (syntax, permissions) and actual connection problems. Connection retry mechanisms are primarily invoked for suspected connection issues.
64
+
65
+ - **`Retry with fresh connection`** `<boolean>` (optional): If a query fails and a basic connectivity test (e.g., `SELECT 1`) also suggests a problem with the current pooled connection, the node will try once more with a brand new, direct connection. If this second attempt (including its own successful basic connectivity test followed by the user's query) succeeds, the entire connection pool is reset to clear any potentially stale connections. Default: false.
66
+ - **`Retry Delay`** `<number>` (optional): If all immediate attempts fail and the problem is diagnosed as a *connection issue* (e.g., the `SELECT 1` test fails on both pooled and fresh connections), this sets a delay in seconds before another attempt to process the incoming message is made (using the pool again). A value of **0** disables this timed retry mechanism for connection issues. Default: 5.
67
+ - **`Retry on new message`** `<boolean>` (optional): If the node is waiting for a timed retry (due to `Retry Delay` for a connection issue), a new incoming message can, if this is checked, override the timer and trigger an immediate retry of the *original* message that failed. Default: true.
68
+
69
+ #### Shutdown Options
70
+
71
+ - **`Fast close (Fire-and-forget)`** `<boolean>` (optional):
72
+ - **Warning:** When checked, Node-RED will not wait for the connection pool to properly close during a deploy or shutdown.
73
+ - This option can prevent Node-RED from hanging if specific ODBC drivers have issues closing connections quickly.
74
+ - However, enabling this may result in orphaned connections on the database server, potentially consuming server resources.
75
+ - It is recommended to leave this unchecked unless you are experiencing hangs during Node-RED deploys or shutdowns related to this config node. Default: false.
67
76
 
68
77
  #### Advanced
69
78
 
@@ -98,8 +107,8 @@ To make the node highly flexible, the SQL query and its parameters can be source
98
107
 
99
108
  For queries that return a large number of rows, streaming prevents high memory usage.
100
109
 
101
- - **`Stream Results`** `<boolean>`: Enables or disables streaming mode. When enabled, the node will output multiple messages, one for each chunk of rows. Default: false.
102
- - **`Chunk Size`** `<number>`: The number of rows to include in each output message. A value of `1` means one message will be sent for every single row. Default: 1.
110
+ - **`Stream Results`** `<boolean>`: Enables or disables streaming mode. When enabled, the node will output multiple messages. Default: false.
111
+ - **`Chunk Size`** `<number>`: When streaming, this is the number of rows to include in each data message. A value of `1` means one message will be sent for every single row. Default: 1.
103
112
 
104
113
  ##### Streaming Output Format
105
114
 
package/odbc.html CHANGED
@@ -17,12 +17,13 @@
17
17
  incrementSize: { value: 5, validate: RED.validators.number(true) },
18
18
  maxSize: { value: 15, validate: RED.validators.number(true) },
19
19
  shrink: { value: true },
20
- connectionTimeout: { value: 3, validate: RED.validators.number(true) }, // Idle timeout for connections in pool (odbc lib specific)
21
- loginTimeout: { value: 5, validate: RED.validators.number(true) }, // Login timeout for new connections
22
- queryTimeoutSeconds: { value: 0, validate: RED.validators.number(true) }, // NOUVEAU: Timeout pour les requêtes
20
+ connectionTimeout: { value: 3, validate: RED.validators.number(true) },
21
+ loginTimeout: { value: 5, validate: RED.validators.number(true) },
22
+ queryTimeoutSeconds: { value: 0, validate: RED.validators.number(true) },
23
23
  retryFreshConnection: { value: false },
24
24
  retryDelay: { value: 5, validate: RED.validators.number(true) },
25
25
  retryOnMsg: { value: true },
26
+ fireAndForgetOnClose: { value: false }, // NOUVELLE OPTION
26
27
  syntaxtick: { value: false },
27
28
  syntax: { value: "mysql" },
28
29
  },
@@ -32,6 +33,11 @@
32
33
  oneditprepare: function () {
33
34
  var node = this;
34
35
 
36
+ // Initialiser tous les accordéons comme repliés par défaut
37
+ $('.form-section-content').hide();
38
+ $('.form-section-header').removeClass('expanded');
39
+
40
+
35
41
  $('.form-section-header').on('click', function() {
36
42
  $(this).toggleClass('expanded');
37
43
  $(this).next('.form-section-content').slideToggle();
@@ -80,9 +86,8 @@
80
86
  RED.notify("Le champ 'Server' est requis pour le test.", {type: "warning", timeout: 3000});
81
87
  return;
82
88
  }
83
- if ($("#node-config-input-password").val() === "" && $("#node-config-input-user").val().trim() !== "") {
84
- RED.notify("Note: Pour tester une connexion structurée avec mot de passe, veuillez le (re)saisir.", {type: "info", timeout: 4500});
85
- // On ne bloque pas, l'utilisateur peut vouloir tester une connexion sans mot de passe si le user est optionnel
89
+ if ($("#node-config-input-user").val().trim() !== "" && $("#node-config-input-password").val() === "") {
90
+ RED.notify("Test avec utilisateur et mot de passe vide. Si un mot de passe est habituellement requis, veuillez le (re)saisir.", {type: "info", timeout: 4500});
86
91
  }
87
92
  } else { // Mode 'string'
88
93
  var connStr = $("#node-config-input-connectionString").val().trim();
@@ -140,9 +145,10 @@
140
145
 
141
146
  <style>
142
147
  .form-section-header { cursor: pointer; padding: 5px; border-bottom: 1px solid #ddd; margin-bottom: 10px; user-select: none; }
143
- .form-section-header i.fa-caret-right { transition: transform 0.2s ease-in-out; }
148
+ .form-section-header i.fa-caret-right { transition: transform 0.2s ease-in-out; margin-right: 5px; }
144
149
  .form-section-header.expanded i.fa-caret-right { transform: rotate(90deg); }
145
- .form-section-content { padding-left: 20px; }
150
+ .form-section-content { padding-left: 20px; /* Sera géré par slideToggle, display:none initialement */ }
151
+ .form-tips { font-size: smaller; color: #777; display: block; margin-top: 2px; }
146
152
  </style>
147
153
 
148
154
  <script type="text/html" data-template-name="odbc config">
@@ -206,7 +212,7 @@
206
212
  <hr/>
207
213
 
208
214
  <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-sitemap"></i> Pool & Connection Options</h4></div>
209
- <div class="form-section-content" style="display: none;">
215
+ <div class="form-section-content">
210
216
  <div class="form-row">
211
217
  <label for="node-config-input-initialSize"><i class="fa fa-play"></i> Initial Pool Size</label>
212
218
  <input type="number" id="node-config-input-initialSize" placeholder="5" />
@@ -222,19 +228,19 @@
222
228
  <div class="form-row">
223
229
  <label for="node-config-input-shrink"><i class="fa fa-compress"></i> Shrink Pool</label>
224
230
  <input type="checkbox" id="node-config-input-shrink" style="margin-left:0px; vertical-align:top; width:auto !important;" />
225
- <span class="form-tips" style="font-size: smaller;">Reduce pool to initial size when connections are returned.</span>
231
+ <span class="form-tips">Reduce pool to initial size when connections are returned.</span>
226
232
  </div>
227
233
  <div class="form-row">
228
234
  <label for="node-config-input-connectionTimeout"><i class="fa fa-clock-o"></i> Idle Timeout</label>
229
235
  <input type="number" id="node-config-input-connectionTimeout" placeholder="3" style="width: 80px;"/>
230
236
  <span style="margin-left: 5px;">seconds</span>
231
- <span class="form-tips" style="font-size: smaller;">For connections in pool.</span>
237
+ <span class="form-tips">For connections in pool.</span>
232
238
  </div>
233
239
  <div class="form-row">
234
240
  <label for="node-config-input-loginTimeout"><i class="fa fa-sign-in"></i> Login Timeout</label>
235
241
  <input type="number" id="node-config-input-loginTimeout" placeholder="5" style="width: 80px;" />
236
242
  <span style="margin-left: 5px;">seconds</span>
237
- <span class="form-tips" style="font-size: smaller;">For establishing new connections.</span>
243
+ <span class="form-tips">For establishing new connections.</span>
238
244
  </div>
239
245
  <div class="form-row">
240
246
  <label for="node-config-input-queryTimeoutSeconds"><i class="fa fa-hourglass-half"></i> Query Timeout</label>
@@ -244,11 +250,11 @@
244
250
  </div>
245
251
 
246
252
  <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-exclamation-triangle"></i> Error Handling & Retry</h4></div>
247
- <div class="form-section-content" style="display: none;">
253
+ <div class="form-section-content">
248
254
  <div class="form-row">
249
255
  <label for="node-config-input-retryFreshConnection" style="width: auto;"><i class="fa fa-refresh"></i> Retry with fresh connection</label>
250
256
  <input type="checkbox" id="node-config-input-retryFreshConnection" style="display: inline-block; width: auto; vertical-align: top;" />
251
- <span class="form-tips" style="font-size: smaller;">If a pooled connection fails, try once with a new one.</span>
257
+ <span class="form-tips">If a pooled connection fails, try once with a new one.</span>
252
258
  </div>
253
259
  <div class="retry-options" style="padding-left: 20px;">
254
260
  <div class="form-row">
@@ -259,13 +265,27 @@
259
265
  <div class="form-row">
260
266
  <label for="node-config-input-retryOnMsg" style="width: auto;"><i class="fa fa-envelope-o"></i> Retry on new message</label>
261
267
  <input type="checkbox" id="node-config-input-retryOnMsg" style="display: inline-block; width: auto; vertical-align: top;" />
262
- <span class="form-tips" style="font-size: smaller;">If waiting, a new message triggers immediate retry.</span>
268
+ <span class="form-tips">If waiting, a new message triggers immediate retry.</span>
263
269
  </div>
264
270
  </div>
265
271
  </div>
266
272
 
273
+ <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-power-off"></i> Shutdown Options</h4></div>
274
+ <div class="form-section-content">
275
+ <div class="form-row">
276
+ <label for="node-config-input-fireAndForgetOnClose" style="width: auto;">
277
+ <i class="fa fa-rocket"></i> Fast close (Fire-and-forget)
278
+ </label>
279
+ <input type="checkbox" id="node-config-input-fireAndForgetOnClose" style="display: inline-block; width: auto; vertical-align: top;">
280
+ <span class="form-tips">
281
+ <b>Warning:</b> If checked, Node-RED will not wait for the pool to close during deploy/shutdown.
282
+ This can prevent hangs with problematic drivers but may leave orphaned connections on the DB server. Use with caution.
283
+ </span>
284
+ </div>
285
+ </div>
286
+
267
287
  <div class="form-section-header"><h4><i class="fa fa-caret-right"></i> <i class="fa fa-wrench"></i> Advanced</h4></div>
268
- <div class="form-section-content" style="display: none;">
288
+ <div class="form-section-content">
269
289
  <div class="form-row">
270
290
  <label for="node-config-input-syntaxtick" style="width: auto;"><i class="fa fa-check-square-o"></i> Syntax Checker</label>
271
291
  <input type="checkbox" id="node-config-input-syntaxtick" style="display: inline-block; width: auto; vertical-align: top;" />
@@ -341,7 +361,7 @@ A **Test Connection** button in the configuration panel allows you to instantly
341
361
  - **`Increment Pool Size`**: The number of connections to create when the pool is exhausted. Default: 5.
342
362
  - **`Max Pool Size`**: The maximum number of connections allowed in the pool. Default: 15.
343
363
  - **`Shrink Pool`**: If checked, reduces the number of connections to `Initial Pool Size` when they are returned to the pool if the pool has grown. Default: true.
344
- - **`Idle Timeout`**: The number of seconds for a connection in the pool to remain idle before closing. Default: 3 seconds.
364
+ - **`Idle Timeout`**: The number of seconds for a connection in the pool to remain idle before closing. Default: 3 seconds. (Refers to the `connectionTimeout` property of the `odbc` library's pool options).
345
365
  - **`Login Timeout`**: The number of seconds for an attempt to establish a new connection to succeed. Default: 5 seconds.
346
366
  - **`Query Timeout`**: The number of seconds for a query to execute before timing out. A value of **0** means infinite or uses the driver/database default. Default: 0 seconds.
347
367
 
@@ -350,6 +370,13 @@ A **Test Connection** button in the configuration panel allows you to instantly
350
370
  - **`Retry Delay`**: If all immediate attempts (pooled and, if enabled, fresh connection) fail, this sets a delay in seconds before another retry is attempted for the incoming message. A value of **0** disables this timed retry mechanism.
351
371
  - **`Retry on new message`**: If the node is waiting for a timed retry (due to `Retry Delay`), a new incoming message can, if this is checked, override the timer and trigger an immediate retry of the *original* message that failed.
352
372
 
373
+ ### Shutdown Options
374
+ - **`Fast close (Fire-and-forget)`**:
375
+ - **Warning:** When checked, Node-RED will not wait for the connection pool to properly close during a deploy or shutdown.
376
+ - This option can prevent Node-RED from hanging if specific ODBC drivers have issues closing connections quickly.
377
+ - However, enabling this may result in orphaned connections on the database server, potentially consuming server resources.
378
+ - It is recommended to leave this unchecked unless you are experiencing hangs during Node-RED deploys or shutdowns related to this config node. Default: Unchecked.
379
+
353
380
  ### Advanced
354
381
  - **`syntaxChecker`**: If activated, the query string will be parsed and appended to the output message at `msg.parsedQuery`.
355
382
  - **`Syntax`**: The SQL dialect to use for the syntax checker (e.g., mysql, postgresql, etc.).
package/odbc.js CHANGED
@@ -17,6 +17,9 @@ module.exports = function (RED) {
17
17
  }
18
18
  this.closeOperationTimeout = 10000; // 10 secondes
19
19
 
20
+ // NOUVEAU: Récupérer et s'assurer que l'option fireAndForgetOnClose est un booléen
21
+ this.config.fireAndForgetOnClose = config.fireAndForgetOnClose === true;
22
+
20
23
  this._buildConnectionString = function() {
21
24
  if (this.config.connectionMode === 'structured') {
22
25
  if (!this.config.dbType || !this.config.server) {
@@ -33,8 +36,13 @@ module.exports = function (RED) {
33
36
  if(driver) parts.unshift(`DRIVER={${driver}}`);
34
37
  parts.push(`SERVER=${this.config.server}`);
35
38
  if (this.config.database) parts.push(`DATABASE=${this.config.database}`);
36
- if (this.config.user) parts.push(`UID=${this.config.user}`);
37
- if (this.credentials && this.credentials.password) parts.push(`PWD=${this.credentials.password}`);
39
+
40
+ if (this.config.user) {
41
+ parts.push(`UID=${this.config.user}`);
42
+ if (this.credentials && typeof this.credentials.password === 'string') {
43
+ parts.push(`PWD=${this.credentials.password}`);
44
+ }
45
+ }
38
46
  return parts.join(';');
39
47
  } else {
40
48
  return this.config.connectionString || "";
@@ -110,22 +118,49 @@ module.exports = function (RED) {
110
118
  }
111
119
  };
112
120
 
121
+ // MODIFIÉ pour inclure l'option fireAndForgetOnClose
113
122
  this.on("close", async (removed, done) => {
114
- this.log("Closing ODBC config node. Attempting to close pool.");
123
+ const nodeName = this.name || this.id;
124
+ this.log(`[${nodeName}] Closing ODBC config node. Pool present: ${!!this.pool}. Fire-and-forget: ${this.config.fireAndForgetOnClose}`);
125
+
115
126
  if (this.pool) {
116
- try {
117
- await Promise.race([
118
- this.pool.close(),
119
- new Promise((_, reject) => setTimeout(() => reject(new Error('Pool close timeout on node close')), this.closeOperationTimeout))
120
- ]);
121
- this.log("Connection pool closed successfully on node close.");
122
- } catch (error) {
123
- this.error(`Error or timeout closing connection pool on node close: ${error.message}`, error);
124
- } finally {
125
- this.pool = null;
127
+ const currentPool = this.pool;
128
+ this.pool = null;
129
+ this.connecting = false;
130
+
131
+ const closePromise = Promise.race([
132
+ currentPool.close(),
133
+ new Promise((_, reject) =>
134
+ setTimeout(() => reject(new Error('Pool close timeout')), this.closeOperationTimeout)
135
+ )
136
+ ]);
137
+
138
+ if (this.config.fireAndForgetOnClose) {
139
+ this.log(`[${nodeName}] Initiating fire-and-forget pool close. Calling done() immediately.`);
140
+ done();
141
+
142
+ closePromise
143
+ .then(() => {
144
+ this.log(`[${nodeName}] Background fire-and-forget pool close for ${nodeName} completed successfully.`);
145
+ })
146
+ .catch(error => {
147
+ this.error(`[${nodeName}] Background fire-and-forget pool close for ${nodeName} failed or timed out: ${error.message}`, error);
148
+ });
149
+ } else {
150
+ this.log(`[${nodeName}] Awaiting pool close operation...`);
151
+ try {
152
+ await closePromise;
153
+ this.log(`[${nodeName}] Pool close operation completed successfully for ${nodeName}.`);
154
+ } catch (error) {
155
+ this.error(`[${nodeName}] Pool close operation for ${nodeName} failed or timed out: ${error.message}`, error);
156
+ }
157
+ this.log(`[${nodeName}] Calling done() after awaiting pool close for ${nodeName}.`);
158
+ done();
126
159
  }
160
+ } else {
161
+ this.log(`[${nodeName}] No pool to close. Calling done().`);
162
+ done();
127
163
  }
128
- done();
129
164
  });
130
165
  }
131
166
  RED.nodes.registerType("odbc config", poolConfig, { credentials: { password: { type: "password" } } });
@@ -146,8 +181,12 @@ module.exports = function (RED) {
146
181
  if(driver) parts.unshift(`DRIVER={${driver}}`);
147
182
  parts.push(`SERVER=${tempConfig.server}`);
148
183
  if (tempConfig.database) parts.push(`DATABASE=${tempConfig.database}`);
149
- if (tempConfig.user) parts.push(`UID=${tempConfig.user}`);
150
- if (tempConfig.password) parts.push(`PWD=${tempConfig.password}`);
184
+ if (tempConfig.user) {
185
+ parts.push(`UID=${tempConfig.user}`);
186
+ if (typeof tempConfig.password === 'string') {
187
+ parts.push(`PWD=${tempConfig.password}`);
188
+ }
189
+ }
151
190
  return parts.join(';');
152
191
  } else {
153
192
  let connStr = tempConfig.connectionString || "";
@@ -406,9 +445,6 @@ module.exports = function (RED) {
406
445
 
407
446
  } catch (initialDbError) {
408
447
  this.warn(`Initial DB attempt failed: ${initialDbError.message}`);
409
- // Garder la requête originale pour le contexte d'erreur, même si une erreur de connexion se produit
410
- // this.currentQueryForErrorContext et this.currentParamsForErrorContext sont déjà settés par getRenderedQueryAndParams
411
-
412
448
  if (activeConnection) {
413
449
  const connStillGood = await this.testBasicConnectivity(activeConnection);
414
450
  try { await activeConnection.close(); activeConnection = null; }
@@ -451,7 +487,7 @@ module.exports = function (RED) {
451
487
  if (activeConnection) { try { await activeConnection.close(); activeConnection = null; } catch(e){this.warn("Error closing fresh conn after error: "+e.message);} }
452
488
 
453
489
  if (shouldProceedToTimedRetry) {
454
- // errorForUser a été setté par l'échec du SELECT 1 sur la connexion fraîche
490
+ // errorForUser est déjà l'erreur de test de connectivité et sera utilisé ci-dessous
455
491
  } else {
456
492
  this.status({ fill: "red", shape: "ring", text: "SQL error (on retry)" });
457
493
  return done(this.enhanceError(freshErrorOrConnectivityFail));
@@ -463,7 +499,7 @@ module.exports = function (RED) {
463
499
  }
464
500
  }
465
501
 
466
- if (activeConnection) { // Sécurité supplémentaire pour fermer une connexion si elle est restée active
502
+ if (activeConnection) {
467
503
  try { await activeConnection.close(); } catch(e) { this.warn("Final cleanup: Error closing activeConnection: " + e.message); }
468
504
  activeConnection = null;
469
505
  }
@@ -486,10 +522,9 @@ module.exports = function (RED) {
486
522
  }
487
523
  } else if (errorForUser) {
488
524
  this.status({ fill: "red", shape: "ring", text: "Error (No Timed Retry)" });
489
- return done(errorForUser); // Cas où c'est une erreur SQL identifiée, pas de retry temporisé.
525
+ return done(errorForUser);
490
526
  } else {
491
- // Ce chemin ne devrait pas être atteint si done() a été appelé dans un chemin de succès.
492
- this.log("[ODBC Node] DEBUG: Reached unexpected end of on('input') path. Calling done().");
527
+ this.log("[ODBC Node] DEBUG: Reached end of on('input') path. Calling done().");
493
528
  return done();
494
529
  }
495
530
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bkmj/node-red-contrib-odbcmj",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "A powerful Node-RED node to connect to any ODBC data source, with connection pooling, advanced retry logic, and result streaming.",
5
5
  "keywords": [
6
6
  "node-red",