Giter VIP home page Giter VIP logo

Comments (5)

Shoelace avatar Shoelace commented on September 14, 2024

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

from fsqlf.

zhgzhg avatar zhgzhg commented on September 14, 2024

Example: Table 9.1
http://dev.mysql.com/doc/refman/5.0/en/string-literals.html

from fsqlf.

dnsmkl avatar dnsmkl commented on September 14, 2024

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)

from fsqlf.

rohitn avatar rohitn commented on September 14, 2024

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.

from fsqlf.

dnsmkl avatar dnsmkl commented on September 14, 2024

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.

from fsqlf.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.