Skip to content

Commit

Permalink
Use wildcard on fixed select statement (#83)
Browse files Browse the repository at this point in the history
* Use wildcard on fixed select statement

* escape wildcard

* 2.5.22

* add npm publish script
  • Loading branch information
kbarbounakis authored Mar 25, 2024
1 parent d0cd4cd commit c2914b9
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 255 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Publish

on:
release:
types: [released]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --tag=lts
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
5 changes: 3 additions & 2 deletions formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,9 @@ SqlFormatter.prototype.formatSelect = function(obj)
escapedEntity = $this.escapeName(entity)
}
//add basic SELECT statement
if (obj["$fixed"]) {
sql = sql.concat('SELECT * FROM (', $this.formatFixedSelect(obj), ') ', escapedEntity);
if (obj.$fixed) {
var sqlFixedSelect = this.formatFixedSelect(obj);
sql = `SELECT ${escapedEntity}.${this.escapeName('*')} FROM (${sqlFixedSelect}) ${escapedEntity}`;
}
else {
sql = sql.concat(obj.$distinct ? 'SELECT DISTINCT ' : 'SELECT ', _.map(fields, function(x) {
Expand Down
Loading

0 comments on commit c2914b9

Please sign in to comment.