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

Colon in sql comments results in error #12

Open
mihaigiurgeanu opened this issue Mar 30, 2020 · 3 comments
Open

Colon in sql comments results in error #12

mihaigiurgeanu opened this issue Mar 30, 2020 · 3 comments

Comments

@mihaigiurgeanu
Copy link

Parsing SQL that contains comments with colons results in error. Herer it is a sample of SQL to reproduce the error:

[yesh1|
  -- name:getUser :: (String)
  -- :userID :: Int
  -- :dd     :: String
  SELECT username /*comment: see xxxx */
  FROM users
  INNER JOIN ( SELECT * FROM XXCART WHERE DD = :dd)
  WHERE id = :userID
|]
@mihaigiurgeanu mihaigiurgeanu changed the title Colon in sql commentaries results in error Colon in sql comments results in error Mar 30, 2020
@tdammers
Copy link
Owner

That's because YeshQL doesn't actually parse SQL - it can't, because that would require knowing which SQL dialect we're dealing with, and for most of them, also the current server configuration (most SQL DBMSes have configurable syntax; e.g., MySQL can be configured to accept different styles of commenting and quoting).

Hence, SQL syntax, including comment markers, are completely ignored, and YeshQL simply attempts to pick up anything that looks like its own syntax, which, by design, includes colons.

I'm not quite sure how to make this example work without making rather intrusive changes to the design, but if you have an idea, I'm all ears.

@mihaigiurgeanu
Copy link
Author

I am thinking use some kind of heuristics instead of parsing the sql, but I am not very clear how it can be done.

@tdammers
Copy link
Owner

tdammers commented Mar 31, 2020 via email

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

2 participants