We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
select * from tbl where tbl.id in (?, ?) 里面的 tbl.id in (?, ) tbl 没有被解析出来。
select * from tbl where tbl.id in (?, ?)
tbl.id in (?, )
日志如下
Logic SQL: SELECT board.id, board.author_id, board.title, board.description, board.accessibility, board.create_time, board.update_time FROM board WHERE board.id IN (?, ?), [23524622263648256, 23524622263648256] 2017-01-04 22:25:28.646 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.sharding.parser.SQLParseEngine : Parsed SQL result: SQLParsedResult(routeContext=RouteContext(tables=[Table(name=board, alias=Optional.absent())], sqlStatementType=null, sqlBuilder=null), generatedKeyContext=GeneratedKeyContext(columns=[], columnNameToIndexMap={}, valueTable={}, rowIndex=0, columnIndex=0, autoGeneratedKeys=0, columnIndexes=null, columnNames=null), conditionContexts=[ConditionContext(conditions={Condition.Column(columnName=id, tableName=board)=Condition(column=Condition.Column(columnName=id, tableName=board), operator=IN, values=[23524622263648256, 23524622263648256], valueIndices=[0, 1])})], mergeContext=MergeContext(orderByColumns=[], groupByColumns=[], aggregationColumns=[], limit=null)) 2017-01-04 22:25:28.648 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.sharding.parser.SQLParseEngine : Parsed SQL: SELECT [Token(board)].id, [Token(board)].author_id, [Token(board)].title, [Token(board)].description, [Token(board)].accessibility , [Token(board)].create_time, [Token(board)].update_time FROM [Token(board)] WHERE board.id IN (?, ?) 2017-01-04 22:25:28.651 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.s.r.single.SingleTableRouter : Before database sharding board routes db names: [ds_0, ds_1] sharding columns: [id] sharding values: [ShardingValue(logicTableName=board, columnName=id, value=null, values=[23524622263648256, 23524622263648256], valueRange=null)] 2017-01-04 22:25:28.654 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.s.r.single.SingleTableRouter : After database sharding board result: [ds_0] 2017-01-04 22:25:28.654 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.s.r.single.SingleTableRouter : Before table sharding board routes db names: [DataNode(dataSourceName=ds_0, tableName=board_0002), DataNode(dataSourceName=ds_1, tableName=board_0002), DataNode(dataSourceName=ds_0, tableName=board_0000), DataNode(dataSourceName=ds_1, tableName=board_0000), DataNode(dataSourceName=ds_0, tableName=board_0001), DataNode(dataSourceName=ds_1, tableName=board_0001)] sharding columns: [id] sharding values: [ShardingValue(logicTableName=board, columnName=id, value=null, values=[23524622263648256, 23524622263648256], valueRange=null)] 2017-01-04 22:25:28.654 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.s.r.single.SingleTableRouter : After table sharding board result: [board_0001] 2017-01-04 22:25:28.659 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.sharding.router.SQLRouteEngine : final route result is 1 target 2017-01-04 22:25:28.659 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.sharding.router.SQLRouteEngine : ds_0:SELECT board_0001.id, board_0001.author_id, board_0001.title, board_0001.description, board_0001.accessibility , board_0001.create_time, board_0001.update_time FROM board_0001 WHERE board.id IN (?, ?) [23524622263648256, 23524622263648256] 2017-01-04 22:25:28.659 DEBUG 4234 --- [nio-8080-exec-1] c.d.d.r.sharding.router.SQLRouteEngine : merge context:MergeContext(orderByColumns=[], groupByColumns=[], aggregationColumns=[], limit=null)
The text was updated successfully, but these errors were encountered:
public final boolean visit(final SQLPropertyExpr x) { //对于in表达式,它的parent是null,所以没有解析出来。 if (!(x.getParent() instanceof SQLBinaryOpExpr) && !(x.getParent() instanceof SQLSelectItem)) { return super.visit(x); } if (!(x.getOwner() instanceof SQLIdentifierExpr)) { return super.visit(x); } String tableOrAliasName = ((SQLIdentifierExpr) x.getOwner()).getLowerName(); if (getParseContext().isBinaryOperateWithAlias(x, tableOrAliasName)) { return super.visit(x); } printToken(tableOrAliasName); print("."); print(x.getName()); return false; }
Sorry, something went wrong.
应该怎么修,可以大概解释下吗,我可以来改
druid 新版本已经修复了这个bug,可以将 sjdbc 的 druid 依赖升级吗
alibaba/druid@3cf7cdf
Fix #214 recognize table name in binary expression
3842365
fe69b29
No branches or pull requests
select * from tbl where tbl.id in (?, ?)
里面的tbl.id in (?, )
tbl 没有被解析出来。日志如下
The text was updated successfully, but these errors were encountered: