Skip to content

Commit

Permalink
fix #353
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Aug 31, 2017
1 parent f36aa6d commit 809817b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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.5.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ && isRowNumberCondition(items, ((SQLPropertyExpression) left).getName())) {
} else {
parseOtherCondition(sqlStatement);
}
} else if (lexerEngine.equalAny(Symbol.LT_GT, DefaultKeyword.LIKE)) {
} else if (lexerEngine.equalAny(Symbol.LT_GT, Symbol.BANG_EQ, Symbol.BANG_GT, Symbol.BANG_LT, DefaultKeyword.LIKE)) {
parseOtherCondition(sqlStatement);
}
lexerEngine.skipIfEqual(Symbol.RIGHT_PAREN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<data parameter="100000" expected="select/SelectNotEqualsWithSingleTable.xml" />
</sharding-rule>
</sql>
.xml
<sql id="assertSelectNotEqualsWithSingleTableForExclamationEqual">
<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 @@ -24,6 +24,14 @@
<order-by-column name="item_id" order-by-type="ASC" />
</order-by-columns>
</assert>
<assert id="assertSelectNotEqualsWithSingleTableForExclamationEqual" 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 @@ -3,6 +3,7 @@
<sql id="assertSelectExpressionWithSingleTable" value="SELECT o.order_id + 1 * 2 FROM t_order AS o ORDER BY o.order_id" />
<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="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 809817b

Please sign in to comment.