@areumtecnologia/mysql-db-handler 2.1.1 → 2.1.2
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/lib/databaseHandler.js +12 -3
- package/package.json +1 -1
package/lib/databaseHandler.js
CHANGED
|
@@ -35,6 +35,15 @@ function safeColumn(columnName) {
|
|
|
35
35
|
return trimmed.split('.').map(part => part === '*' ? '*' : `\`${sanitizeIdentifier(part)}\``).join('.');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Acrescenta itens de um array sem usar spread (...), evitando RangeError em listas grandes.
|
|
40
|
+
*/
|
|
41
|
+
function appendItems(target, items) {
|
|
42
|
+
for (let i = 0; i < items.length; i++) {
|
|
43
|
+
target.push(items[i]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
/**
|
|
39
48
|
* Sanitiza listas de colunas para GROUP BY ou ORDER BY (suportando direção ASC/DESC em ORDER BY).
|
|
40
49
|
*/
|
|
@@ -857,7 +866,7 @@ class DatabaseHandler {
|
|
|
857
866
|
} else {
|
|
858
867
|
const placeholders = value.map(() => '?').join(', ');
|
|
859
868
|
conditions.push(`${colSql} ${op} (${placeholders})`);
|
|
860
|
-
bindings
|
|
869
|
+
appendItems(bindings, value);
|
|
861
870
|
}
|
|
862
871
|
continue;
|
|
863
872
|
}
|
|
@@ -883,7 +892,7 @@ class DatabaseHandler {
|
|
|
883
892
|
} else {
|
|
884
893
|
const placeholders = value.map(() => '?').join(', ');
|
|
885
894
|
conditions.push(`${colSql} IN (${placeholders})`);
|
|
886
|
-
bindings
|
|
895
|
+
appendItems(bindings, value);
|
|
887
896
|
}
|
|
888
897
|
} else {
|
|
889
898
|
conditions.push(`${colSql} ${defaultOp} ?`);
|
|
@@ -1230,7 +1239,7 @@ class DatabaseHandler {
|
|
|
1230
1239
|
if (typeof clauses.HAVING === 'object' && clauses.HAVING.sql) {
|
|
1231
1240
|
havingClause = ` HAVING ${clauses.HAVING.sql}`;
|
|
1232
1241
|
if (Array.isArray(clauses.HAVING.bindings)) {
|
|
1233
|
-
values
|
|
1242
|
+
appendItems(values, clauses.HAVING.bindings);
|
|
1234
1243
|
}
|
|
1235
1244
|
} else {
|
|
1236
1245
|
havingClause = ` HAVING ${clauses.HAVING}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@areumtecnologia/mysql-db-handler",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "High-scale enterprise Micro-ORM and MySQL Data Mapper with connection pooling, read/write splitting, eager loading, keyset pagination, soft deletes, and fluent query builder for Node.js.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|