mybatis-plus icon indicating copy to clipboard operation
mybatis-plus copied to clipboard

脚本中存在大量空格和换行导致脚本解析错误,是否可以在解析前去除空格和换行

Open greenhand520 opened this issue 1 year ago • 10 comments

当前使用版本(必填,否则不予处理)

版本:3.5.3.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

脚本中存在大量空格和换行导致脚本解析错误,是否可以在解析前去除空格和换行 image

重现步骤(如果有就写完整)

报错信息

image

greenhand520 avatar Sep 28 '23 06:09 greenhand520

是自己编写的sql吗?

nieqiurong avatar Sep 28 '23 08:09 nieqiurong

无法定位你的问题,给出详细的重现代码

qmdx avatar Sep 28 '23 09:09 qmdx

我也遇到了,退回3.5.3.1就没有问题了, 而且3.5.3.2很多SQL查询速度都比3.5.3.1慢非常多

tanqiyuan avatar Oct 05 '23 08:10 tanqiyuan

能否给个能重现问题的dome

QuillVot avatar Oct 09 '23 02:10 QuillVot

如果是自己业务代码里面有空格可以尝试开启.

mybatis-plus:
  configuration:
    shrink-whitespaces-in-sql: true

nieqiurong avatar Oct 11 '23 13:10 nieqiurong

#5345

nieqiurong avatar Oct 11 '23 13:10 nieqiurong

#5345

麻烦问下,下个版本会修复这个问题嘛?

yoyo-520 avatar Nov 15 '23 09:11 yoyo-520

类似这样? https://github.com/JSQLParser/JSqlParser/issues/1988

pansong291 avatar Apr 10 '24 08:04 pansong291

如果是自己业务代码里面有空格可以尝试开启.

mybatis-plus:
  configuration:
    shrink-whitespaces-in-sql: true

@nieqiurong 请教一下这个会不会把数据里的空行给替换了?比如:

update shop_info set title=?,



content='abc



def'
where id=?

pansong291 avatar Apr 10 '24 09:04 pansong291

如果是自己业务代码里面有空格可以尝试开启.

mybatis-plus:
  configuration:
    shrink-whitespaces-in-sql: true

@nieqiurong 请教一下这个会不会把数据里的空行给替换了?比如:

update shop_info set title=?,



content='abc



def'
where id=?

实测会替换

gantrylau avatar Apr 11 '24 02:04 gantrylau

自3.5.3.2开始,内置注入已经处理多余的换行.

#6187

nieqiurong avatar Jul 12 '24 10:07 nieqiurong