@abaplint/transpiler-cli 2.11.82 → 2.11.83

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 (2) hide show
  1. package/build/bundle.js +22 -0
  2. package/package.json +2 -2
package/build/bundle.js CHANGED
@@ -89661,6 +89661,28 @@ class UpdateDatabaseTranspiler {
89661
89661
  }
89662
89662
  options.push(`"set": [${s.join(",")}]`);
89663
89663
  }
89664
+ const sqlSource = node.findDirectExpression(abaplint.Expressions.SQLSource)?.concatTokens()?.toLowerCase().replace("@", "");
89665
+ if (sqlSource) {
89666
+ const tableName = node.findDirectExpression(abaplint.Expressions.DatabaseTable)?.concatTokens();
89667
+ const tabl = traversal.findTable(tableName);
89668
+ const keys = tabl.listKeys(traversal.reg).map(k => k.toLowerCase());
89669
+ const allFields = tabl.parseType(traversal.reg).getComponents().map(c => {
89670
+ return c.name.toLowerCase();
89671
+ });
89672
+ const where = [];
89673
+ const set = [];
89674
+ for (const fieldName of allFields) {
89675
+ const cond = `\\"${fieldName}\\" = '\" + ${sqlSource}.get().${fieldName}.get() + \"'`;
89676
+ if (keys.includes(fieldName) === true) {
89677
+ where.push(cond);
89678
+ }
89679
+ else {
89680
+ set.push("\"" + cond + "\"");
89681
+ }
89682
+ }
89683
+ options.push(`"where": "` + where.join(" AND ") + `"`);
89684
+ options.push(`"set": [${set.join(",")}]`);
89685
+ }
89664
89686
  return new chunk_1.Chunk(`await abap.statements.updateDatabase(${table.getCode()}, {${options.join(", ")}});`);
89665
89687
  }
89666
89688
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/transpiler-cli",
3
- "version": "2.11.82",
3
+ "version": "2.11.83",
4
4
  "description": "Transpiler - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -28,7 +28,7 @@
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
30
  "@abaplint/core": "^2.113.200",
31
- "@abaplint/transpiler": "^2.11.82",
31
+ "@abaplint/transpiler": "^2.11.83",
32
32
  "@types/glob": "^8.1.0",
33
33
  "@types/node": "^24.3.1",
34
34
  "@types/progress": "^2.0.7",