Skip to content
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

必须根据where条件找到切分字段?如果一个子条件没有找到,貌似行为不确定,默认不支持查询全部库 #12

Closed
pingww opened this issue Feb 23, 2016 · 2 comments

Comments

@pingww
Copy link

pingww commented Feb 23, 2016

// 如果这里没有找到切分字段,也就没有了ConditionContext集
if (!shardingColumns.contains(column.getColumnName())) {
return;
}

// 没有了ConditionContext,这里也就为空,后面就不了了之了,
for (SQLExecutionUnit each : sqlRouteResult.getExecutionUnits()) {
PreparedStatement preparedStatement = generatePrepareStatement(getShardingConnection().getConnection(each.getDataSource()), each.getSql());
replayMethodsInvovation(preparedStatement);
setParameters(preparedStatement, parameters);
result.add(preparedStatement);
}

如果默认不支持全部分片的查询,建议要抛个异常

@hanahmily
Copy link
Contributor

这里可以增加一个配置。配置没有找到路由规则后的行为。我觉得这个配置需要分级别,应该有全局配置,针对特定逻辑表的配置

@hanahmily
Copy link
Contributor

目前新版本中已经实现如果没有shardingvalue,就返回所有分片这个逻辑了。

terrymanu pushed a commit that referenced this issue Jun 23, 2018
RaigorJiang added a commit that referenced this issue Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants