iobroker.sql 2.1.3 → 2.1.5
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/README.md +4 -0
- package/io-package.json +13 -13
- package/lib/aggregate.js +6 -1
- package/main.js +26 -7
- package/package.json +1 -1
- package/admin/.gitignore +0 -0
package/README.md
CHANGED
|
@@ -520,6 +520,10 @@ sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
|
|
|
520
520
|
-->
|
|
521
521
|
|
|
522
522
|
## Changelog
|
|
523
|
+
### 2.1.5 (2022-06-27)
|
|
524
|
+
* (Apollon77) When no count is provided for aggregate "none" or "onchange" then the limit (default 2000) is used as count to define the number of data to return.
|
|
525
|
+
* (Apollon77) Fix the initialization of types and IDs for some cases.
|
|
526
|
+
|
|
523
527
|
### 2.1.3 (2022-06-12)
|
|
524
528
|
* (Apollon77) Make sure debug log is active according to the settings
|
|
525
529
|
|
package/io-package.json
CHANGED
|
@@ -26,8 +26,20 @@
|
|
|
26
26
|
"pl": "Rejestrowanie stanów w SQL DB",
|
|
27
27
|
"zh-cn": "将状态记录到SQL DB"
|
|
28
28
|
},
|
|
29
|
-
"version": "2.1.
|
|
29
|
+
"version": "2.1.5",
|
|
30
30
|
"news": {
|
|
31
|
+
"2.1.5": {
|
|
32
|
+
"en": "When no count is provided for aggregate \"none\" or \"onchange\" then the limit (default 2000) is used as count to define the number of data to return.\nFix the initialization of types and IDs for some cases.",
|
|
33
|
+
"de": "Wenn keine Zählung für die Aggregate keine oder Änderung vorgesehen ist, wird die Grenze (Standard 2000) als Zählung verwendet, um die Anzahl der Daten zu definieren, um zurückzukehren.\nBeheben Sie die Initialisierung von Typen und IDs für einige Fälle.",
|
|
34
|
+
"ru": "Когда никакое число не предусмотрено для агрегировать никакое или онмен после этого предел (по умолчанию 2000) использован как считать для того чтобы определить количество данных для возвращения.\nИсправьте инициализацию типов и идентификаторов для некоторых случаев.",
|
|
35
|
+
"pt": "Quando nenhuma contagem é fornecida para agregar nenhum ou onchange, então o limite (padrão 2000) é usado como contagem para definir o número de dados para retornar.\nCorrigir a inicialização de tipos e IDs para alguns casos.",
|
|
36
|
+
"nl": "Als er geen tel is voor aggregate noch onchange dan wordt de limiet (default 2000) gebruikt om het aantal data te definiëren om terug te keren.\nMaak de initialisatie van types en ID's voor sommige gevallen.",
|
|
37
|
+
"fr": "Si aucun compte n'est fourni pour l'agrégat aucun ou le changement, la limite (par défaut 2000) est utilisée comme compte pour définir le nombre de données à retourner.\nFixer l'initialisation des types et des ID pour certains cas.",
|
|
38
|
+
"it": "Quando non è previsto alcun conteggio per aggregato nessuno o per il cambiamento, il limite (default 2000) viene utilizzato come conteggio per definire il numero di dati da restituire.\nFissare l'inizializzazione di tipi e ID per alcuni casi.",
|
|
39
|
+
"es": "Cuando no se proporciona ningún recuento para agregado ninguno o cambio entonces el límite (por defecto 2000) se utiliza como recuento para definir el número de datos para regresar.\nArreglar la inicialización de tipos e identificaciones para algunos casos.",
|
|
40
|
+
"pl": "Jeśli nie jest liczona dla agregacji ani zmian, to limit (default 2000) jest używany jako określenie liczby danych do powrotu.\nW niektórych przypadkach inicjacja typów i ID.",
|
|
41
|
+
"zh-cn": "当时没有对总数据或换算进行计算(2000年12月)用于确定返回的数据数量。.\n确定某些案例的类型和研发。."
|
|
42
|
+
},
|
|
31
43
|
"2.1.3": {
|
|
32
44
|
"en": "Make sure debug log is active according to the settings",
|
|
33
45
|
"de": "Stellen Sie sicher, dass das Debug-Log gemäß den Einstellungen aktiv ist",
|
|
@@ -99,18 +111,6 @@
|
|
|
99
111
|
"es": "Datos interpolados marcados con `i=true`",
|
|
100
112
|
"pl": "Oznaczono dane interpolowane za pomocą `i=true`",
|
|
101
113
|
"zh-cn": "用 `i=true` 标记插值数据"
|
|
102
|
-
},
|
|
103
|
-
"1.16.1": {
|
|
104
|
-
"en": "Hide settings not relevant when \"log changes only\" is not used\nAllow all number values for debounce again",
|
|
105
|
-
"de": "Nicht relevante Einstellungen ausblenden, wenn \"Nur Änderungen protokollieren\" nicht verwendet wird\nAlle Zahlenwerte wieder für die Entprellung zulassen",
|
|
106
|
-
"ru": "Скрыть настройки, не актуальные, если не используется \"только изменения журнала\"\nРазрешить все числовые значения для устранения дребезга снова",
|
|
107
|
-
"pt": "Ocultar configurações irrelevantes quando \"apenas registro de alterações\" não é usado\nPermitir todos os valores numéricos para debounce novamente",
|
|
108
|
-
"nl": "Instellingen verbergen die niet relevant zijn wanneer \"alleen logboekwijzigingen\" niet wordt gebruikt\nSta alle getalwaarden opnieuw toe voor debounce",
|
|
109
|
-
"fr": "Masquer les paramètres non pertinents lorsque \"log changes only\" n'est pas utilisé\nAutoriser à nouveau toutes les valeurs numériques pour l'anti-rebond",
|
|
110
|
-
"it": "Nascondi le impostazioni non rilevanti quando \"solo modifiche al registro\" non viene utilizzato\nConsenti di nuovo l'antirimbalzo di tutti i valori numerici",
|
|
111
|
-
"es": "Ocultar la configuración que no es relevante cuando no se utiliza \"solo cambios de registro\"\nPermitir todos los valores numéricos para antirrebote nuevamente",
|
|
112
|
-
"pl": "Ukryj ustawienia nieistotne, gdy nie używasz opcji „tylko rejestruj zmiany”\nZezwól ponownie na odrzucenie wszystkich wartości liczbowych",
|
|
113
|
-
"zh-cn": "不使用“仅记录更改”时隐藏不相关的设置\n再次允许所有数值去抖动"
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
"mode": "daemon",
|
package/lib/aggregate.js
CHANGED
|
@@ -48,7 +48,12 @@ function initAggregate(options) {
|
|
|
48
48
|
|
|
49
49
|
log(`${options.logId} Initialize: maxIndex = ${options.maxIndex}, step = ${options.step}, start = ${options.start}, end = ${options.end}`);
|
|
50
50
|
// pre-fill the result with timestamps (add one before start and one after end)
|
|
51
|
-
|
|
51
|
+
try {
|
|
52
|
+
options.result.length = options.maxIndex + 2;
|
|
53
|
+
} catch (err) {
|
|
54
|
+
err.message += `: ${options.maxIndex + 2}`;
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
52
57
|
// We define the array length but do not prefill values, we do that on runtime when needed
|
|
53
58
|
options.result[0] = {
|
|
54
59
|
val: {ts: null, val: null},
|
package/main.js
CHANGED
|
@@ -1557,7 +1557,7 @@ function processReadTypes() {
|
|
|
1557
1557
|
|
|
1558
1558
|
if (!sqlDPs[task.id]) {
|
|
1559
1559
|
adapter.log.warn(`Ignore type lookup for ${task.id} because not enabled anymore`);
|
|
1560
|
-
task.cb && task.cb(`Ignore type lookup for ${task.id} because not enabled anymore`)
|
|
1560
|
+
task.cb && task.cb(`Ignore type lookup for ${task.id} because not enabled anymore`);
|
|
1561
1561
|
task.cb = null;
|
|
1562
1562
|
return setImmediate(() => {
|
|
1563
1563
|
tasksReadType.shift();
|
|
@@ -1634,6 +1634,7 @@ function processReadTypes() {
|
|
|
1634
1634
|
task.cb && task.cb();
|
|
1635
1635
|
task.cb = null;
|
|
1636
1636
|
tasksReadType.shift();
|
|
1637
|
+
processReadTypes();
|
|
1637
1638
|
}
|
|
1638
1639
|
});
|
|
1639
1640
|
}
|
|
@@ -1859,7 +1860,7 @@ function storeCached(onlyId, cb) {
|
|
|
1859
1860
|
sqlDPs[id].list = [];
|
|
1860
1861
|
count++;
|
|
1861
1862
|
pushValuesIntoDB(id, sqlDPs[id].inFlight[inFlightId], err => {
|
|
1862
|
-
delete sqlDPs[id].inFlight[inFlightId];
|
|
1863
|
+
sqlDPs[id].inFlight && sqlDPs[id].inFlight[inFlightId] && delete sqlDPs[id].inFlight[inFlightId];
|
|
1863
1864
|
if (!--count && cb) {
|
|
1864
1865
|
cb(err);
|
|
1865
1866
|
cb = null;
|
|
@@ -2327,7 +2328,7 @@ function getHistory(msg) {
|
|
|
2327
2328
|
start: msg.message.options.start,
|
|
2328
2329
|
end: msg.message.options.end || (Date.now() + 5000000),
|
|
2329
2330
|
step: parseInt(msg.message.options.step, 10) || null,
|
|
2330
|
-
count: parseInt(msg.message.options.count, 10)
|
|
2331
|
+
count: parseInt(msg.message.options.count, 10),
|
|
2331
2332
|
ignoreNull: msg.message.options.ignoreNull,
|
|
2332
2333
|
aggregate: msg.message.options.aggregate || 'average', // One of: max, min, average, total, none, on-change
|
|
2333
2334
|
limit: parseInt(msg.message.options.limit, 10) || parseInt(msg.message.options.count, 10) || adapter.config.limit || 2000,
|
|
@@ -2346,6 +2347,16 @@ function getHistory(msg) {
|
|
|
2346
2347
|
logId: (msg.message.id ? msg.message.id : 'all') + Date.now() + Math.random()
|
|
2347
2348
|
};
|
|
2348
2349
|
|
|
2350
|
+
adapter.log.debug(`${options.logId} getHistory message: ${JSON.stringify(msg.message)}`);
|
|
2351
|
+
|
|
2352
|
+
if (!options.count || isNaN(options.count)) {
|
|
2353
|
+
if (options.aggregate === 'none' || options.aggregate === 'onchange') {
|
|
2354
|
+
options.count = options.limit;
|
|
2355
|
+
} else {
|
|
2356
|
+
options.count = 500;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2349
2360
|
try {
|
|
2350
2361
|
if (options.start && typeof options.start !== 'number') {
|
|
2351
2362
|
options.start = new Date(options.start).getTime();
|
|
@@ -2381,8 +2392,6 @@ function getHistory(msg) {
|
|
|
2381
2392
|
options.round = adapter.config.round;
|
|
2382
2393
|
}
|
|
2383
2394
|
|
|
2384
|
-
adapter.log.debug(`${options.logId} getHistory call: ${JSON.stringify(options)}`);
|
|
2385
|
-
|
|
2386
2395
|
if (options.id && aliasMap[options.id]) {
|
|
2387
2396
|
options.id = aliasMap[options.id];
|
|
2388
2397
|
}
|
|
@@ -2422,6 +2431,8 @@ function getHistory(msg) {
|
|
|
2422
2431
|
options.start = Date.now() - 86400000; // - 1 day
|
|
2423
2432
|
}
|
|
2424
2433
|
|
|
2434
|
+
debugLog && adapter.log.debug(`${options.logId} getHistory options final: ${JSON.stringify(options)}`);
|
|
2435
|
+
|
|
2425
2436
|
if (sqlDPs[options.id].type === undefined && sqlDPs[options.id].dbtype !== undefined) {
|
|
2426
2437
|
if (sqlDPs[options.id][adapter.namespace] && sqlDPs[options.id][adapter.namespace].storageType) {
|
|
2427
2438
|
if (storageTypes.indexOf(sqlDPs[options.id][adapter.namespace].storageType) === sqlDPs[options.id].dbtype) {
|
|
@@ -2513,7 +2524,11 @@ function getHistory(msg) {
|
|
|
2513
2524
|
|
|
2514
2525
|
data.sort(sortByTs);
|
|
2515
2526
|
}
|
|
2516
|
-
|
|
2527
|
+
try {
|
|
2528
|
+
commons.sendResponse(adapter, msg, options, (err ? err.toString() : null) || data, startTime)
|
|
2529
|
+
} catch (e) {
|
|
2530
|
+
commons.sendResponse(adapter, msg, options, e.toString(), startTime);
|
|
2531
|
+
}
|
|
2517
2532
|
});
|
|
2518
2533
|
}
|
|
2519
2534
|
});
|
|
@@ -2537,7 +2552,11 @@ function getHistory(msg) {
|
|
|
2537
2552
|
}
|
|
2538
2553
|
if (!--count) {
|
|
2539
2554
|
rows.sort(sortByTs);
|
|
2540
|
-
|
|
2555
|
+
try {
|
|
2556
|
+
commons.sendResponse(adapter, msg, options, rows, startTime);
|
|
2557
|
+
} catch (e) {
|
|
2558
|
+
commons.sendResponse(adapter, msg, options, e.toString(), startTime);
|
|
2559
|
+
}
|
|
2541
2560
|
}
|
|
2542
2561
|
});
|
|
2543
2562
|
}
|
package/package.json
CHANGED
package/admin/.gitignore
DELETED
|
File without changes
|