-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
JSqlParser cannot recognize \' #875
Comments
yanbeipang
changed the title
Cannot parse SQL with "log" as column name, \'UPDATE\' within value
Cannot parse SQL with "skip" as column name, \'UPDATE\' within value
Oct 21, 2019
yanbeipang
changed the title
Cannot parse SQL with "skip" as column name, \'UPDATE\' within value
Cannot parse SQL that contains \'UPDATE\' in column value
Oct 22, 2019
yanbeipang
changed the title
Cannot parse SQL that contains \'UPDATE\' in column value
JSqlParser cannot recognize \'
Oct 22, 2019
manticore-projects
added a commit
to manticore-projects/JSqlParser
that referenced
this issue
Jan 16, 2023
Greetings! You will need to escape the single Quotes Example String sqlStr="insert into standard_table(gmt_create, gmt_modified, config_name, standard_code) values (now(), now(), null, 'if \n"
+ "@fac.sql_type in \n"
+ "[ ''UPDATE'', ''DELETE'', ''INSERT'', ''INSERT_SELECT''] \n"
+ "then \n"
+ "@act.allow_submit \n"
+ "end \n"
+ "')"
;
TestUtils.assertSqlCanBeParsedAndDeparsed(
sqlStr
, true
, parser -> parser.withBackslashEscapeCharacter(false)
);
sqlStr="insert into standard_table(gmt_create, gmt_modified, config_name, standard_code) values (now(), now(), null, 'if \n"
+ "@fac.sql_type in \n"
+ "[ \\'UPDATE\\', \\'DELETE\\', \\'INSERT\\', \\'INSERT_SELECT\\'] \n"
+ "then \n"
+ "@act.allow_submit \n"
+ "end \n"
+ "')"
;
TestUtils.assertSqlCanBeParsedAndDeparsed(
sqlStr
, true
, parser -> parser.withBackslashEscapeCharacter(true)
); |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Got JSQLParserException when parsing the following SQLs:
To Reproduce
Cannot parse:
insert into standard_table(gmt_create, gmt_modified, config_name, standard_code) values (now(), now(), null, 'if
@fac.sql_type in
[ 'UPDATE','DELETE','INSERT','INSERT_SELECT']
then
@act.allow_submit
end
');
Will work:
insert into standard_table(gmt_create, gmt_modified, config_name, standard_code) values (now(), now(), null, 'if
@fac.sql_type in
[ "UPDATE","DELETE","INSERT","INSERT_SELECT"]
then
@act.allow_submit
end
');
Expected behavior
A clear and concise description of what you expected to happen.
System
MySQL
Unimportant
2.1
The text was updated successfully, but these errors were encountered: