Closed ilxqx closed 1 year ago
Greetings.
2 empty lines (e.g. \n\n\n
) terminate a statement and I do not see any good reason why SQL statements should contains 2 empty lines.
Remove the 2 empty lines and it will parse well.
First of all, thank you for your reply.
There are multiple blank lines here, which is actually SQL automatically generated by a framework called MybatisPlus
. There may be additional blank lines when the SQL is automatically concatenated internally.
Yes, removing two blank lines can parse it normally. But why could version 4.5 parse it normally? Was it intentional or was the logic not rigorous and fixed in version 4.6?
Greetings.
I have lodged a case about this at MyBatisPlus already, they should fix their generator.
The change was indeed introduced in JSQLParser 4.6 (together with other possible statement terminators like \
or GO
).
Here is this My Batis Issue: https://github.com/baomidou/mybatis-plus/issues Maybe you can intervene there since its all in Chinese.
Okay, thank you.
Always check against the Latest SNAPSHOT of JSQLParser and the Syntax Diagram
Failing SQL Feature:
Default.
SQL Example:
medical_record_number, created_at, updated_at ) VALUES ( ?,
?, ?, ? )
The following error will occur when running:
Software Information:
JSqlParser
to 4.5, the SQL parsing above was normal and did not report any error, indicating that this problem does not exist in version 4.5.At the same time, if I process it like this before parsing SQL:
sql.replaceAll("\\s+", " ").trim()
, the parsing will be completed normally.Can't version 4.6 handle extra spaces and line breaks in SQL correctly?