kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 7e53feb3a63911337cfef1e494537bde3c2f52ff5ea5a3df78c5980102dac008 |
|---|---|
| Author | Alexandre Dutra <adutra@users.noreply.github.com> · 2016-10-19 19:46 +02:00 |
| Committer | Olivier Michallat <olim7t@users.noreply.github.com> · 2016-10-19 10:46 -07:00 |
| Parents | 2ed85fc54637 |
3 files changed
modified changelog/README.md +5 −0
| @@ -1,5 +1,10 @@ | ||
| 1 | 1 | ## Changelog |
| 2 | 2 | |
| 3 | +### 3.0.5 (in progress) | |
| 4 | + | |
| 5 | +- [bug] JAVA-1312: QueryBuilder modifies selected columns when manually selected. | |
| 6 | + | |
| 7 | + | |
| 3 | 8 | ### 3.0.4 |
| 4 | 9 | |
| 5 | 10 | - [improvement] JAVA-1246: Driver swallows the real exception in a few cases |
modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/Select.java +2 −0
| @@ -513,6 +513,7 @@ | ||
| 513 | 513 | public Select from(String keyspace, String table) { |
| 514 | 514 | if (previousSelection != null) |
| 515 | 515 | addName(previousSelection); |
| 516 | + previousSelection = null; | |
| 516 | 517 | return super.from(keyspace, table); |
| 517 | 518 | } |
| 518 | 519 | |
| @@ -520,6 +521,7 @@ | ||
| 520 | 521 | public Select from(TableMetadata table) { |
| 521 | 522 | if (previousSelection != null) |
| 522 | 523 | addName(previousSelection); |
| 524 | + previousSelection = null; | |
| 523 | 525 | return super.from(table); |
| 524 | 526 | } |
| 525 | 527 | } |
modified driver-core/src/test/java/com/datastax/driver/core/querybuilder/QueryBuilderTest.java +13 −0
| @@ -1053,4 +1053,17 @@ | ||
| 1053 | 1053 | .isEqualTo("INSERT INTO users (id) VALUES (42);"); |
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | + /** | |
| 1057 | + * @jira_ticket JAVA-1312 | |
| 1058 | + */ | |
| 1059 | + @Test(groups = "unit") | |
| 1060 | + public void should_not_append_last_column_twice() throws Exception { | |
| 1061 | + Select.SelectionOrAlias select = select().column("a").column("b"); | |
| 1062 | + Select fromUsers1 = select.from("users"); | |
| 1063 | + Select fromUsers2 = select.from("users"); | |
| 1064 | + assertThat(fromUsers1.getQueryString()) | |
| 1065 | + .isEqualTo(fromUsers2.getQueryString()) | |
| 1066 | + .isEqualTo("SELECT a,b FROM users;"); | |
| 1067 | + } | |
| 1068 | + | |
| 1056 | 1069 | } |