Skip to content

Commit

Permalink
fix #354
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 1, 2017
1 parent 28c26f5 commit baf78e6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
1. [ISSUE #349](https://github.com/dangdangdotcom/sharding-jdbc/issues/349) ResultSet.wasNull功能不正确
1. [ISSUE #351](https://github.com/dangdangdotcom/sharding-jdbc/issues/351) 包含在默认数据源但不在TableRule配置的表无法正确执行
1. [ISSUE #353](https://github.com/dangdangdotcom/sharding-jdbc/issues/353) 在SQL的Where条件中兼容不是分片列的!=, !> 和 !< 操作符
1. [ISSUE #354](https://github.com/dangdangdotcom/sharding-jdbc/issues/354) 在SQL的Where条件中兼容不是分片列的NOT操作符

## 1.5.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ private void parseComparisonCondition(final ShardingRule shardingRule, final SQL
if (lexerEngine.skipIfEqual(Symbol.LT, Symbol.LT_EQ, Symbol.GT, Symbol.GT_EQ, Symbol.LT_GT, Symbol.BANG_EQ, Symbol.BANG_GT, Symbol.BANG_LT, DefaultKeyword.LIKE)) {
parseOtherCondition(sqlStatement);
}
if (lexerEngine.skipIfEqual(DefaultKeyword.NOT)) {
lexerEngine.nextToken();
lexerEngine.skipIfEqual(Symbol.LEFT_PAREN);
parseOtherCondition(sqlStatement);
lexerEngine.skipIfEqual(Symbol.RIGHT_PAREN);
}
lexerEngine.skipIfEqual(Symbol.RIGHT_PAREN);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<data parameter="100000" expected="select/SelectNotEqualsWithSingleTable.xml" />
</sharding-rule>
</sql>
<sql id="assertSelectNotEqualsWithSingleTableForNotIn">
<sharding-rule value="tbl">
<data parameter="100000" expected="select/SelectNotEqualsWithSingleTable.xml" />
</sharding-rule>
</sql>
<sql id="assertSelectEqualsWithSameShardingColumns">
<sharding-rule value="tbl">
<data parameter="1000,1001" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
<order-by-column name="item_id" order-by-type="ASC" />
</order-by-columns>
</assert>
<assert id="assertSelectNotEqualsWithSingleTableForNotIn" parameters="1">
<tables>
<table name="t_order_item" />
</tables>
<order-by-columns>
<order-by-column name="item_id" order-by-type="ASC" />
</order-by-columns>
</assert>
<assert id="assertSelectEqualsWithSingleTable" parameters="1,1">
<tables>
<table name="t_order" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<sql id="assertSelectDateFuncWithSingleTable" value="SELECT DATE(i.c_date) AS c_date FROM `t_order_item` AS i ORDER BY DATE(i.c_date) DESC" type="MySQL" />
<sql id="assertSelectNotEqualsWithSingleTable" value="SELECT * FROM t_order_item WHERE item_id &lt;&gt; %s ORDER BY item_id" />
<sql id="assertSelectNotEqualsWithSingleTableForExclamationEqual" value="SELECT * FROM t_order_item WHERE item_id != %s ORDER BY item_id" />
<sql id="assertSelectNotEqualsWithSingleTableForNotIn" value="SELECT * FROM t_order_item WHERE item_id NOT IN (%s) ORDER BY item_id" />
<sql id="assertSelectEqualsWithSingleTable" value="SELECT * FROM t_order WHERE user_id = %s AND order_id = %s" />
<sql id="assertSelectEqualsWithSameShardingColumns" value="SELECT * FROM t_order WHERE order_id = %s AND order_id = %s" />
<sql id="assertSelectBetweenWithSingleTable" value="SELECT * FROM t_order WHERE user_id BETWEEN %s AND %s AND order_id BETWEEN %s AND %s ORDER BY user_id, order_id" />
Expand Down

0 comments on commit baf78e6

Please sign in to comment.