mybatis下解析动态表名报错 druid版本 1.0.19

3mpgtkmj  于 4个月前  发布在  Druid
关注(0)|答案(4)|浏览(73)

select from t_share_info_offline_#{tableNum} where shop_id=#{shopId} and date in ( #{item} ) order by date desc

以上sql在#{table}那里会抛异常提示语法错误,但实际结果发现sql是成功执行并正确返回了结果.堆栈如下
merge sql error, dbType mysql, sql :
省略具体sql...
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'from t_share_info_offline_?
',expect QUES, actual QUES t_share_info_offline_
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:231)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:407)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:145)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:140)
at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:53)
at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:145)
at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:631)
at com.alibaba.druid.filter.stat.StatFilter.statementPrepareAfter(StatFilter.java:305)
at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:124)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342)
at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:323)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87)
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler

oxiaedzo

oxiaedzo1#

升到最新版本1.1.20试试看

gr8qqesn

gr8qqesn2#

升到最新版本1.1.20试试看

我试试 我也遇到了

kwvwclae

kwvwclae3#

升到最新版本1.1.20试试看

依然还是不行,只能自己魔改了

cx6n0qe3

cx6n0qe34#

升到最新版本1.1.20试试看

依然还是不行,只能自己魔改了

我已经用了最新的main分支的版本1.2.19-SNAPSHOT

相关问题