@balena/abstract-sql-compiler 7.20.4 → 7.20.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.
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
- commits:
|
|
2
|
+
- subject: Fix Right SQL generation
|
|
3
|
+
hash: 8b6715c84ac7dab4c4248d19afa4b578c0d6c0ec
|
|
4
|
+
body: ""
|
|
5
|
+
footer:
|
|
6
|
+
Change-type: patch
|
|
7
|
+
change-type: patch
|
|
8
|
+
Signed-off-by: Josh Bowling <josh@monarci.com>
|
|
9
|
+
signed-off-by: Josh Bowling <josh@monarci.com>
|
|
10
|
+
author: Josh Bowling
|
|
11
|
+
nested: []
|
|
12
|
+
version: 7.20.5
|
|
13
|
+
title: ""
|
|
14
|
+
date: 2022-11-16T07:19:37.766Z
|
|
1
15
|
- commits:
|
|
2
16
|
- subject: "CI: Add several abstract-sql unit tests"
|
|
3
17
|
hash: e0319dd38e6851c5ed3f2b503ecf2ff93d67f0dd
|
|
@@ -11,7 +25,7 @@
|
|
|
11
25
|
nested: []
|
|
12
26
|
version: 7.20.4
|
|
13
27
|
title: ""
|
|
14
|
-
date: 2022-11-16T03:
|
|
28
|
+
date: 2022-11-16T03:27:59.106Z
|
|
15
29
|
- commits:
|
|
16
30
|
- subject: Capitalize AggregateJSON SQL
|
|
17
31
|
hash: 73ac2303a5912408c76d21c861891bf3b506a788
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 7.20.5 - 2022-11-16
|
|
8
|
+
|
|
9
|
+
* Fix Right SQL generation [Josh Bowling]
|
|
10
|
+
|
|
7
11
|
## 7.20.4 - 2022-11-16
|
|
8
12
|
|
|
9
13
|
* CI: Add several abstract-sql unit tests [Josh Bowling]
|
|
@@ -817,7 +817,7 @@ const typeRules = {
|
|
|
817
817
|
Right: (args, indent) => {
|
|
818
818
|
(0, exports.checkArgs)('Right', args, 2);
|
|
819
819
|
const str = TextValue((0, exports.getAbstractSqlQuery)(args, 0), indent);
|
|
820
|
-
const n = NumericValue((0, exports.getAbstractSqlQuery)(args,
|
|
820
|
+
const n = NumericValue((0, exports.getAbstractSqlQuery)(args, 1), indent);
|
|
821
821
|
if (engine === "websql") {
|
|
822
822
|
return `SUBSTRING(${str}, -${n})`;
|
|
823
823
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balena/abstract-sql-compiler",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.5",
|
|
4
4
|
"description": "A translator for abstract sql into sql.",
|
|
5
5
|
"main": "out/AbstractSQLCompiler.js",
|
|
6
6
|
"types": "out/AbstractSQLCompiler.d.ts",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"versionist": {
|
|
66
|
-
"publishedAt": "2022-11-
|
|
66
|
+
"publishedAt": "2022-11-16T07:19:38.305Z"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -924,7 +924,7 @@ const typeRules: Dictionary<MatchFn> = {
|
|
|
924
924
|
Right: (args, indent) => {
|
|
925
925
|
checkArgs('Right', args, 2);
|
|
926
926
|
const str = TextValue(getAbstractSqlQuery(args, 0), indent);
|
|
927
|
-
const n = NumericValue(getAbstractSqlQuery(args,
|
|
927
|
+
const n = NumericValue(getAbstractSqlQuery(args, 1), indent);
|
|
928
928
|
if (engine === Engines.websql) {
|
|
929
929
|
return `SUBSTRING(${str}, -${n})`;
|
|
930
930
|
} else {
|
|
@@ -361,3 +361,17 @@ describe('Substring', () => {
|
|
|
361
361
|
},
|
|
362
362
|
);
|
|
363
363
|
});
|
|
364
|
+
|
|
365
|
+
describe('Right', () => {
|
|
366
|
+
test(
|
|
367
|
+
[
|
|
368
|
+
'SelectQuery',
|
|
369
|
+
['Select', [['Right', ['EmbeddedText', 'foobar'], ['Number', 1]]]],
|
|
370
|
+
],
|
|
371
|
+
(result, sqlEquals) => {
|
|
372
|
+
it('should produce a valid right statement', () => {
|
|
373
|
+
sqlEquals(result.query, `SELECT RIGHT('foobar', 1)`);
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
);
|
|
377
|
+
});
|