Repository: googleapis/java-spanner-jdbc
Pull request #43 (2020-01-27 21:21:05)

deps: update core transport dependencies to v1.34.1
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.http-client:google-http-client-bom](https://togithub.com/googleapis/google-http-java-client) | patch | `1.34.0` -> `1.34.1` |
| com.google.http-client:google-http-client | patch | `1.34.0` -> `1.34.1` |

---

### Release Notes

<details>
<summary>googleapis/google-http-java-client</summary>

### [`v1.34.1`](https://togithub.com/googleapis/google-http-java-client/blob/master/CHANGELOG.md#&#8203;1341httpswwwgithubcomgoogleapisgoogle-http-java-clientcomparev1340v1341-2020-01-26)

[Compare Source](https://togithub.com/googleapis/google-http-java-client/compare/v1.34.0...v1.34.1)

</details>

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or if you tick the rebase/retry checkbox below.

:no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-spanner-jdbc).

codecov[bot]: # [Codecov](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@b368b84`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43/graphs/tree.svg?width=650&token=ODlczvbGrj&height=150&src=pr)](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##             master      #43   +/-   ##
=========================================
  Coverage          ?   77.83%           
  Complexity        ?     1721           
=========================================
  Files             ?       60           
  Lines             ?     5866           
  Branches          ?      825           
=========================================
  Hits              ?     4566           
  Misses            ?      926           
  Partials          ?      374
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43?src=pr&el=footer). Last update [b368b84...5827b1a](https://codecov.io/gh/googleapis/java-spanner-jdbc/pull/43?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..3fbddec
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,20 @@
+# Changelog
+
+## [1.13.0](https://www.github.com/googleapis/java-spanner-jdbc/compare/1.12.0...v1.13.0) (2020-01-28)
+
+
+### Features
+
+* allow using existing OAuth token for JDBC connection ([#37](https://www.github.com/googleapis/java-spanner-jdbc/issues/37)) ([b368b84](https://www.github.com/googleapis/java-spanner-jdbc/commit/b368b8407b3e2884458d956a9207cb4e12e37848)), closes [#29](https://www.github.com/googleapis/java-spanner-jdbc/issues/29)
+
+
+### Bug Fixes
+
+* add support for WITH clauses ([#42](https://www.github.com/googleapis/java-spanner-jdbc/issues/42)) ([7f4bea4](https://www.github.com/googleapis/java-spanner-jdbc/commit/7f4bea43c42df68258f776944ea744069a1a218e))
+* allow dots and colons in project id ([#36](https://www.github.com/googleapis/java-spanner-jdbc/issues/36)) ([5957008](https://www.github.com/googleapis/java-spanner-jdbc/commit/59570085403fa7002616dd535df4666a384c3438)), closes [#33](https://www.github.com/googleapis/java-spanner-jdbc/issues/33)
+
+
+### Dependencies
+
+* update core dependencies ([#25](https://www.github.com/googleapis/java-spanner-jdbc/issues/25)) ([9f4f4ad](https://www.github.com/googleapis/java-spanner-jdbc/commit/9f4f4ad1b076bd3131296c9f7f6558f2bc885d42))
+* update dependency org.threeten:threetenbp to v1.4.1 ([7cc951b](https://www.github.com/googleapis/java-spanner-jdbc/commit/7cc951b340b072e7853df868aaf7c17f854a69f5))
diff --git a/README.md b/README.md
index 666bc73..db50ef1 100644
--- a/README.md
+++ b/README.md
@@ -11,16 +11,16 @@ If you are using Maven, add this to your pom.xml file
 <dependency>
   <groupId>com.google.cloud</groupId>
   <artifactId>google-cloud-spanner-jdbc</artifactId>
-  <version>1.12.0</version>
+  <version>1.13.0</version>
 </dependency>
 ```
 If you are using Gradle, add this to your dependencies
 ```Groovy
-compile 'com.google.cloud:google-cloud-spanner-jdbc:1.12.0'
+compile 'com.google.cloud:google-cloud-spanner-jdbc:1.13.0'
 ```
 If you are using SBT, add this to your dependencies
 ```Scala
-libraryDependencies += "com.google.cloud" % "google-cloud-spanner-jdbc" % "1.12.0"
+libraryDependencies += "com.google.cloud" % "google-cloud-spanner-jdbc" % "1.13.0"
 ```
 [//]: # ({x-version-update-end})
 
diff --git a/pom.xml b/pom.xml
index fb78d97..bb96256 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>google-cloud-spanner-jdbc</artifactId>
-  <version>1.12.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner-jdbc:current} -->
+  <version>1.13.0</version><!-- {x-version-update:google-cloud-spanner-jdbc:current} -->
   <packaging>jar</packaging>
   <name>Google Cloud Spanner JDBC</name>
   <url>https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-spanner-jdbc</url>
@@ -62,7 +62,7 @@
     <api-client.version>1.30.7</api-client.version>
     <google.core.version>1.92.2</google.core.version>
     <gax.version>1.53.0</gax.version>
-    <http-client-bom.version>1.34.0</http-client-bom.version>
+    <http-client-bom.version>1.34.1</http-client-bom.version>
     <guava.version>28.2-android</guava.version>
     <junit.version>4.13</junit.version>
     <google.common-protos.version>1.17.0</google.common-protos.version>
diff --git a/src/main/java/com/google/cloud/spanner/jdbc/StatementParser.java b/src/main/java/com/google/cloud/spanner/jdbc/StatementParser.java
index 9ed1ecd..e43a097 100644
--- a/src/main/java/com/google/cloud/spanner/jdbc/StatementParser.java
+++ b/src/main/java/com/google/cloud/spanner/jdbc/StatementParser.java
@@ -161,7 +161,7 @@ class StatementParser {
   }
 
   private final Set<String> ddlStatements = ImmutableSet.of("CREATE", "DROP", "ALTER");
-  private final Set<String> selectStatements = ImmutableSet.of("SELECT");
+  private final Set<String> selectStatements = ImmutableSet.of("SELECT", "WITH");
   private final Set<String> dmlStatements = ImmutableSet.of("INSERT", "UPDATE", "DELETE");
   private final Set<ClientSideStatementImpl> statements;
 
diff --git a/versions.txt b/versions.txt
index de9c4df..72036a3 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,4 +1,4 @@
-# Format:
-# module:released-version:current-version
-
-google-cloud-spanner-jdbc:1.12.0:1.12.1-SNAPSHOT
+# Format:
+# module:released-version:current-version
+
+google-cloud-spanner-jdbc:1.13.0:1.13.0


Test patch:
diff --git a/src/test/java/com/google/cloud/spanner/jdbc/StatementParserTest.java b/src/test/java/com/google/cloud/spanner/jdbc/StatementParserTest.java
index 6da65c1..1344a0f 100644
--- a/src/test/java/com/google/cloud/spanner/jdbc/StatementParserTest.java
+++ b/src/test/java/com/google/cloud/spanner/jdbc/StatementParserTest.java
@@ -266,6 +266,27 @@ public class StatementParserTest {
     assertTrue(parser.isQuery("select * from foo"));
     assertFalse(parser.isQuery("INSERT INTO FOO (ID, NAME) SELECT ID+1, NAME FROM FOO"));
 
+    assertTrue(
+        parser.isQuery(
+            "WITH subQ1 AS (SELECT SchoolID FROM Roster),\n"
+                + "     subQ2 AS (SELECT OpponentID FROM PlayerStats)\n"
+                + "SELECT * FROM subQ1\n"
+                + "UNION ALL\n"
+                + "SELECT * FROM subQ2"));
+    assertTrue(
+        parser.isQuery(
+            "with subQ1 AS (SELECT SchoolID FROM Roster),\n"
+                + "     subQ2 AS (SELECT OpponentID FROM PlayerStats)\n"
+                + "select * FROM subQ1\n"
+                + "UNION ALL\n"
+                + "SELECT * FROM subQ2"));
+    assertTrue(
+        parser
+            .parse(
+                Statement.of(
+                    "-- this is a comment\nwith foo as (select * from bar)\nselect * from foo"))
+            .isQuery());
+
     assertTrue(parser.parse(Statement.of("-- this is a comment\nselect * from foo")).isQuery());
     assertTrue(
         parser
@@ -310,6 +331,13 @@ public class StatementParserTest {
     assertTrue(
         parser.isQuery(
             "@{JOIN_METHOD=HASH_JOIN}\n /* Multi line comment\n with more comments\n */SELECT * FROM PersonsTable"));
+    assertTrue(
+        parser.isQuery(
+            "@{JOIN_METHOD=HASH_JOIN} WITH subQ1 AS (SELECT SchoolID FROM Roster),\n"
+                + "     subQ2 AS (SELECT OpponentID FROM PlayerStats)\n"
+                + "SELECT * FROM subQ1\n"
+                + "UNION ALL\n"
+                + "SELECT * FROM subQ2"));
 
     // Invalid query hints.
     assertFalse(parser.isQuery("@{JOIN_METHOD=HASH_JOIN SELECT * FROM PersonsTable"));
diff --git a/src/test/resources/com/google/cloud/spanner/jdbc/ITSqlMusicScriptTest.sql b/src/test/resources/com/google/cloud/spanner/jdbc/ITSqlMusicScriptTest.sql
index 93218da..243cdda 100644
--- a/src/test/resources/com/google/cloud/spanner/jdbc/ITSqlMusicScriptTest.sql
+++ b/src/test/resources/com/google/cloud/spanner/jdbc/ITSqlMusicScriptTest.sql
@@ -668,3 +668,8 @@ WHERE SingerId=2;
 SELECT COUNT(*) AS ACTUAL, 0 AS EXPECTED
 FROM Songs
 WHERE SingerId=2;
+
+@EXPECT RESULT_SET
+WITH Song2 AS (SELECT * FROM Songs WHERE SingerId=2)
+SELECT COUNT(*) AS ACTUAL, 0 AS EXPECTED
+FROM Song2;