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
unrecognized token error #1270
Comments
Ouch, that definitely sounds like a bug. Have you tried any of the commits prior to that, to see if that's the one which introduces it? |
The same error with version 3.10.99 from 2017-12-09, I see on my system. Thank you for looking into it. |
Oops. Just realised something that should have been obvious to me right away before. This is probably not a bug after all. With SQL, the single and double quote characters aren't the same thing.
In the above example, the table Further reference info, in case it's useful: https://www.sqlite.org/lang_keywords.html With your double quote example, the "unrecognized token" message is probably meaning that it's looking for a field called (literally) "anything--something", and not finding it. 😉 Does that help? |
Thank you for pointing to SQLite documentation.
|
Hmmm, yeah you're right. I've just tried it here with the sqlite3 client (and older version, 3.7.17 on my CentOS 7 desktop), and a recent build of DB4S. It looks like DB4S is getting misunderstanding the double quotes. For example, with this (from above):
In the sqlite3 CLI it works, adding a new row into the table
Looking at that error message, there's an extra So... yep this does seem like a bug. Our Execute SQL tab should accept anything that the SQLite CLI does. Thanks for being persistent. 😀 |
I'm kind of wondering if this is related to the regular expression crafted for #1004. |
In the code for removing comments from SQL statements we have to make sure to only match the '--' characters when they are not inside a quoted string or identifier. This works fine and as expected for single quotes. However, for double quotes it doesn't. This is fixed by this commit. See issue #1270.
Thanks for pointing this out, @isrep! I think I managed to tweak the regular expression to not screw up your SQL statement. Can you give tomorrow's nightly build a try and see if it's working for you? 😃 |
Sorry, I'm going to revert my changes. So no need to test the nightly. It's introducing new issues which I can't solve right now 😦 If anybody with leet regular expression skills wants to try themselves, please go ahead 😉 |
@h4yn0nnym0u5e @revolter Any interest? 😄 |
You can check out my fumblings in eae0730 and 29fa332. We need to make sure it's working for all these statements: SELECT "something--something" -- comment
SELECT 'something--something' -- comment
SELECT "something--some'thing" -- comment
SELECT 'something--some"thing' -- comment And as a bonus maybe for these too: SELECT `something--something` FROM table -- comment
SELECT [something--something] FROM table -- comment And for these: SELECT '/*test*/' -- comment
SELECT "/*test*/" -- comment
SELECT '/*te"st*/' -- comment
SELECT "/*te'st*/" -- comment
SELECT `/*test*/` FROM table -- comment
SELECT [/*test*/] FROM table -- comment |
I'm going to close this issue because all of this is solved after #1455 since we no longer try to strip comments before passing SQL code to SQLite for execution. |
Looks like we forgot about this when closing #1270.
Details for the issue
Selecting values in double quotes containing double hyphen substring returns "unrecognized token" error.
Please see example below.
--Error unrecognized token:
select "anything--something"
--no error
select 'anything--something'
Useful extra information
I'm opening this issue because:
I'm using DB4S on:
I'm using DB4S version:
I have also:
The text was updated successfully, but these errors were encountered: