-
Notifications
You must be signed in to change notification settings - Fork 147
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
When pasting queries separated by a semicolon with a new line, they are passed as a single query #237
Comments
Strange... |
@snuyanzin thanks for looking into this issue. Is it possible that different behavior for Windows is caused by the difference in line ending symbols for Windows and Linux? |
Not sure about line endings... at least not at sqlline level (may be somewhere at jline).
these lines are going to be handled as one-line on Windows as well while at 1.5.0 it fails as below I think it could make sense to have here the similar approach as at #233 where the line is constructed by appending lines from file until the result passes SqlParser.parse or eof. In case the result line passes SqlParser.parse then execute it and start to build the next line while not eof. The trace from 1.5.0 for the example above
|
Also, there is a case when two SQL queries are submitted in a single line divided by semicolon, like "select * from sys.version; select * from sys.version; " |
It might be difficult to split lines on semicolons. It requires knowledge of the underlying DB's scheme for comments, quoting string literals, quoting identifiers. Or maybe we have those already, @snuyanzin? |
I guess that before upgrade to jline3 such simple queries
were processed as 2 queries because sqlline just parsed till the first semicolon (a bit tricky queries failed e.g. mentioned at #129). We have knowledge about comments, quoting string literals, quoting identifiers at least from Dialect functionality. |
I was able to find solution and submitted a PR. |
@snuyanzin, thanks for the fix, I have checked and with your fix, both cases provided by me and @Atri0 work correctly. |
Fixed in b8ace84, PR #297. Thanks @snuyanzin! |
For the case when several queries are pasted to the SqlLine, they are passed as a single query:
For example, copy all the next queries:
and paste them to the SqlLine. It passes all the queries as the single one.
The previous version was submitting the first query, returned its result, and then submitted one by one other queries.
The text was updated successfully, but these errors were encountered: