Skip to content

Commit

Permalink
2.8.22: bugfix, ORDER BY multiple fields (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Mar 29, 2024
1 parent d5e6bf5 commit 61de538
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
18 changes: 9 additions & 9 deletions packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/transpiler-cli",
"version": "2.8.21",
"version": "2.8.22",
"description": "Transpiler - Command Line Interface",
"funding": "https://github.com/sponsors/larshp",
"bin": {
Expand All @@ -26,7 +26,7 @@
"author": "abaplint",
"license": "MIT",
"devDependencies": {
"@abaplint/transpiler": "^2.8.21",
"@abaplint/transpiler": "^2.8.22",
"@types/glob": "^8.1.0",
"glob": "=7.2.0",
"@types/progress": "^2.0.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/runtime/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/runtime",
"version": "2.8.21",
"version": "2.8.22",
"description": "Transpiler - Runtime",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/transpiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/transpiler/package.json
@@ -1,6 +1,6 @@
{
"name": "@abaplint/transpiler",
"version": "2.8.21",
"version": "2.8.22",
"description": "Transpiler",
"main": "build/src/index.js",
"typings": "build/src/index.d.ts",
Expand Down
12 changes: 8 additions & 4 deletions packages/transpiler/src/expressions/sql_order_by.ts
Expand Up @@ -8,15 +8,19 @@ import {SQLFieldNameTranspiler} from "./sql_field_name";
export class SQLOrderByTranspiler implements IExpressionTranspiler {

public transpile(node: Nodes.ExpressionNode, traversal: Traversal): Chunk {
const ret = new Chunk();
let text = "";
for (const c of node.getChildren()) {
if (c instanceof abaplint.Nodes.ExpressionNode && c.get() instanceof abaplint.Expressions.SQLFieldName) {
ret.appendString(new SQLFieldNameTranspiler().transpile(c, traversal).getCode() + " ");
if (text !== "" && text.endsWith(`" `)) {
text += ", ";
}
text += new SQLFieldNameTranspiler().transpile(c, traversal).getCode().toLowerCase() + " ";
} else {
ret.appendString(c.concatTokens() + " ");
text += c.concatTokens() + " ";
}
}
return ret;

return new Chunk().appendString(text);
}

}
14 changes: 14 additions & 0 deletions test/database.ts
Expand Up @@ -230,6 +230,20 @@ describe("Top level tests, Database", () => {
});
});

it("SELECT INTO TABLE, ORDER BY two fields", async () => {
const code = `
DATA tab TYPE STANDARD TABLE OF t100 WITH DEFAULT KEY.
SELECT * FROM t100 INTO TABLE tab ORDER BY ARBGB MSGNR.
WRITE sy-dbcnt.`;
const files = [
{filename: "zfoobar.prog.abap", contents: code},
{filename: "t100.tabl.xml", contents: tabl_t100xml},
{filename: "zag_unit_test.msag.xml", contents: msag_zag_unit_test}];
await runAllDatabases(abap, files, () => {
expect(abap.console.get()).to.equal("2");
});
});

it("SELECT INTO TABLE, ORDER BY PRIMARY KEY, dynamic", async () => {
const code = `
DATA tab TYPE STANDARD TABLE OF t100 WITH DEFAULT KEY.
Expand Down

0 comments on commit 61de538

Please sign in to comment.