Skip to content
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

no proper support for escaped symbols #4

Open
zhgzhg opened this issue Aug 21, 2014 · 5 comments
Open

no proper support for escaped symbols #4

zhgzhg opened this issue Aug 21, 2014 · 5 comments

Comments

@zhgzhg
Copy link

zhgzhg commented Aug 21, 2014

INSERT INTO ..... VALUES('TEST', 'T's Use Rate(%) (%)' , 'TT's Use Rate(%) (%)' , 'OTHER')
won't format properly.

@Shoelace
Copy link

that is not valid oracle SQL atleats.. to escape quotes in oralc ethey get doubled..

ie INSERT INTO ..... VALUES('TEST', 'T''s Use Rate(%) (%)' , 'TT''s Use Rate(%) (%)' , 'OTHER')

i dont knwo about other SQL varients

@zhgzhg
Copy link
Author

zhgzhg commented Aug 22, 2014

@dnsmkl
Copy link
Owner

dnsmkl commented Sep 23, 2014

Hi zhgzhg,

Thanks for reporting the issue.
But...

In short:
Sorry, I can not promise you a quick resolution of this issue.
(honest proposal: if this is real problem, please use something else.
Search for "free sql formatter" gives some quite good online tools)

Longer version:
mysql syntax is incompatible with other sql syntaxes.
(i.e. if mysql case is naively fixed, then other flavors of sql syntax get broken)
Effective fix would include some mode switching to handle only single syntax at one time
("option: use mysql syntax", "option: use postgre syntax", "option: use oracle syntax")
But this is problematic because,
it requires quite significant changes to "architecture" of fsqlf (flex regex for string is hardcoded).

That said. I will definitely try to fix this. (but first I have to come up with good plan how to go about it. Proposals are welcome)

@rohitn
Copy link
Contributor

rohitn commented Sep 23, 2014

Hi @dnsmkl,

For open source databases, perhaps the best solution is to use their own parser. See this interesting post

Not suggesting that fsqlf go down this path. I don't think it is worth the effort. When I have run into similar issues with SQL Server syntax oddities I modify the query so fsqlf can format it and then undo the modifications.

Unrelated news. I have command line fsqlf building and running on OSX. There are some odd differences in the output compared to Ubuntu. Will submit a PR after I track those down.

@dnsmkl
Copy link
Owner

dnsmkl commented Oct 3, 2014

Hi @rohitn,

thanks for the link and idea.
You are completely right, best solution would be to use parser of actual database.
(or at least parser that is recognized as very good for that db syntax)
..but I don't have that much energy&time that this would require.

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

No branches or pull requests

4 participants