Skip to content

white space inserted for language db2 #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
huineng opened this issue Feb 21, 2021 · 4 comments
Closed

white space inserted for language db2 #123

huineng opened this issue Feb 21, 2021 · 4 comments
Labels
Milestone

Comments

@huineng
Copy link

huineng commented Feb 21, 2021

i have specified language db2 and have a select that needs to replace some hex characters

replace(AL3.NAME1, x'00', x'20') AS CUSTNAME

but get's replace by

replace(AL3.NAME1, x '00', x '20') AS CUSTNAME

This gives an sql error

com.ibm.db2.jcc.am.SqlSyntaxErrorException: ILLEGAL SYMBOL "'00'". 
SOME SYMBOLS THAT MIGHT BE LEGAL ARE: AS * AT OPTION YEAR YEARS 
MONTH MONTHS DAY DAYS HOUR HOURS. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.28.11

Let me know how this problem can be solved.. maybe can be added to a list of exceptions

some doc on hex

@huineng
Copy link
Author

huineng commented Mar 8, 2021

I have mad a pull request after testing it out on my code #127

inferrinizzard referenced this issue in inferrinizzard/prettier-sql Nov 25, 2021
* fix zeroturnaround#152,
Add + in scientific notation regex

* fix zeroturnaround#159, Add token override for SET datatype

* add common operators to Tokenizer, dedupe

* update missing operators

* use exhaustive list of monad operators

* fix .. operator for PlSQL

* fix handling for braces (zeroturnaround sql-formatter-org#155), add test for braces & backticks

* move all operator handling into formatOperator

* fix handling of backticks (zeroturnaround#139)

* update isToken

* fix zeroturnaround#123, add hex string type

* fix zeroturnaround#166, add negative lookahead for specialWordChar for reserved words

* fix zeroturnaround#162, add handling for prefix/suffix only specialWordChars

* Fix zeroturnaround#137, add @@ system variables

* add support for array and map accessors

* print help when no arguments passed

* convert cli tool to cladd

* rename bin file

* add ts export for module

* update cjs build with typescript

* add ts-loader for umd build

* update badges and GH Actions names

* Update issue templates

* add enhancement template

* add feature request title

* update package.json

* move index.html to static dir

* make parenOptions Partial type

* split into css and js files

* ♻️

* remove local script

* move options to left menu

* add new options to demo

* add icon

* add comments for token overrides

* fix prefixed operators

* add link to bug reports

* update TokenizerOptions.specialWordChars.any to Optional Type

* update CHANGELOG

* update README badges

* update README with vscode

* add CONTRIBUTING.md

* fix formatting for reservedDependentClauses

* update release-it json
@inferrinizzard
Copy link
Collaborator

Hi, this issue is fixed in my fork here:
https://github.com/inferrinizzard/prettier-sql
https://www.npmjs.com/package/prettier-sql

inferrinizzard referenced this issue in inferrinizzard/prettier-sql Dec 4, 2021
* fix zeroturnaround#152,
Add + in scientific notation regex

* fix zeroturnaround#159, Add token override for SET datatype

* add common operators to Tokenizer, dedupe

* update missing operators

* use exhaustive list of monad operators

* fix .. operator for PlSQL

* fix handling for braces (zeroturnaround sql-formatter-org#155), add test for braces & backticks

* move all operator handling into formatOperator

* fix handling of backticks (zeroturnaround#139)

* update isToken

* fix zeroturnaround#123, add hex string type

* fix zeroturnaround#166, add negative lookahead for specialWordChar for reserved words

* fix zeroturnaround#162, add handling for prefix/suffix only specialWordChars

* Fix zeroturnaround#137, add @@ system variables

* add support for array and map accessors

* print help when no arguments passed

* convert cli tool to cladd

* rename bin file

* add ts export for module

* update cjs build with typescript

* add ts-loader for umd build

* update badges and GH Actions names

* Update issue templates

* add enhancement template

* add feature request title

* update package.json

* move index.html to static dir

* make parenOptions Partial type

* split into css and js files

* ♻️

* remove local script

* move options to left menu

* add new options to demo

* add icon

* add comments for token overrides

* fix prefixed operators

* add link to bug reports

* update TokenizerOptions.specialWordChars.any to Optional Type

* update CHANGELOG

* update README badges

* update README with vscode

* add CONTRIBUTING.md

* fix formatting for reservedDependentClauses

* update release-it json
@nene
Copy link
Collaborator

nene commented May 3, 2022

Not correct. This problem still exists in prettier-sql. There was a code change to fix it, but it was effectively a no-op.

@nene nene closed this as completed in 6624acf May 3, 2022
@nene nene reopened this May 4, 2022
@nene nene added this to the Version 6 milestone May 4, 2022
nene added a commit that referenced this issue May 4, 2022
@nene
Copy link
Collaborator

nene commented May 4, 2022

Now fixed for both lowecase and uppercase X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants