From ca1c906e1ed3cad6444068ab9c8465401d6d3074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Wed, 25 Aug 2021 08:23:17 +0200 Subject: [PATCH] feat: support JSON data type (#447) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: support JSON data type fix: NPE was thrown when getting an array of structs from a ResultSet (#445) A NullPointerException was thrown if a ResultSet contained an array of Structs and the getArray() method was called on the column. Fixes #444 fix: cleanup and add documentation chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.0.2 (#443) chore: regenerate README (#450) chore(deps): update dependency com.google.cloud:libraries-bom to v20.2.0 (#448) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | `20.1.0` -> `20.2.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.2.0/compatibility-slim/20.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.2.0/confidence-slim/20.1.0)](https://docs.renovatebot.com/merge-confidence/) | --- :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 you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: add SECURITY.md (#446) chore: add SECURITY.md feat: allow get/set Spanner Value instances (#454) Adds support for getting a value from a `java.sql.ResultSet` as a `com.google.cloud.spanner.Value` instance, and for setting a parameter on a `java.sql.PreparedStatement` using a `com.google.cloud.spanner.Value` instance. Fixes #452 build(deps): update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.1.2 (#451) deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.0 (#453) chore: remove unused statements file (#458) The ClientSideStatements.json file has been moved to the Connection API in the client library and is not needed in the JDBC driver. chore: release 2.0.3-SNAPSHOT (#442) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> chore: adding cloud-rad java xrefs (#461) Source-Author: Emily Ball Source-Date: Thu May 6 11:48:47 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: 046994f491c02806aea60118e214a9edd67f5ab7 Source-Link: https://github.com/googleapis/synthtool/commit/046994f491c02806aea60118e214a9edd67f5ab7 deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 (#463) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `1.0.0` -> `1.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.1.0/compatibility-slim/1.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.1.0/confidence-slim/1.0.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-shared-dependencies [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v1.0.0...v1.1.0) - update dependency com.google.protobuf:protobuf-bom to v3.16.0 ([#​348](https://www.github.com/googleapis/java-shared-dependencies/issues/348)) ([0aacfde](https://www.github.com/googleapis/java-shared-dependencies/commit/0aacfdeec70e30803734db8287c47e4fad5481ef)) - update gax.version to v1.64.0 ([#​345](https://www.github.com/googleapis/java-shared-dependencies/issues/345)) ([478bd35](https://www.github.com/googleapis/java-shared-dependencies/commit/478bd35296293e81c7e70157f50bfbebdc1bb54d)) - update iam.version to v1.0.13 ([#​343](https://www.github.com/googleapis/java-shared-dependencies/issues/343)) ([3637923](https://www.github.com/googleapis/java-shared-dependencies/commit/363792392b71deff5cc5731104b631122fba5e61))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore(deps): update dependency com.google.cloud:libraries-bom to v20.3.0 (#462) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | `20.2.0` -> `20.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.3.0/compatibility-slim/20.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.3.0/confidence-slim/20.2.0)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). build(java): remove codecov action (#465) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/8e8c0070-26ea-4d86-b07a-e4dcc9e5b8b1/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/4f4b1b9b8d8b52f1e9e4a76165896debce5ab7f1 chore(deps): update dependency com.google.cloud:libraries-bom to v20.4.0 (#466) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | `20.3.0` -> `20.4.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.4.0/compatibility-slim/20.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.4.0/confidence-slim/20.3.0)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: add changelog to cloud-rad (#467) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/41862329-45d0-4225-9ed2-ad5a75997ae8/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/c86c7a60985644eab557949363a38301d40d78d2 tests: fixes jdbc query options test (#468) * tests: fixes jdbc query options test This test was failing, because we were no longer recreating the jdbc connection from scratch. One of the tests, set an environment variable specifying the optimizer version, which was permanently applied, since the connection was not re-created. Here we make sure to start / stop the static server before each test. * chore: fixes linting errors tests: fixes sql script test (#469) In version 6.4.4 of spanner we have change the verifyStatementsInFile method to wrap any SQLExceptions into SpannerExceptions. In the failing tests we were catching SQLExceptions and ignoring them, since they were expected. We have changed the tests to also ignore the respective SpannerExceptions. deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.4 (#464) chore: release 2.1.0 (#460) :robot: I have created a release \*beep\* \*boop\* --- * allow get/set Spanner Value instances ([#454](https://www.github.com/googleapis/java-spanner-jdbc/issues/454)) ([d6935b8](https://www.github.com/googleapis/java-spanner-jdbc/commit/d6935b863349c58cfdd44d6ce20dba6f5dbc1472)), closes [#452](https://www.github.com/googleapis/java-spanner-jdbc/issues/452) * NPE was thrown when getting an array of structs from a ResultSet ([#445](https://www.github.com/googleapis/java-spanner-jdbc/issues/445)) ([1dfb37b](https://www.github.com/googleapis/java-spanner-jdbc/commit/1dfb37b27ee661718fe80be0bf260c40f4b15582)), closes [#444](https://www.github.com/googleapis/java-spanner-jdbc/issues/444) * update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 ([#463](https://www.github.com/googleapis/java-spanner-jdbc/issues/463)) ([f148c71](https://www.github.com/googleapis/java-spanner-jdbc/commit/f148c71bef2b762d7b4475ba7f28443c7938c394)) * update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.0 ([#453](https://www.github.com/googleapis/java-spanner-jdbc/issues/453)) ([7dac8b3](https://www.github.com/googleapis/java-spanner-jdbc/commit/7dac8b3e43625aa28be214bd735fc3386770de04)) * update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.4 ([#464](https://www.github.com/googleapis/java-spanner-jdbc/issues/464)) ([eeb31c0](https://www.github.com/googleapis/java-spanner-jdbc/commit/eeb31c050fda116203d9da5c4a80c7f1c6a6cac4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: release 2.1.1-SNAPSHOT (#470) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.1.0 (#471) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-jdbc](https://togithub.com/googleapis/java-spanner-jdbc) | `2.0.2` -> `2.1.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.1.0/compatibility-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.1.0/confidence-slim/2.0.2)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-spanner-jdbc [Compare Source](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.0.2...v2.1.0) - allow get/set Spanner Value instances ([#​454](https://www.github.com/googleapis/java-spanner-jdbc/issues/454)) ([d6935b8](https://www.github.com/googleapis/java-spanner-jdbc/commit/d6935b863349c58cfdd44d6ce20dba6f5dbc1472)), closes [#​452](https://www.github.com/googleapis/java-spanner-jdbc/issues/452) - NPE was thrown when getting an array of structs from a ResultSet ([#​445](https://www.github.com/googleapis/java-spanner-jdbc/issues/445)) ([1dfb37b](https://www.github.com/googleapis/java-spanner-jdbc/commit/1dfb37b27ee661718fe80be0bf260c40f4b15582)), closes [#​444](https://www.github.com/googleapis/java-spanner-jdbc/issues/444) - update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 ([#​463](https://www.github.com/googleapis/java-spanner-jdbc/issues/463)) ([f148c71](https://www.github.com/googleapis/java-spanner-jdbc/commit/f148c71bef2b762d7b4475ba7f28443c7938c394)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.0 ([#​453](https://www.github.com/googleapis/java-spanner-jdbc/issues/453)) ([7dac8b3](https://www.github.com/googleapis/java-spanner-jdbc/commit/7dac8b3e43625aa28be214bd735fc3386770de04)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.4.4 ([#​464](https://www.github.com/googleapis/java-spanner-jdbc/issues/464)) ([eeb31c0](https://www.github.com/googleapis/java-spanner-jdbc/commit/eeb31c050fda116203d9da5c4a80c7f1c6a6cac4)) - release scripts from issuing overlapping phases ([#​434](https://www.github.com/googleapis/java-spanner-jdbc/issues/434)) ([b2eec0f](https://www.github.com/googleapis/java-spanner-jdbc/commit/b2eec0f079e64f5c21b89bbc0b02e3e981d6469a)) - typo ([#​431](https://www.github.com/googleapis/java-spanner-jdbc/issues/431)) ([a0b158b](https://www.github.com/googleapis/java-spanner-jdbc/commit/a0b158bf9931d610779dec51ca61107078e9398e)) - update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.1 ([#​438](https://www.github.com/googleapis/java-spanner-jdbc/issues/438)) ([aa56b5c](https://www.github.com/googleapis/java-spanner-jdbc/commit/aa56b5c1d5e3b1ccdaa0d5b877deccbda5aa0061)) - update dependency com.google.cloud:google-cloud-shared-dependencies to v1 ([#​441](https://www.github.com/googleapis/java-spanner-jdbc/issues/441)) ([df7f0e7](https://www.github.com/googleapis/java-spanner-jdbc/commit/df7f0e796c03f9607e57b4b6ba999c92ea14c58d)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.2.1 ([#​430](https://www.github.com/googleapis/java-spanner-jdbc/issues/430)) ([212d9d0](https://www.github.com/googleapis/java-spanner-jdbc/commit/212d9d05c4f28ade71ab5484792188b11a5bcd8b)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.3.3 ([#​439](https://www.github.com/googleapis/java-spanner-jdbc/issues/439)) ([a128c4c](https://www.github.com/googleapis/java-spanner-jdbc/commit/a128c4cbe0e6b66f9276b71f7733a46645186e88)) - update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.0 ([#​423](https://www.github.com/googleapis/java-spanner-jdbc/issues/423)) ([e0cf14a](https://www.github.com/googleapis/java-spanner-jdbc/commit/e0cf14a4dd087532924f49bb8e0431e1d681c7e8)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.2.0 ([#​420](https://www.github.com/googleapis/java-spanner-jdbc/issues/420)) ([fdd8809](https://www.github.com/googleapis/java-spanner-jdbc/commit/fdd880943394e4760c26eadc3a87d5a298591eb1))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). feat: add `gcf-owl-bot[bot]` to `ignoreAuthors` (#474) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/35db7954-f063-42f8-9ff3-5d189e94e5d3/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/7332178a11ddddc91188dc0f25bca1ccadcaa6c6 deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 (#473) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `1.1.0` -> `1.2.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.2.0/compatibility-slim/1.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.2.0/confidence-slim/1.1.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-shared-dependencies [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v1.1.0...v1.2.0) - update dependency com.google.api-client:google-api-client-bom to v1.31.5 ([#​353](https://www.github.com/googleapis/java-shared-dependencies/issues/353)) ([8d72ab0](https://www.github.com/googleapis/java-shared-dependencies/commit/8d72ab003e08c864aedc17fc190ba26f393bf0c7)) - update dependency com.google.errorprone:error_prone_annotations to v2.7.1 ([#​360](https://www.github.com/googleapis/java-shared-dependencies/issues/360)) ([8f952d0](https://www.github.com/googleapis/java-shared-dependencies/commit/8f952d05745358fc426a1a2dcb688da5d5010239)) - update dependency com.google.protobuf:protobuf-bom to v3.17.0 ([#​355](https://www.github.com/googleapis/java-shared-dependencies/issues/355)) ([09858fb](https://www.github.com/googleapis/java-shared-dependencies/commit/09858fb4f1b78a77e828501597d20df4db0ebfcf)) - update dependency io.grpc:grpc-bom to v1.37.1 ([#​359](https://www.github.com/googleapis/java-shared-dependencies/issues/359)) ([bc9869e](https://www.github.com/googleapis/java-shared-dependencies/commit/bc9869e914314f951afd69f2acae95c414398f43)) - update google.common-protos.version to v2.2.1 ([#​358](https://www.github.com/googleapis/java-shared-dependencies/issues/358)) ([a3ed764](https://www.github.com/googleapis/java-shared-dependencies/commit/a3ed764a0e5143ee323d4b69c9747b8265d349e2)) - update iam.version to v1.0.14 ([#​352](https://www.github.com/googleapis/java-shared-dependencies/issues/352)) ([bea9a01](https://www.github.com/googleapis/java-shared-dependencies/commit/bea9a01788ac1332a4bc7e06574ef5701700fe90))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: regenerate README (#472) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-05-18 19:34:16,960 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-05-18 19:34:18,292 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/572b047a-da68-49ed-98fa-b98e7f88514a/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) build(deps): update dependency com.google.cloud:google-cloud-shared-config to v0.12.0 (#476) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-config](https://togithub.com/googleapis/java-shared-config) | `0.11.2` -> `0.12.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/0.12.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/0.12.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/0.12.0/compatibility-slim/0.11.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-config/0.12.0/confidence-slim/0.11.2)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: dump maven version along with java (#477) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/9ea9dfcf-fef7-472c-9ebc-755e62e086c4/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/8eae0234a16b26c2ff616d305dbd9786c8b10a47 docs: document connection properties in README (#478) Adds documentation for the supported connection properties to the README file. Fixes #456 chore: regenerate README (#481) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-05-24 05:37:24,863 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-05-24 05:37:26,075 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/5da15a47-718f-4374-b505-dead2c234c76/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) build(deps): update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.3.0 (#480) chore(deps): update dependency com.google.cloud:libraries-bom to v20.5.0 (#482) deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.5.0 (#483) test(deps): update dependency com.google.truth:truth to v1.1.3 (#484) test(deps): update dependency com.google.truth:truth to v1.1.3 (#485) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | com.google.truth:truth | `1.1.2` -> `1.1.3` | [![age](https://badges.renovateapi.com/packages/maven/com.google.truth:truth/1.1.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.truth:truth/1.1.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.truth:truth/1.1.3/compatibility-slim/1.1.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.truth:truth/1.1.3/confidence-slim/1.1.2)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: release 2.2.0 (#475) :robot: I have created a release \*beep\* \*boop\* --- * add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#474](https://www.github.com/googleapis/java-spanner-jdbc/issues/474)) ([c14f17b](https://www.github.com/googleapis/java-spanner-jdbc/commit/c14f17b411b15e778a68ce998de04732b159d7ac)) * document connection properties in README ([#478](https://www.github.com/googleapis/java-spanner-jdbc/issues/478)) ([3ccc543](https://www.github.com/googleapis/java-spanner-jdbc/commit/3ccc5433bec261b18d2536b04590e7645e47ed9b)), closes [#456](https://www.github.com/googleapis/java-spanner-jdbc/issues/456) * update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 ([#473](https://www.github.com/googleapis/java-spanner-jdbc/issues/473)) ([a6cc069](https://www.github.com/googleapis/java-spanner-jdbc/commit/a6cc0697ed5916c665f007a1bf16660b8b91f9f9)) * update dependency com.google.cloud:google-cloud-spanner-bom to v6.5.0 ([#483](https://www.github.com/googleapis/java-spanner-jdbc/issues/483)) ([e7fec30](https://www.github.com/googleapis/java-spanner-jdbc/commit/e7fec30f2f2c5518821d5348d448f102301d65c3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: release 2.2.1-SNAPSHOT (#487) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.2.0 (#488) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-jdbc](https://togithub.com/googleapis/java-spanner-jdbc) | `2.1.0` -> `2.2.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.2.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.2.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.2.0/compatibility-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.2.0/confidence-slim/2.1.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-spanner-jdbc [Compare Source](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.1.0...v2.2.0) - add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#​474](https://www.github.com/googleapis/java-spanner-jdbc/issues/474)) ([c14f17b](https://www.github.com/googleapis/java-spanner-jdbc/commit/c14f17b411b15e778a68ce998de04732b159d7ac)) - document connection properties in README ([#​478](https://www.github.com/googleapis/java-spanner-jdbc/issues/478)) ([3ccc543](https://www.github.com/googleapis/java-spanner-jdbc/commit/3ccc5433bec261b18d2536b04590e7645e47ed9b)), closes [#​456](https://www.github.com/googleapis/java-spanner-jdbc/issues/456) - update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 ([#​473](https://www.github.com/googleapis/java-spanner-jdbc/issues/473)) ([a6cc069](https://www.github.com/googleapis/java-spanner-jdbc/commit/a6cc0697ed5916c665f007a1bf16660b8b91f9f9)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.5.0 ([#​483](https://www.github.com/googleapis/java-spanner-jdbc/issues/483)) ([e7fec30](https://www.github.com/googleapis/java-spanner-jdbc/commit/e7fec30f2f2c5518821d5348d448f102301d65c3))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: regenerate README (#489) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-06-02 20:28:22,584 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-06-02 20:28:23,968 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/f9c652de-b905-42d2-8dff-d97f0e0d5476/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 (#490) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `1.2.0` -> `1.3.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.3.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.3.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.3.0/compatibility-slim/1.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.3.0/confidence-slim/1.2.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-shared-dependencies [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v1.2.0...v1.3.0) - add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#​365](https://www.github.com/googleapis/java-shared-dependencies/issues/365)) ([7e8309b](https://www.github.com/googleapis/java-shared-dependencies/commit/7e8309bf67ade0fe2b09f792848136cd88b4d2e4)) - update dependency com.google.auth:google-auth-library-bom to v0.26.0 ([#​368](https://www.github.com/googleapis/java-shared-dependencies/issues/368)) ([38256a8](https://www.github.com/googleapis/java-shared-dependencies/commit/38256a82cb6896c3f5e5ea6ca5d8d671c412bf84)) - update dependency com.google.cloud:google-cloud-core-bom to v1.95.0 ([#​377](https://www.github.com/googleapis/java-shared-dependencies/issues/377)) ([297ea62](https://www.github.com/googleapis/java-shared-dependencies/commit/297ea621e02f8c0679c8b07ed399d11eaacecc14)) - update dependency com.google.code.gson:gson to v2.8.7 ([#​370](https://www.github.com/googleapis/java-shared-dependencies/issues/370)) ([cdc1b8e](https://www.github.com/googleapis/java-shared-dependencies/commit/cdc1b8ea1c93f97b712081ca8dc8ea57f342b69e)) - update dependency com.google.protobuf:protobuf-bom to v3.17.1 ([#​369](https://www.github.com/googleapis/java-shared-dependencies/issues/369)) ([5a19574](https://www.github.com/googleapis/java-shared-dependencies/commit/5a19574bc626bb3c6b573ed1d177e8907188dec1)) - update dependency com.google.protobuf:protobuf-bom to v3.17.2 ([#​374](https://www.github.com/googleapis/java-shared-dependencies/issues/374)) ([83516e6](https://www.github.com/googleapis/java-shared-dependencies/commit/83516e691b99e5e5d22d27e561781a5ade5fb514)) - update dependency io.grpc:grpc-bom to v1.38.0 ([#​364](https://www.github.com/googleapis/java-shared-dependencies/issues/364)) ([00db570](https://www.github.com/googleapis/java-shared-dependencies/commit/00db5701c3b0aa609f3778c06911a9a0248ca342)) - update gax.version to v1.65.0 ([#​376](https://www.github.com/googleapis/java-shared-dependencies/issues/376)) ([b793a0d](https://www.github.com/googleapis/java-shared-dependencies/commit/b793a0d7744ff1b0f8ae5d3d13ec4776ae8d3089)) - update google.common-protos.version to v2.3.1 ([#​366](https://www.github.com/googleapis/java-shared-dependencies/issues/366)) ([7d6a7fa](https://www.github.com/googleapis/java-shared-dependencies/commit/7d6a7fa7a2cad2b3f2ecf45e42d2ed5db0b60a43)) - update google.common-protos.version to v2.3.2 ([#​375](https://www.github.com/googleapis/java-shared-dependencies/issues/375)) ([68a47ad](https://www.github.com/googleapis/java-shared-dependencies/commit/68a47ad3243f3e980db74c9c8505a1b3063c131b))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: release 2.2.1 (#491) :robot: I have created a release \*beep\* \*boop\* --- * update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 ([#490](https://www.github.com/googleapis/java-spanner-jdbc/issues/490)) ([bf0c9d6](https://www.github.com/googleapis/java-spanner-jdbc/commit/bf0c9d6bf612b50a59ea2d530430ccace79aaf35)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: release 2.2.2-SNAPSHOT (#492) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.2.1 (#493) chore(deps): update dependency com.google.cloud.samples:shared-configuration to v1.0.23 (#494) chore: regenerate README (#495) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-06-05 09:53:24,030 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-06-05 09:53:25,229 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/2c57a5bd-142d-430b-9931-a1a1a7e59a30/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) chore(deps): update dependency com.google.cloud:libraries-bom to v20.6.0 (#496) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | `20.5.0` -> `20.6.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.6.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.6.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.6.0/compatibility-slim/20.5.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.6.0/confidence-slim/20.5.0)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.6.0 (#498) * deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.6.0 Updates to Spanner client 6.6.0 and adds tests for optimizer stats package. Replaces #497 * test: implement missing method for integration test chore: release 2.2.2 (#499) :robot: I have created a release \*beep\* \*boop\* --- * update dependency com.google.cloud:google-cloud-spanner-bom to v6.6.0 ([#498](https://www.github.com/googleapis/java-spanner-jdbc/issues/498)) ([5849a97](https://www.github.com/googleapis/java-spanner-jdbc/commit/5849a970087d3fa1d1b42092b4568602563a1dbd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: release 2.2.3-SNAPSHOT (#500) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.6.1 (#502) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-bom](https://togithub.com/googleapis/java-spanner) | `6.6.0` -> `6.6.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.6.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.6.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.6.1/compatibility-slim/6.6.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.6.1/confidence-slim/6.6.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-spanner [Compare Source](https://togithub.com/googleapis/java-spanner/compare/v6.6.0...v6.6.1)
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: release 2.2.3 (#504) :robot: I have created a release \*beep\* \*boop\* --- * update dependency com.google.cloud:google-cloud-spanner-bom to v6.6.1 ([#502](https://www.github.com/googleapis/java-spanner-jdbc/issues/502)) ([41a9cd4](https://www.github.com/googleapis/java-spanner-jdbc/commit/41a9cd49fed468f410ad226555f7b9ba46d857b3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: regenerate README (#505) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-06-15 21:17:11,110 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-06-15 21:17:12,273 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/0bc6fb82-3b4e-44b2-978c-65fa57b88268/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) chore: release 2.2.4-SNAPSHOT (#507) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). fix: Update dependencies.sh to not break on mac (#506) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/f853e0b6-9a6b-4346-9a07-ff7c7ec6f858/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/8f76a885deaaf2fe234daeba4a8cc4d1b3de8086 chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.2.2 (#501) chore: regenerate README (#510) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-06-15 23:11:37,759 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-06-15 23:11:38,999 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/61cfb5e0-68cd-47b3-89b4-af4a25c2c4b6/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) fix: prevent relocating urls that start with com like /computeMetadata/ (#511) Fixes #503 In addition to original problem I have added an exception for all the Netty libraries since I have got errors on service provider which claims that netty libraries are not a subtype. chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.2.3 (#509) chore: minimize noise from build scripts (#512) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/88f2626c-4d2d-42a7-9d16-aaa685eaa74a/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/1c0c698705e668ccb3d68556ae7260f16ce63a6e fix: Add `shopt -s nullglob` to dependencies script (#514) This PR was generated using Autosynth. :rainbow: Synth log will be available here: https://source.cloud.google.com/results/invocations/bc91c2d7-c025-42b9-ab03-f02a01c15622/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: https://github.com/googleapis/synthtool/commit/87254ac89a9559864c0a245d6b150406439ce3d8 chore(deps): update dependency com.google.cloud:libraries-bom to v20.7.0 (#515) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java) | `20.6.0` -> `20.7.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.7.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.7.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.7.0/compatibility-slim/20.6.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/20.7.0/confidence-slim/20.6.0)](https://docs.renovatebot.com/merge-confidence/) | --- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.7.0 (#513) deps: update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 (#518) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `1.3.0` -> `1.4.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.4.0/compatibility-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/1.4.0/confidence-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-shared-dependencies [Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v1.3.0...v1.4.0) - add grpc-gcp to dependencyManagement ([#​389](https://www.github.com/googleapis/java-shared-dependencies/issues/389)) ([57fd2e6](https://www.github.com/googleapis/java-shared-dependencies/commit/57fd2e646e28e37e0b5e4e1b37425d4897a8776f)) - Add `shopt -s nullglob` to dependencies script ([#​392](https://www.github.com/googleapis/java-shared-dependencies/issues/392)) ([f8f29df](https://www.github.com/googleapis/java-shared-dependencies/commit/f8f29df1c9cc6eca517c99113fb9509fd611ac92)) - Add common httpclient and oauth dependencies ([#​391](https://www.github.com/googleapis/java-shared-dependencies/issues/391)) ([09660e1](https://www.github.com/googleapis/java-shared-dependencies/commit/09660e1e50c96dcd7df4e80d8ad357f8256eda6c)) - Update dependencies.sh to not break on mac ([#​384](https://www.github.com/googleapis/java-shared-dependencies/issues/384)) ([0ae2841](https://www.github.com/googleapis/java-shared-dependencies/commit/0ae2841d7ce2885d041795c58a38d2d3973c2e5a)) - update dependency com.google.api-client:google-api-client-bom to v1.32.1 ([#​390](https://www.github.com/googleapis/java-shared-dependencies/issues/390)) ([00288c1](https://www.github.com/googleapis/java-shared-dependencies/commit/00288c18d09616582c8bec961ecc5c00ef1d4288)) - update dependency com.google.api:api-common to v1.10.4 ([#​385](https://www.github.com/googleapis/java-shared-dependencies/issues/385)) ([5f2b39b](https://www.github.com/googleapis/java-shared-dependencies/commit/5f2b39b5bdc4cec9d5ab2f050e11000ed372d057)) - update dependency com.google.api:gax-grpc to v1.65.1 ([#​382](https://www.github.com/googleapis/java-shared-dependencies/issues/382)) ([a2a1547](https://www.github.com/googleapis/java-shared-dependencies/commit/a2a15471dee21207a0b97b3bc8f6f59d6a4a2d13)) - update dependency com.google.protobuf:protobuf-bom to v3.17.3 ([#​379](https://www.github.com/googleapis/java-shared-dependencies/issues/379)) ([6f43eb5](https://www.github.com/googleapis/java-shared-dependencies/commit/6f43eb553dca98140d343bee3f1003096d79ee6c)) - update dependency io.grpc:grpc-bom to v1.38.1 ([#​386](https://www.github.com/googleapis/java-shared-dependencies/issues/386)) ([7b1d4cf](https://www.github.com/googleapis/java-shared-dependencies/commit/7b1d4cf317fbd75b91d6a63f82b5fc2f46eaf3ca)) - update dependency io.grpc:grpc-bom to v1.39.0 ([#​394](https://www.github.com/googleapis/java-shared-dependencies/issues/394)) ([ebc8af6](https://www.github.com/googleapis/java-shared-dependencies/commit/ebc8af6b3f850b58b35d9720a7a0b1545d4616bd)) - update gax.version to v1.66.0 ([#​395](https://www.github.com/googleapis/java-shared-dependencies/issues/395)) ([c73f73e](https://www.github.com/googleapis/java-shared-dependencies/commit/c73f73e84740a8117be342a66e179eaf3e29c6fd)) - update google.core.version to v1.95.1 ([#​381](https://www.github.com/googleapis/java-shared-dependencies/issues/381)) ([4496153](https://www.github.com/googleapis/java-shared-dependencies/commit/44961532f621b0ab19e9e7feebb7d588aef5d423)) - update google.core.version to v1.95.2 ([#​383](https://www.github.com/googleapis/java-shared-dependencies/issues/383)) ([7216859](https://www.github.com/googleapis/java-shared-dependencies/commit/7216859bcd67fa1ce1119831c33c50a2d5b79324)) - update google.core.version to v1.95.3 ([#​388](https://www.github.com/googleapis/java-shared-dependencies/issues/388)) ([354e4e8](https://www.github.com/googleapis/java-shared-dependencies/commit/354e4e811f4ba886406681a4261ac0455a9eb2d2)) - update google.core.version to v1.95.4 ([#​393](https://www.github.com/googleapis/java-shared-dependencies/issues/393)) ([be78ad8](https://www.github.com/googleapis/java-shared-dependencies/commit/be78ad85e31d8876eabafee7aa8242712573cb46))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.8.0 (#517) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-bom](https://togithub.com/googleapis/java-spanner) | `6.7.0` -> `6.8.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.8.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.8.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.8.0/compatibility-slim/6.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.8.0/confidence-slim/6.7.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-spanner [Compare Source](https://togithub.com/googleapis/java-spanner/compare/v6.7.0...v6.8.0) - add gRPC-GCP channel pool as an option ([#​1227](https://www.github.com/googleapis/java-spanner/issues/1227)) ([1fa95a9](https://www.github.com/googleapis/java-spanner/commit/1fa95a9993ea8c7a5f943ab39eced4ced4cb87e7)) - spanner JSON type ([#​1260](https://www.github.com/googleapis/java-spanner/issues/1260)) ([b2a56c6](https://www.github.com/googleapis/java-spanner/commit/b2a56c68695b6209e20f9f86d83d7c5a0f39c7a8)) - Add `shopt -s nullglob` to dependencies script ([#​1256](https://www.github.com/googleapis/java-spanner/issues/1256)) ([d1712f7](https://www.github.com/googleapis/java-spanner/commit/d1712f7c51752c2359045e5eabac8fc0530a2421))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: release 2.2.4 (#508) :robot: I have created a release \*beep\* \*boop\* --- * Add `shopt -s nullglob` to dependencies script ([#514](https://www.github.com/googleapis/java-spanner-jdbc/issues/514)) ([ae51b24](https://www.github.com/googleapis/java-spanner-jdbc/commit/ae51b241148606ffddeb0a703b853de67710e48b)) * prevent relocating urls that start with com like /computeMetadata/ ([#511](https://www.github.com/googleapis/java-spanner-jdbc/issues/511)) ([1178a1d](https://www.github.com/googleapis/java-spanner-jdbc/commit/1178a1d35b4b0032acf71b3dbf862d4f9fb9399c)) * Update dependencies.sh to not break on mac ([#506](https://www.github.com/googleapis/java-spanner-jdbc/issues/506)) ([e205c0c](https://www.github.com/googleapis/java-spanner-jdbc/commit/e205c0c8eba6ac23d747c433b42d8e2365528bd8)) * update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#518](https://www.github.com/googleapis/java-spanner-jdbc/issues/518)) ([045b858](https://www.github.com/googleapis/java-spanner-jdbc/commit/045b8586a7ca7b0e2bd341b27ca3e8a3530c992a)) * update dependency com.google.cloud:google-cloud-spanner-bom to v6.7.0 ([#513](https://www.github.com/googleapis/java-spanner-jdbc/issues/513)) ([e1affe3](https://www.github.com/googleapis/java-spanner-jdbc/commit/e1affe358a812a45b9d2c0c9ccd0b00e3aa3791e)) * update dependency com.google.cloud:google-cloud-spanner-bom to v6.8.0 ([#517](https://www.github.com/googleapis/java-spanner-jdbc/issues/517)) ([c9013ff](https://www.github.com/googleapis/java-spanner-jdbc/commit/c9013ff48269b158121e4c65c545be30752c31fb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: release 2.2.5-SNAPSHOT (#519) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.9.0 (#521) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-bom](https://togithub.com/googleapis/java-spanner) | `6.8.0` -> `6.9.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.9.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.9.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.9.0/compatibility-slim/6.8.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-bom/6.9.0/confidence-slim/6.8.0)](https://docs.renovatebot.com/merge-confidence/) | ---
googleapis/java-spanner [Compare Source](https://togithub.com/googleapis/java-spanner/compare/v6.8.0...v6.9.0) - add support for tagging to Connection API ([#​623](https://www.github.com/googleapis/java-spanner/issues/623)) ([5722372](https://www.github.com/googleapis/java-spanner/commit/5722372b7869828e372dec06e80e5b0e7280af61)) - **spanner:** add leader_options to InstanceConfig and default_leader to Database ([#​1271](https://www.github.com/googleapis/java-spanner/issues/1271)) ([f257671](https://www.github.com/googleapis/java-spanner/commit/f25767144344f0df67662f1b3ef662902384599a)) - support setting an async executor provider ([#​1263](https://www.github.com/googleapis/java-spanner/issues/1263)) ([369c8a7](https://www.github.com/googleapis/java-spanner/commit/369c8a771ec48fa1476236f800b0e8eb5982a33c)) - update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#​1269](https://www.github.com/googleapis/java-spanner/issues/1269)) ([025e162](https://www.github.com/googleapis/java-spanner/commit/025e162813d6321dabe49e32f00934f9ae334e24))
--- 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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#github/googleapis/java-spanner-jdbc). chore: release 2.2.5 (#522) :robot: I have created a release \*beep\* \*boop\* --- * update dependency com.google.cloud:google-cloud-spanner-bom to v6.9.0 ([#521](https://www.github.com/googleapis/java-spanner-jdbc/issues/521)) ([8d840ac](https://www.github.com/googleapis/java-spanner-jdbc/commit/8d840ac855f4466c1d53a3b38d964e213708e5e5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore: regenerate README (#523) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-07-06 00:20:39,365 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-07-06 00:20:40,571 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata. ```
Full log will be available here: https://source.cloud.google.com/results/invocations/c1ec5162-f264-4d89-804f-4f695017e997/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) chore: release 2.2.6-SNAPSHOT (#524) :robot: I have created a release \*beep\* \*boop\* --- --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). chore(deps): update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.2.4 (#520) deps: update dependency com.google.cloud:google-cloud-spanner-bom to v6.9.1 (#525) chore: regenerate README (#528) This PR was generated using Autosynth. :rainbow:
Log from Synthtool ``` 2021-07-06 01:48:33,450 synthtool [DEBUG] > Executing /root/.cache/synthtool/java-spanner-jdbc/.github/readme/synth.py. On branch autosynth-readme nothing to commit, working tree clean 2021-07-06 01:48:34,668 synthtool [DEBUG] > Wrote metadata to .github/readme/synth.metadata/synth.metadata.… * fix: run linter * fix: integration test failure --- .../spanner/jdbc/AbstractJdbcWrapper.java | 3 + .../google/cloud/spanner/jdbc/JdbcArray.java | 4 + .../cloud/spanner/jdbc/JdbcDataType.java | 26 ++ .../spanner/jdbc/JdbcParameterStore.java | 80 ++++-- .../cloud/spanner/jdbc/JdbcResultSet.java | 17 ++ .../cloud/spanner/jdbc/JdbcTypeConverter.java | 7 +- .../google/cloud/spanner/jdbc/JsonType.java | 55 ++++ .../jdbc/DatabaseMetaData_GetColumns.sql | 3 + .../spanner/jdbc/ITAbstractJdbcTest.java | 10 +- .../cloud/spanner/jdbc/JdbcArrayTest.java | 22 ++ .../spanner/jdbc/JdbcParameterStoreTest.java | 40 ++- .../jdbc/JdbcResultSetMetaDataTest.java | 22 +- .../cloud/spanner/jdbc/JdbcResultSetTest.java | 34 +++ .../spanner/jdbc/JdbcTypeConverterTest.java | 18 ++ .../jdbc/it/ITJdbcDatabaseMetaDataTest.java | 3 + .../jdbc/it/ITJdbcPreparedStatementTest.java | 254 +++++++++++------- .../spanner/jdbc/it/CreateMusicTables.sql | 2 + .../jdbc/it/CreateMusicTables_Emulator.sql | 104 +++++++ 18 files changed, 578 insertions(+), 126 deletions(-) create mode 100644 src/main/java/com/google/cloud/spanner/jdbc/JsonType.java create mode 100644 src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables_Emulator.sql diff --git a/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapper.java b/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapper.java index 9f9752452e..5f29673104 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapper.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/AbstractJdbcWrapper.java @@ -48,6 +48,7 @@ static int extractColumnType(Type type) { if (type.equals(Type.int64())) return Types.BIGINT; if (type.equals(Type.numeric())) return Types.NUMERIC; if (type.equals(Type.string())) return Types.NVARCHAR; + if (type.equals(Type.json())) return Types.NVARCHAR; if (type.equals(Type.timestamp())) return Types.TIMESTAMP; if (type.getCode() == Code.ARRAY) return Types.ARRAY; return Types.OTHER; @@ -106,6 +107,7 @@ static String getClassName(Type type) { if (type == Type.int64()) return Long.class.getName(); if (type == Type.numeric()) return BigDecimal.class.getName(); if (type == Type.string()) return String.class.getName(); + if (type == Type.json()) return String.class.getName(); if (type == Type.timestamp()) return Timestamp.class.getName(); if (type.getCode() == Code.ARRAY) { if (type.getArrayElementType() == Type.bool()) return Boolean[].class.getName(); @@ -115,6 +117,7 @@ static String getClassName(Type type) { if (type.getArrayElementType() == Type.int64()) return Long[].class.getName(); if (type.getArrayElementType() == Type.numeric()) return BigDecimal[].class.getName(); if (type.getArrayElementType() == Type.string()) return String[].class.getName(); + if (type.getArrayElementType() == Type.json()) return String[].class.getName(); if (type.getArrayElementType() == Type.timestamp()) return Timestamp[].class.getName(); } return null; diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcArray.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcArray.java index 2a9d9e7763..4367740509 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcArray.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcArray.java @@ -21,6 +21,7 @@ import com.google.cloud.spanner.Struct; import com.google.cloud.spanner.Type; import com.google.cloud.spanner.Type.StructField; +import com.google.cloud.spanner.Value; import com.google.cloud.spanner.ValueBinder; import com.google.common.collect.ImmutableList; import com.google.rpc.Code; @@ -201,6 +202,9 @@ public ResultSet getResultSet(long startIndex, int count) throws SQLException { case STRING: builder = binder.to((String) value); break; + case JSON: + builder = binder.to(Value.json((String) value)); + break; case TIMESTAMP: builder = binder.to(JdbcTypeConverter.toGoogleTimestamp((Timestamp) value)); break; diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcDataType.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcDataType.java index 6e6c3bf821..8da36e4c4b 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcDataType.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcDataType.java @@ -229,6 +229,32 @@ public Type getSpannerType() { return Type.string(); } }, + JSON { + @Override + public int getSqlType() { + return JsonType.VENDOR_TYPE_NUMBER; + } + + @Override + public Class getJavaClass() { + return String.class; + } + + @Override + public Code getCode() { + return Code.JSON; + } + + @Override + public List getArrayElements(ResultSet rs, int columnIndex) { + return rs.getJsonList(columnIndex); + } + + @Override + public Type getSpannerType() { + return Type.json(); + } + }, TIMESTAMP { @Override public int getSqlType() { diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterStore.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterStore.java index 75f16cd8e1..24773cdced 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterStore.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcParameterStore.java @@ -19,6 +19,7 @@ import com.google.cloud.ByteArray; import com.google.cloud.spanner.Statement; import com.google.cloud.spanner.Statement.Builder; +import com.google.cloud.spanner.Type; import com.google.cloud.spanner.Value; import com.google.cloud.spanner.ValueBinder; import com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory.JdbcSqlExceptionImpl; @@ -264,6 +265,7 @@ private boolean isTypeSupported(int sqlType) { case Types.NCLOB: case Types.NUMERIC: case Types.DECIMAL: + case JsonType.VENDOR_TYPE_NUMBER: return true; } return false; @@ -315,6 +317,11 @@ private boolean isValidTypeAndValue(Object value, int sqlType) { return value instanceof Clob || value instanceof Reader; case Types.NCLOB: return value instanceof NClob || value instanceof Reader; + case JsonType.VENDOR_TYPE_NUMBER: + return value instanceof String + || value instanceof InputStream + || value instanceof Reader + || (value instanceof Value && ((Value) value).getType().getCode() == Type.Code.JSON); } return false; } @@ -544,30 +551,34 @@ private Builder setParamWithKnownType(ValueBinder binder, Object value, case Types.NCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: + String stringValue; if (value instanceof String) { - return binder.to((String) value); + stringValue = (String) value; } else if (value instanceof InputStream) { - InputStreamReader reader = - new InputStreamReader((InputStream) value, StandardCharsets.US_ASCII); - try { - return binder.to(CharStreams.toString(reader)); - } catch (IOException e) { - throw JdbcSqlExceptionFactory.of( - "could not set string from input stream", Code.INVALID_ARGUMENT, e); - } + stringValue = getStringFromInputStream((InputStream) value); } else if (value instanceof Reader) { - try { - return binder.to(CharStreams.toString((Reader) value)); - } catch (IOException e) { - throw JdbcSqlExceptionFactory.of( - "could not set string from reader", Code.INVALID_ARGUMENT, e); - } + stringValue = getStringFromReader((Reader) value); } else if (value instanceof URL) { - return binder.to(((URL) value).toString()); + stringValue = ((URL) value).toString(); } else if (value instanceof UUID) { - return binder.to(((UUID) value).toString()); + stringValue = ((UUID) value).toString(); + } else { + throw JdbcSqlExceptionFactory.of(value + " is not a valid string", Code.INVALID_ARGUMENT); + } + return binder.to(stringValue); + case JsonType.VENDOR_TYPE_NUMBER: + String jsonValue; + if (value instanceof String) { + jsonValue = (String) value; + } else if (value instanceof InputStream) { + jsonValue = getStringFromInputStream((InputStream) value); + } else if (value instanceof Reader) { + jsonValue = getStringFromReader((Reader) value); + } else { + throw JdbcSqlExceptionFactory.of( + value + " is not a valid JSON value", Code.INVALID_ARGUMENT); } - throw JdbcSqlExceptionFactory.of(value + " is not a valid string", Code.INVALID_ARGUMENT); + return binder.to(Value.json(jsonValue)); case Types.DATE: if (value instanceof Date) { return binder.to(JdbcTypeConverter.toGoogleDate((Date) value)); @@ -652,6 +663,25 @@ private Builder setParamWithKnownType(ValueBinder binder, Object value, return null; } + private String getStringFromInputStream(InputStream inputStream) throws SQLException { + InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.US_ASCII); + try { + return CharStreams.toString(reader); + } catch (IOException e) { + throw JdbcSqlExceptionFactory.of( + "could not set string from input stream", Code.INVALID_ARGUMENT, e); + } + } + + private String getStringFromReader(Reader reader) throws SQLException { + try { + return CharStreams.toString(reader); + } catch (IOException e) { + throw JdbcSqlExceptionFactory.of( + "could not set string from reader", Code.INVALID_ARGUMENT, e); + } + } + /** Set the parameter value based purely on the type of the value. */ private Builder setParamWithUnknownType(ValueBinder binder, Object value) throws SQLException { @@ -769,14 +799,16 @@ private Builder setArrayValue(ValueBinder binder, int type, Object valu case Types.LONGNVARCHAR: case Types.CLOB: case Types.NCLOB: - return binder.toStringArray((Iterable) null); + return binder.toStringArray(null); + case JsonType.VENDOR_TYPE_NUMBER: + return binder.toJsonArray(null); case Types.DATE: - return binder.toDateArray((Iterable) null); + return binder.toDateArray(null); case Types.TIME: case Types.TIME_WITH_TIMEZONE: case Types.TIMESTAMP: case Types.TIMESTAMP_WITH_TIMEZONE: - return binder.toTimestampArray((Iterable) null); + return binder.toTimestampArray(null); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: @@ -829,7 +861,11 @@ private Builder setArrayValue(ValueBinder binder, int type, Object valu } else if (Timestamp[].class.isAssignableFrom(value.getClass())) { return binder.toTimestampArray(JdbcTypeConverter.toGoogleTimestamps((Timestamp[]) value)); } else if (String[].class.isAssignableFrom(value.getClass())) { - return binder.toStringArray(Arrays.asList((String[]) value)); + if (type == JsonType.VENDOR_TYPE_NUMBER) { + return binder.toJsonArray(Arrays.asList((String[]) value)); + } else { + return binder.toStringArray(Arrays.asList((String[]) value)); + } } else if (byte[][].class.isAssignableFrom(value.getClass())) { return binder.toBytesArray(JdbcTypeConverter.toGoogleBytes((byte[][]) value)); } diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java index c4ca6b5e22..489c2d27f0 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcResultSet.java @@ -142,6 +142,8 @@ public String getString(int columnIndex) throws SQLException { return isNull ? null : spanner.getBigDecimal(spannerIndex).toString(); case STRING: return isNull ? null : spanner.getString(spannerIndex); + case JSON: + return isNull ? null : spanner.getJson(spannerIndex); case TIMESTAMP: return isNull ? null : spanner.getTimestamp(spannerIndex).toString(); case STRUCT: @@ -169,6 +171,7 @@ public boolean getBoolean(int columnIndex) throws SQLException { case STRING: return isNull ? false : Boolean.valueOf(spanner.getString(spannerIndex)); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -198,6 +201,7 @@ public byte getByte(int columnIndex) throws SQLException { case STRING: return isNull ? (byte) 0 : checkedCastToByte(parseLong(spanner.getString(spannerIndex))); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -227,6 +231,7 @@ public short getShort(int columnIndex) throws SQLException { case STRING: return isNull ? 0 : checkedCastToShort(parseLong(spanner.getString(spannerIndex))); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -256,6 +261,7 @@ public int getInt(int columnIndex) throws SQLException { case STRING: return isNull ? 0 : checkedCastToInt(parseLong(spanner.getString(spannerIndex))); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -283,6 +289,7 @@ public long getLong(int columnIndex) throws SQLException { case STRING: return isNull ? 0L : parseLong(spanner.getString(spannerIndex)); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -310,6 +317,7 @@ public float getFloat(int columnIndex) throws SQLException { case STRING: return isNull ? 0 : checkedCastToFloat(parseDouble(spanner.getString(spannerIndex))); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -337,6 +345,7 @@ public double getDouble(int columnIndex) throws SQLException { case STRING: return isNull ? 0 : parseDouble(spanner.getString(spannerIndex)); case BYTES: + case JSON: case DATE: case STRUCT: case TIMESTAMP: @@ -372,6 +381,7 @@ public Date getDate(int columnIndex) throws SQLException { case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: @@ -396,6 +406,7 @@ public Time getTime(int columnIndex) throws SQLException { case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: @@ -421,6 +432,7 @@ public Timestamp getTimestamp(int columnIndex) throws SQLException { case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: @@ -576,6 +588,7 @@ private Object getObject(Type type, int columnIndex) throws SQLException { if (type == Type.int64()) return getLong(columnIndex); if (type == Type.numeric()) return getBigDecimal(columnIndex); if (type == Type.string()) return getString(columnIndex); + if (type == Type.json()) return getString(columnIndex); if (type == Type.timestamp()) return getTimestamp(columnIndex); if (type.getCode() == Code.ARRAY) return getArray(columnIndex); throw JdbcSqlExceptionFactory.of( @@ -664,6 +677,7 @@ private BigDecimal getBigDecimal(int columnIndex, boolean fixedScale, int scale) e); } case BYTES: + case JSON: case DATE: case TIMESTAMP: case STRUCT: @@ -749,6 +763,7 @@ public Date getDate(int columnIndex, Calendar cal) throws SQLException { case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: @@ -778,6 +793,7 @@ public Time getTime(int columnIndex, Calendar cal) throws SQLException { case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: @@ -810,6 +826,7 @@ public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException case INT64: case NUMERIC: case BYTES: + case JSON: case STRUCT: case ARRAY: default: diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JdbcTypeConverter.java b/src/main/java/com/google/cloud/spanner/jdbc/JdbcTypeConverter.java index 6aa9b48a69..4b2e4f0f71 100644 --- a/src/main/java/com/google/cloud/spanner/jdbc/JdbcTypeConverter.java +++ b/src/main/java/com/google/cloud/spanner/jdbc/JdbcTypeConverter.java @@ -81,7 +81,8 @@ static Object convert(Object value, Type type, Class targetType) throws SQLEx } if (targetType.equals(byte[].class)) { if (type.getCode() == Code.BYTES) return value; - if (type.getCode() == Code.STRING) return ((String) value).getBytes(UTF8); + if (type.getCode() == Code.STRING || type.getCode() == Code.JSON) + return ((String) value).getBytes(UTF8); } if (targetType.equals(Boolean.class)) { if (type.getCode() == Code.BOOL) return value; @@ -186,6 +187,8 @@ private static Value convertToSpannerValue(Object value, Type type) throws SQLEx case TIMESTAMP: return Value.timestampArray( toGoogleTimestamps((java.sql.Timestamp[]) ((java.sql.Array) value).getArray())); + case JSON: + return Value.jsonArray(Arrays.asList((String[]) ((java.sql.Array) value).getArray())); case STRUCT: default: throw JdbcSqlExceptionFactory.of( @@ -207,6 +210,8 @@ private static Value convertToSpannerValue(Object value, Type type) throws SQLEx return Value.string((String) value); case TIMESTAMP: return Value.timestamp(toGoogleTimestamp((java.sql.Timestamp) value)); + case JSON: + return Value.json((String) value); case STRUCT: default: throw JdbcSqlExceptionFactory.of( diff --git a/src/main/java/com/google/cloud/spanner/jdbc/JsonType.java b/src/main/java/com/google/cloud/spanner/jdbc/JsonType.java new file mode 100644 index 0000000000..44af26b6ea --- /dev/null +++ b/src/main/java/com/google/cloud/spanner/jdbc/JsonType.java @@ -0,0 +1,55 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.jdbc; + +import com.google.spanner.v1.TypeCode; +import java.sql.PreparedStatement; +import java.sql.SQLType; + +/** + * Custom SQL type for Spanner JSON data type. This type (or the vendor type number) must be used + * when setting a JSON parameter using {@link PreparedStatement#setObject(int, Object, SQLType)}. + */ +public class JsonType implements SQLType { + public static final JsonType INSTANCE = new JsonType(); + /** + * Spanner does not have any type numbers, but the code values are unique. Add 100,000 to avoid + * conflicts with the type numbers in java.sql.Types. + */ + public static final int VENDOR_TYPE_NUMBER = 100_000 + TypeCode.JSON_VALUE; + + private JsonType() {} + + @Override + public String getName() { + return "JSON"; + } + + @Override + public String getVendor() { + return JsonType.class.getPackage().getName(); + } + + @Override + public Integer getVendorTypeNumber() { + return VENDOR_TYPE_NUMBER; + } + + public String toString() { + return getName(); + } +} diff --git a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetColumns.sql b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetColumns.sql index 69b1f6a8ec..14106ee1e9 100644 --- a/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetColumns.sql +++ b/src/main/resources/com/google/cloud/spanner/jdbc/DatabaseMetaData_GetColumns.sql @@ -24,6 +24,7 @@ SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS TABLE_SCHEM, TABLE_NAME, COLU WHEN SPANNER_TYPE = 'INT64' THEN -5 WHEN SPANNER_TYPE = 'NUMERIC' THEN 2 WHEN SPANNER_TYPE LIKE 'STRING%' THEN -9 + WHEN SPANNER_TYPE = 'JSON' THEN -9 WHEN SPANNER_TYPE = 'TIMESTAMP' THEN 93 END AS DATA_TYPE, SPANNER_TYPE AS TYPE_NAME, @@ -36,6 +37,7 @@ SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS TABLE_SCHEM, TABLE_NAME, COLU WHEN SPANNER_TYPE = 'BOOL' OR SPANNER_TYPE = 'ARRAY' THEN NULL WHEN SPANNER_TYPE = 'DATE' OR SPANNER_TYPE = 'ARRAY' THEN 10 WHEN SPANNER_TYPE = 'TIMESTAMP' OR SPANNER_TYPE = 'ARRAY' THEN 35 + WHEN SPANNER_TYPE = 'JSON' OR SPANNER_TYPE = 'ARRAY' THEN 2621440 ELSE 0 END ELSE CAST(REPLACE(SUBSTR(SPANNER_TYPE, STRPOS(SPANNER_TYPE, '(')+1, STRPOS(SPANNER_TYPE, ')')-STRPOS(SPANNER_TYPE, '(')-1), 'MAX', CASE WHEN UPPER(SPANNER_TYPE) LIKE '%STRING%' THEN '2621440' ELSE '10485760' END) AS INT64) @@ -63,6 +65,7 @@ SELECT TABLE_CATALOG AS TABLE_CAT, TABLE_SCHEMA AS TABLE_SCHEM, TABLE_NAME, COLU CASE WHEN (SPANNER_TYPE LIKE 'STRING%' OR SPANNER_TYPE LIKE 'ARRAY getAllTypes() { types.add(Type.float64()); types.add(Type.int64()); types.add(Type.string()); + types.add(Type.json()); types.add(Type.timestamp()); List arrayTypes = new ArrayList<>(); for (Type type : types) { @@ -219,6 +221,7 @@ private Value getDefaultValue(Type type, int row) { if (type == Type.float64()) return Value.float64(123.45D); if (type == Type.int64()) return Value.int64(12345L); if (type == Type.string()) return Value.string("test value " + row); + if (type == Type.json()) return Value.json("{\"test_value\": " + row + "}"); if (type == Type.timestamp()) return Value.timestamp(com.google.cloud.Timestamp.now()); if (type.getCode() == Code.ARRAY) { @@ -240,6 +243,9 @@ private Value getDefaultValue(Type type, int row) { return Value.int64Array(Arrays.asList(12345L, 54321L)); if (type.getArrayElementType() == Type.string()) return Value.stringArray(Arrays.asList("test value " + row, "test value " + row)); + if (type.getArrayElementType() == Type.json()) + return Value.jsonArray( + Arrays.asList("{\"test_value\": " + row + "}", "{\"test_value\": " + row + "}")); if (type.getArrayElementType() == Type.timestamp()) return Value.timestampArray( Arrays.asList(com.google.cloud.Timestamp.now(), com.google.cloud.Timestamp.now())); @@ -263,7 +269,9 @@ public void testIsAutoIncrement() throws SQLException { public void testIsCaseSensitive() throws SQLException { for (int i = 1; i <= TEST_COLUMNS.size(); i++) { Type type = TEST_COLUMNS.get(i - 1).type; - assertEquals(type == Type.string() || type == Type.bytes(), subject.isCaseSensitive(i)); + assertEquals( + type == Type.string() || type == Type.bytes() || type == Type.json(), + subject.isCaseSensitive(i)); } } @@ -319,6 +327,7 @@ private int getDefaultDisplaySize(Type type, int column) throws SQLException { int length = subject.getPrecision(column); return length == 0 ? 50 : length; } + if (type == Type.json()) return 50; if (type == Type.timestamp()) return 16; return 10; } @@ -397,6 +406,7 @@ private int getSqlType(Type type) { if (type == Type.float64()) return Types.DOUBLE; if (type == Type.int64()) return Types.BIGINT; if (type == Type.string()) return Types.NVARCHAR; + if (type == Type.json()) return Types.NVARCHAR; if (type == Type.timestamp()) return Types.TIMESTAMP; if (type.getCode() == Code.ARRAY) return Types.ARRAY; return Types.OTHER; @@ -446,6 +456,7 @@ private String getTypeClassName(Type type) { if (type == Type.float64()) return Double.class.getName(); if (type == Type.int64()) return Long.class.getName(); if (type == Type.string()) return String.class.getName(); + if (type == Type.json()) return String.class.getName(); if (type == Type.timestamp()) return Timestamp.class.getName(); if (type.getCode() == Code.ARRAY) { if (type.getArrayElementType() == Type.bool()) return Boolean[].class.getName(); @@ -454,6 +465,7 @@ private String getTypeClassName(Type type) { if (type.getArrayElementType() == Type.float64()) return Double[].class.getName(); if (type.getArrayElementType() == Type.int64()) return Long[].class.getName(); if (type.getArrayElementType() == Type.string()) return String[].class.getName(); + if (type.getArrayElementType() == Type.json()) return String[].class.getName(); if (type.getArrayElementType() == Type.timestamp()) return Timestamp[].class.getName(); } return null; @@ -466,15 +478,17 @@ private String getTypeClassName(Type type) { + "Col 4: COL4 FLOAT64\n" + "Col 5: COL5 INT64\n" + "Col 6: COL6 STRING\n" - + "Col 7: COL7 TIMESTAMP\n" - + "Col 8: COL8 ARRAY\n" + + "Col 7: COL7 JSON\n" + + "Col 8: COL8 TIMESTAMP\n" + "Col 9: COL9 ARRAY\n" + "Col 10: COL10 ARRAY\n" + "Col 11: COL11 ARRAY\n" + "Col 12: COL12 ARRAY\n" + "Col 13: COL13 ARRAY\n" + "Col 14: COL14 ARRAY\n" - + "Col 15: CALCULATED INT64\n"; + + "Col 15: COL15 ARRAY\n" + + "Col 16: COL16 ARRAY\n" + + "Col 17: CALCULATED INT64\n"; @Test public void testToString() { diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java index 9fa5f3e9c9..506992c473 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcResultSetTest.java @@ -132,6 +132,11 @@ public class JdbcResultSetTest { private static final BigDecimal NUMERIC_VALUE = new BigDecimal("3.14"); private static final int NUMERIC_COLINDEX_NULL = 25; private static final int NUMERIC_COLINDEX_NOTNULL = 26; + private static final String JSON_COL_NULL = "JSON_COL_NULL"; + private static final String JSON_COL_NOT_NULL = "JSON_COL_NOT_NULL"; + private static final int JSON_COLINDEX_NULL = 27; + private static final int JSON_COLINDEX_NOT_NULL = 28; + private static final String JSON_VALUE = "{\"name\":\"John\", \"age\":30, \"car\":null}"; private static final String BOOL_ARRAY_COL = "BOOL_ARRAY"; private static final List BOOL_ARRAY_VALUE = Arrays.asList(true, null, false); @@ -149,6 +154,8 @@ public class JdbcResultSetTest { private static final List STRING_ARRAY_VALUE = Arrays.asList(STRING_VALUE, null); private static final String TIMESTAMP_ARRAY_COL = "TIMESTAMP_ARRAY"; private static final List TIMESTAMP_ARRAY_VALUE = Arrays.asList(TIMESTAMP_VALUE, null); + private static final String JSON_ARRAY_COL = "JSON_ARRAY"; + private static final List JSON_ARRAY_VALUE = Arrays.asList(JSON_VALUE, null); private JdbcResultSet subject; @@ -181,12 +188,15 @@ static ResultSet getMockResultSet() { StructField.of(STRING_COL_TIME, Type.string()), StructField.of(NUMERIC_COL_NULL, Type.numeric()), StructField.of(NUMERIC_COL_NOT_NULL, Type.numeric()), + StructField.of(JSON_COL_NULL, Type.json()), + StructField.of(JSON_COL_NOT_NULL, Type.json()), StructField.of(BOOL_ARRAY_COL, Type.array(Type.bool())), StructField.of(BYTES_ARRAY_COL, Type.array(Type.bytes())), StructField.of(DATE_ARRAY_COL, Type.array(Type.date())), StructField.of(FLOAT64_ARRAY_COL, Type.array(Type.float64())), StructField.of(INT64_ARRAY_COL, Type.array(Type.int64())), StructField.of(NUMERIC_ARRAY_COL, Type.array(Type.numeric())), + StructField.of(JSON_ARRAY_COL, Type.array(Type.json())), StructField.of(STRING_ARRAY_COL, Type.array(Type.string())), StructField.of(TIMESTAMP_ARRAY_COL, Type.array(Type.timestamp()))), Arrays.asList( @@ -243,6 +253,10 @@ static ResultSet getMockResultSet() { .to((BigDecimal) null) .set(NUMERIC_COL_NOT_NULL) .to(NUMERIC_VALUE) + .set(JSON_COL_NULL) + .to(Value.json(null)) + .set(JSON_COL_NOT_NULL) + .to(Value.json(JSON_VALUE)) .set(BOOL_ARRAY_COL) .toBoolArray(BOOL_ARRAY_VALUE) .set(BYTES_ARRAY_COL) @@ -255,6 +269,8 @@ static ResultSet getMockResultSet() { .toInt64Array(INT64_ARRAY_VALUE) .set(NUMERIC_ARRAY_COL) .toNumericArray(NUMERIC_ARRAY_VALUE) + .set(JSON_ARRAY_COL) + .toJsonArray(JSON_ARRAY_VALUE) .set(STRING_ARRAY_COL) .toStringArray(STRING_ARRAY_VALUE) .set(TIMESTAMP_ARRAY_COL) @@ -322,6 +338,15 @@ public void testGetStringIndex() throws SQLException { assertTrue(subject.wasNull()); } + @Test + public void testGetJsonIndex() throws SQLException { + assertNotNull(subject.getString(JSON_COLINDEX_NOT_NULL)); + assertEquals(JSON_VALUE, subject.getString(JSON_COLINDEX_NOT_NULL)); + assertFalse(subject.wasNull()); + assertNull(subject.getString(JSON_COLINDEX_NULL)); + assertTrue(subject.wasNull()); + } + @Test public void testGetStringIndexForBool() throws SQLException { assertNotNull(subject.getString(BOOLEAN_COLINDEX_NOTNULL)); @@ -1344,6 +1369,15 @@ public void testGetObjectIndex() throws SQLException { assertTrue(subject.wasNull()); } + @Test + public void testGetJsonAsObjectIndex() throws SQLException { + assertNotNull(subject.getObject(JSON_COLINDEX_NOT_NULL)); + assertEquals(JSON_VALUE, subject.getObject(JSON_COLINDEX_NOT_NULL)); + assertFalse(subject.wasNull()); + assertNull(subject.getObject(JSON_COLINDEX_NULL)); + assertTrue(subject.wasNull()); + } + @SuppressWarnings("deprecation") @Test public void testGetObjectLabelMap() throws SQLException { diff --git a/src/test/java/com/google/cloud/spanner/jdbc/JdbcTypeConverterTest.java b/src/test/java/com/google/cloud/spanner/jdbc/JdbcTypeConverterTest.java index 19f760bb6b..1bb0e374ed 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/JdbcTypeConverterTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/JdbcTypeConverterTest.java @@ -70,6 +70,7 @@ public void testConvertArray() throws SQLException { Type.float64(), Type.int64(), Type.string(), + Type.json(), Type.timestamp(), Type.numeric() }) { @@ -126,6 +127,23 @@ public void testConvertBytes() throws SQLException { assertThat(convert(testValues, Type.bytes(), String.class)).isEqualTo("test"); } + @Test + public void testConvertJson() throws SQLException { + String testValue = "{\"test\": foo}"; + assertConvertThrows(testValue, Type.json(), Boolean.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Byte.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Short.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Integer.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Long.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Float.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), Double.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), BigInteger.class, Code.INVALID_ARGUMENT); + assertConvertThrows(testValue, Type.json(), BigDecimal.class, Code.INVALID_ARGUMENT); + + assertThat(convert(testValue, Type.json(), byte[].class)).isEqualTo(testValue.getBytes(UTF8)); + assertThat(convert(testValue, Type.json(), String.class)).isEqualTo(testValue); + } + private TimeZone[] getTestTimeZones() { return new TimeZone[] { TimeZone.getTimeZone("GMT-12:00"), diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java index 755539987f..087d688fc1 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcDatabaseMetaDataTest.java @@ -122,6 +122,7 @@ private Column( new Column("ColTimestamp", Types.TIMESTAMP, "TIMESTAMP", 35, null, null, false, null), new Column("ColCommitTS", Types.TIMESTAMP, "TIMESTAMP", 35, null, null, false, null), new Column("ColNumeric", Types.NUMERIC, "NUMERIC", 15, null, 10, false, null), + new Column("ColJson", Types.NVARCHAR, "JSON", 2621440, null, null, false, 2621440), new Column("ColInt64Array", Types.ARRAY, "ARRAY", 19, null, 10, true, null), new Column("ColFloat64Array", Types.ARRAY, "ARRAY", 15, 16, 2, true, null), new Column("ColBoolArray", Types.ARRAY, "ARRAY", null, null, null, true, null), @@ -151,6 +152,8 @@ private Column( new Column( "ColTimestampArray", Types.ARRAY, "ARRAY", 35, null, null, true, null), new Column("ColNumericArray", Types.ARRAY, "ARRAY", 15, null, 10, true, null), + new Column( + "ColJsonArray", Types.ARRAY, "ARRAY", 2621440, null, null, true, 2621440), new Column( "ColComputed", Types.NVARCHAR, diff --git a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPreparedStatementTest.java b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPreparedStatementTest.java index d52e560253..ea1bbfb328 100644 --- a/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPreparedStatementTest.java +++ b/src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcPreparedStatementTest.java @@ -30,6 +30,8 @@ import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.Value; import com.google.cloud.spanner.jdbc.ITAbstractJdbcTest; +import com.google.cloud.spanner.jdbc.JsonType; +import com.google.cloud.spanner.testing.EmulatorSpannerHelper; import com.google.common.base.Strings; import com.google.common.io.BaseEncoding; import java.io.File; @@ -748,84 +750,113 @@ public void test07_StatementBatchUpdateWithException() throws SQLException { @Test public void test08_InsertAllColumnTypes() throws SQLException { + String sql; + if (EmulatorSpannerHelper.isUsingEmulator()) { + sql = + "INSERT INTO TableWithAllColumnTypes (" + + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, " + + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray" + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + } else { + sql = + "INSERT INTO TableWithAllColumnTypes (" + + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, " + + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray" + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + } try (Connection con = createConnection()) { - try (PreparedStatement ps = - con.prepareStatement( - "INSERT INTO TableWithAllColumnTypes (" - + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, " - + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray" - + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { - ps.setLong(1, 1L); - ps.setDouble(2, 2D); - ps.setBoolean(3, true); - ps.setString(4, "test"); - ps.setObject(5, UUID.fromString("2d37f522-e0a5-4f22-8e09-4d77d299c967")); - ps.setBytes(6, "test".getBytes()); - ps.setBytes(7, "testtest".getBytes()); - ps.setDate(8, new Date(System.currentTimeMillis())); - ps.setTimestamp(9, new Timestamp(System.currentTimeMillis())); - ps.setBigDecimal(10, BigDecimal.TEN); - ps.setArray(11, con.createArrayOf("INT64", new Long[] {1L, 2L, 3L})); - ps.setArray(12, con.createArrayOf("FLOAT64", new Double[] {1.1D, 2.2D, 3.3D})); + try (PreparedStatement ps = con.prepareStatement(sql)) { + int index = 0; + ps.setLong(++index, 1L); + ps.setDouble(++index, 2D); + ps.setBoolean(++index, true); + ps.setString(++index, "test"); + ps.setObject(++index, UUID.fromString("2d37f522-e0a5-4f22-8e09-4d77d299c967")); + ps.setBytes(++index, "test".getBytes()); + ps.setBytes(++index, "testtest".getBytes()); + ps.setDate(++index, new Date(System.currentTimeMillis())); + ps.setTimestamp(++index, new Timestamp(System.currentTimeMillis())); + ps.setBigDecimal(++index, BigDecimal.TEN); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + ps.setObject(++index, "{\"test_value\": \"foo\"}", JsonType.INSTANCE); + } + ps.setArray(++index, con.createArrayOf("INT64", new Long[] {1L, 2L, 3L})); + ps.setArray(++index, con.createArrayOf("FLOAT64", new Double[] {1.1D, 2.2D, 3.3D})); ps.setArray( - 13, con.createArrayOf("BOOL", new Boolean[] {Boolean.TRUE, null, Boolean.FALSE})); - ps.setArray(14, con.createArrayOf("STRING", new String[] {"1", "2", "3"})); - ps.setArray(15, con.createArrayOf("STRING", new String[] {"3", "2", "1"})); + ++index, con.createArrayOf("BOOL", new Boolean[] {Boolean.TRUE, null, Boolean.FALSE})); + ps.setArray(++index, con.createArrayOf("STRING", new String[] {"1", "2", "3"})); + ps.setArray(++index, con.createArrayOf("STRING", new String[] {"3", "2", "1"})); ps.setArray( - 16, + ++index, con.createArrayOf( "BYTES", new byte[][] {"1".getBytes(), "2".getBytes(), "3".getBytes()})); ps.setArray( - 17, + ++index, con.createArrayOf( "BYTES", new byte[][] {"333".getBytes(), "222".getBytes(), "111".getBytes()})); ps.setArray( - 18, + ++index, con.createArrayOf( "DATE", new Date[] {new Date(System.currentTimeMillis()), null, new Date(0)})); ps.setArray( - 19, + ++index, con.createArrayOf( "TIMESTAMP", new Timestamp[] { new Timestamp(System.currentTimeMillis()), null, new Timestamp(0) })); ps.setArray( - 20, + ++index, con.createArrayOf("NUMERIC", new BigDecimal[] {BigDecimal.ONE, null, BigDecimal.TEN})); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + ps.setArray( + ++index, + con.createArrayOf( + "JSON", new String[] {"{\"test_value\": \"foo\"}", "{}", "[]", null})); + } assertEquals(1, ps.executeUpdate()); } try (ResultSet rs = con.createStatement().executeQuery("SELECT * FROM TableWithAllColumnTypes")) { + int index = 0; assertTrue(rs.next()); - assertEquals(1L, rs.getLong(1)); - assertEquals(2d, rs.getDouble(2), 0.0d); - assertTrue(rs.getBoolean(3)); - assertEquals("test", rs.getString(4)); - assertEquals("2d37f522-e0a5-4f22-8e09-4d77d299c967", rs.getString(5)); - assertArrayEquals("test".getBytes(), rs.getBytes(6)); - assertArrayEquals("testtest".getBytes(), rs.getBytes(7)); - assertNotNull(rs.getDate(8)); - assertNotNull(rs.getTimestamp(9)); - assertNotNull(rs.getTime(10)); // Commit timestamp - assertEquals(BigDecimal.TEN, rs.getBigDecimal(11)); - assertArrayEquals(new Long[] {1L, 2L, 3L}, (Long[]) rs.getArray(12).getArray()); - assertArrayEquals(new Double[] {1.1D, 2.2D, 3.3D}, (Double[]) rs.getArray(13).getArray()); + assertEquals(1L, rs.getLong(++index)); + assertEquals(2d, rs.getDouble(++index), 0.0d); + assertTrue(rs.getBoolean(++index)); + assertEquals("test", rs.getString(++index)); + assertEquals("2d37f522-e0a5-4f22-8e09-4d77d299c967", rs.getString(++index)); + assertArrayEquals("test".getBytes(), rs.getBytes(++index)); + assertArrayEquals("testtest".getBytes(), rs.getBytes(++index)); + assertNotNull(rs.getDate(++index)); + assertNotNull(rs.getTimestamp(++index)); + assertNotNull(rs.getTime(++index)); // Commit timestamp + assertEquals(BigDecimal.TEN, rs.getBigDecimal(++index)); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + assertEquals("{\"test_value\":\"foo\"}", rs.getString(++index)); + } + assertArrayEquals(new Long[] {1L, 2L, 3L}, (Long[]) rs.getArray(++index).getArray()); + assertArrayEquals( + new Double[] {1.1D, 2.2D, 3.3D}, (Double[]) rs.getArray(++index).getArray()); assertArrayEquals( - new Boolean[] {true, null, false}, (Boolean[]) rs.getArray(14).getArray()); - assertArrayEquals(new String[] {"1", "2", "3"}, (String[]) rs.getArray(15).getArray()); - assertArrayEquals(new String[] {"3", "2", "1"}, (String[]) rs.getArray(16).getArray()); + new Boolean[] {true, null, false}, (Boolean[]) rs.getArray(++index).getArray()); + assertArrayEquals(new String[] {"1", "2", "3"}, (String[]) rs.getArray(++index).getArray()); + assertArrayEquals(new String[] {"3", "2", "1"}, (String[]) rs.getArray(++index).getArray()); assertArrayEquals( new byte[][] {"1".getBytes(), "2".getBytes(), "3".getBytes()}, - (byte[][]) rs.getArray(17).getArray()); + (byte[][]) rs.getArray(++index).getArray()); assertArrayEquals( new byte[][] {"333".getBytes(), "222".getBytes(), "111".getBytes()}, - (byte[][]) rs.getArray(18).getArray()); - assertEquals(3, ((Date[]) rs.getArray(19).getArray()).length); - assertEquals(3, ((Timestamp[]) rs.getArray(20).getArray()).length); + (byte[][]) rs.getArray(++index).getArray()); + assertEquals(3, ((Date[]) rs.getArray(++index).getArray()).length); + assertEquals(3, ((Timestamp[]) rs.getArray(++index).getArray()).length); assertArrayEquals( new BigDecimal[] {BigDecimal.ONE, null, BigDecimal.TEN}, - (BigDecimal[]) rs.getArray(21).getArray()); + (BigDecimal[]) rs.getArray(++index).getArray()); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + assertArrayEquals( + new String[] {"{\"test_value\":\"foo\"}", "{}", "[]", null}, + (String[]) rs.getArray(++index).getArray()); + } assertFalse(rs.next()); } } @@ -838,7 +869,7 @@ public void test09_MetaData_FromQuery() throws SQLException { try (PreparedStatement ps = con.prepareStatement("SELECT * FROM TableWithAllColumnTypes WHERE ColInt64=?")) { ResultSetMetaData metadata = ps.getMetaData(); - assertEquals(22, metadata.getColumnCount()); + assertEquals(24, metadata.getColumnCount()); int index = 0; assertEquals("ColInt64", metadata.getColumnLabel(++index)); assertEquals("ColFloat64", metadata.getColumnLabel(++index)); @@ -851,6 +882,7 @@ public void test09_MetaData_FromQuery() throws SQLException { assertEquals("ColTimestamp", metadata.getColumnLabel(++index)); assertEquals("ColCommitTS", metadata.getColumnLabel(++index)); assertEquals("ColNumeric", metadata.getColumnLabel(++index)); + assertEquals("ColJson", metadata.getColumnLabel(++index)); assertEquals("ColInt64Array", metadata.getColumnLabel(++index)); assertEquals("ColFloat64Array", metadata.getColumnLabel(++index)); assertEquals("ColBoolArray", metadata.getColumnLabel(++index)); @@ -861,6 +893,7 @@ public void test09_MetaData_FromQuery() throws SQLException { assertEquals("ColDateArray", metadata.getColumnLabel(++index)); assertEquals("ColTimestampArray", metadata.getColumnLabel(++index)); assertEquals("ColNumericArray", metadata.getColumnLabel(++index)); + assertEquals("ColJsonArray", metadata.getColumnLabel(++index)); assertEquals("ColComputed", metadata.getColumnLabel(++index)); } } @@ -880,104 +913,135 @@ public void test10_MetaData_FromDML() throws SQLException { @Test public void test11_InsertDataUsingSpannerValue() throws SQLException { + String sql; + if (EmulatorSpannerHelper.isUsingEmulator()) { + sql = + "INSERT INTO TableWithAllColumnTypes (" + + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, " + + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray" + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + } else { + sql = + "INSERT INTO TableWithAllColumnTypes (" + + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, " + + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray" + + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + } try (Connection con = createConnection()) { - try (PreparedStatement ps = - con.prepareStatement( - "INSERT INTO TableWithAllColumnTypes (" - + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, " - + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray" - + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) { - ps.setObject(1, Value.int64(2L)); - ps.setObject(2, Value.float64(2D)); - ps.setObject(3, Value.bool(true)); - ps.setObject(4, Value.string("testvalues")); - ps.setObject(5, Value.string("2d37f522-e0a5-4f22-8e09-4d77d299c967")); - ps.setObject(6, Value.bytes(ByteArray.copyFrom("test".getBytes()))); - ps.setObject(7, Value.bytes(ByteArray.copyFrom("testtest".getBytes()))); - ps.setObject(8, Value.date(com.google.cloud.Date.fromYearMonthDay(2021, 5, 3))); + try (PreparedStatement ps = con.prepareStatement(sql)) { + int index = 1; + ps.setObject(index++, Value.int64(2L)); + ps.setObject(index++, Value.float64(2D)); + ps.setObject(index++, Value.bool(true)); + ps.setObject(index++, Value.string("testvalues")); + ps.setObject(index++, Value.string("2d37f522-e0a5-4f22-8e09-4d77d299c967")); + ps.setObject(index++, Value.bytes(ByteArray.copyFrom("test".getBytes()))); + ps.setObject(index++, Value.bytes(ByteArray.copyFrom("testtest".getBytes()))); + ps.setObject(index++, Value.date(com.google.cloud.Date.fromYearMonthDay(2021, 5, 3))); ps.setObject( - 9, Value.timestamp(com.google.cloud.Timestamp.ofTimeSecondsAndNanos(99999L, 99))); - ps.setObject(10, Value.numeric(BigDecimal.TEN)); - ps.setObject(11, Value.int64Array(new long[] {1L, 2L, 3L})); - ps.setObject(12, Value.float64Array(new double[] {1.1D, 2.2D, 3.3D})); - ps.setObject(13, Value.boolArray(Arrays.asList(Boolean.TRUE, null, Boolean.FALSE))); - ps.setObject(14, Value.stringArray(Arrays.asList("1", "2", "3"))); - ps.setObject(15, Value.stringArray(Arrays.asList("3", "2", "1"))); + index++, Value.timestamp(com.google.cloud.Timestamp.ofTimeSecondsAndNanos(99999L, 99))); + ps.setObject(index++, Value.numeric(BigDecimal.TEN)); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + ps.setObject(index++, Value.json("{\"test_value\": \"foo\"}")); + } + ps.setObject(index++, Value.int64Array(new long[] {1L, 2L, 3L})); + ps.setObject(index++, Value.float64Array(new double[] {1.1D, 2.2D, 3.3D})); + ps.setObject(index++, Value.boolArray(Arrays.asList(Boolean.TRUE, null, Boolean.FALSE))); + ps.setObject(index++, Value.stringArray(Arrays.asList("1", "2", "3"))); + ps.setObject(index++, Value.stringArray(Arrays.asList("3", "2", "1"))); ps.setObject( - 16, + index++, Value.bytesArray( Arrays.asList( ByteArray.copyFrom("1"), ByteArray.copyFrom("2"), ByteArray.copyFrom("3")))); ps.setObject( - 17, + index++, Value.bytesArray( Arrays.asList( ByteArray.copyFrom("333"), ByteArray.copyFrom("222"), ByteArray.copyFrom("111")))); ps.setObject( - 18, + index++, Value.dateArray( Arrays.asList(com.google.cloud.Date.fromYearMonthDay(2021, 5, 3), null))); ps.setObject( - 19, + index++, Value.timestampArray( Arrays.asList(com.google.cloud.Timestamp.ofTimeSecondsAndNanos(99999L, 99), null))); - ps.setObject(20, Value.numericArray(Arrays.asList(BigDecimal.ONE, null, BigDecimal.TEN))); + ps.setObject( + index++, Value.numericArray(Arrays.asList(BigDecimal.ONE, null, BigDecimal.TEN))); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + ps.setObject( + index++, + Value.jsonArray(Arrays.asList("{\"key1\": \"val1\"}", null, "{\"key2\": \"val2\"}"))); + } assertEquals(1, ps.executeUpdate()); } try (ResultSet rs = con.createStatement() .executeQuery("SELECT * FROM TableWithAllColumnTypes WHERE ColInt64=2")) { assertTrue(rs.next()); - assertEquals(Value.int64(2L), rs.getObject(1, Value.class)); - assertEquals(Value.float64(2d), rs.getObject(2, Value.class)); - assertEquals(Value.bool(true), rs.getObject(3, Value.class)); - assertEquals(Value.string("testvalues"), rs.getObject(4, Value.class)); + int index = 1; + assertEquals(Value.int64(2L), rs.getObject(index++, Value.class)); + assertEquals(Value.float64(2d), rs.getObject(index++, Value.class)); + assertEquals(Value.bool(true), rs.getObject(index++, Value.class)); + assertEquals(Value.string("testvalues"), rs.getObject(index++, Value.class)); + assertEquals( + Value.string("2d37f522-e0a5-4f22-8e09-4d77d299c967"), + rs.getObject(index++, Value.class)); + assertEquals(Value.bytes(ByteArray.copyFrom("test")), rs.getObject(index++, Value.class)); assertEquals( - Value.string("2d37f522-e0a5-4f22-8e09-4d77d299c967"), rs.getObject(5, Value.class)); - assertEquals(Value.bytes(ByteArray.copyFrom("test")), rs.getObject(6, Value.class)); - assertEquals(Value.bytes(ByteArray.copyFrom("testtest")), rs.getObject(7, Value.class)); + Value.bytes(ByteArray.copyFrom("testtest")), rs.getObject(index++, Value.class)); assertEquals( Value.date(com.google.cloud.Date.fromYearMonthDay(2021, 5, 3)), - rs.getObject(8, Value.class)); + rs.getObject(index++, Value.class)); assertEquals( Value.timestamp(com.google.cloud.Timestamp.ofTimeSecondsAndNanos(99999L, 99)), - rs.getObject(9, Value.class)); - assertNotNull(rs.getObject(10, Value.class)); // Commit timestamp - assertEquals(Value.numeric(BigDecimal.TEN), rs.getObject(11, Value.class)); - assertEquals(Value.int64Array(new long[] {1L, 2L, 3L}), rs.getObject(12, Value.class)); + rs.getObject(index++, Value.class)); + assertNotNull(rs.getObject(index++, Value.class)); // Commit timestamp + assertEquals(Value.numeric(BigDecimal.TEN), rs.getObject(index++, Value.class)); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + assertEquals(Value.json("{\"test_value\":\"foo\"}"), rs.getObject(index++, Value.class)); + } + assertEquals(Value.int64Array(new long[] {1L, 2L, 3L}), rs.getObject(index++, Value.class)); assertEquals( - Value.float64Array(new double[] {1.1D, 2.2D, 3.3D}), rs.getObject(13, Value.class)); + Value.float64Array(new double[] {1.1D, 2.2D, 3.3D}), + rs.getObject(index++, Value.class)); assertEquals( - Value.boolArray(Arrays.asList(true, null, false)), rs.getObject(14, Value.class)); + Value.boolArray(Arrays.asList(true, null, false)), rs.getObject(index++, Value.class)); assertEquals( - Value.stringArray(Arrays.asList("1", "2", "3")), rs.getObject(15, Value.class)); + Value.stringArray(Arrays.asList("1", "2", "3")), rs.getObject(index++, Value.class)); assertEquals( - Value.stringArray(Arrays.asList("3", "2", "1")), rs.getObject(16, Value.class)); + Value.stringArray(Arrays.asList("3", "2", "1")), rs.getObject(index++, Value.class)); assertEquals( Value.bytesArray( Arrays.asList( ByteArray.copyFrom("1"), ByteArray.copyFrom("2"), ByteArray.copyFrom("3"))), - rs.getObject(17, Value.class)); + rs.getObject(index++, Value.class)); assertEquals( Value.bytesArray( Arrays.asList( ByteArray.copyFrom("333"), ByteArray.copyFrom("222"), ByteArray.copyFrom("111"))), - rs.getObject(18, Value.class)); + rs.getObject(index++, Value.class)); assertEquals( Value.dateArray( Arrays.asList(com.google.cloud.Date.fromYearMonthDay(2021, 5, 3), null)), - rs.getObject(19, Value.class)); + rs.getObject(index++, Value.class)); assertEquals( Value.timestampArray( Arrays.asList(com.google.cloud.Timestamp.ofTimeSecondsAndNanos(99999L, 99), null)), - rs.getObject(20, Value.class)); + rs.getObject(index++, Value.class)); assertEquals( Value.numericArray(Arrays.asList(BigDecimal.ONE, null, BigDecimal.TEN)), - rs.getObject(21, Value.class)); + rs.getObject(index++, Value.class)); + if (!EmulatorSpannerHelper.isUsingEmulator()) { + assertEquals( + Value.jsonArray(Arrays.asList("{\"key1\":\"val1\"}", null, "{\"key2\":\"val2\"}")), + rs.getObject(index++, Value.class)); + } assertFalse(rs.next()); } } diff --git a/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql index 6a8c4616d1..9b2cb3bad0 100644 --- a/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql +++ b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables.sql @@ -74,6 +74,7 @@ CREATE TABLE TableWithAllColumnTypes ( ColTimestamp TIMESTAMP NOT NULL, ColCommitTS TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true), ColNumeric NUMERIC NOT NULL, + ColJson JSON NOT NULL, ColInt64Array ARRAY, ColFloat64Array ARRAY, @@ -85,6 +86,7 @@ CREATE TABLE TableWithAllColumnTypes ( ColDateArray ARRAY, ColTimestampArray ARRAY, ColNumericArray ARRAY, + ColJsonArray ARRAY, ColComputed STRING(MAX) AS (CONCAT(COALESCE(ColString, ''), ' ', COALESCE(ColStringMax, ''))) STORED, ) PRIMARY KEY (ColInt64) diff --git a/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables_Emulator.sql b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables_Emulator.sql new file mode 100644 index 0000000000..d1e73bba20 --- /dev/null +++ b/src/test/resources/com/google/cloud/spanner/jdbc/it/CreateMusicTables_Emulator.sql @@ -0,0 +1,104 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +START BATCH DDL; + +CREATE TABLE Singers ( + SingerId INT64 NOT NULL, + FirstName STRING(1024), + LastName STRING(1024), + SingerInfo BYTES(MAX), + BirthDate DATE +) PRIMARY KEY(SingerId); + +CREATE INDEX SingersByFirstLastName ON Singers(FirstName, LastName); + +CREATE TABLE Albums ( + SingerId INT64 NOT NULL, + AlbumId INT64 NOT NULL, + AlbumTitle STRING(MAX), + MarketingBudget INT64 +) PRIMARY KEY(SingerId, AlbumId), + INTERLEAVE IN PARENT Singers ON DELETE CASCADE; + +CREATE INDEX AlbumsByAlbumTitle ON Albums(AlbumTitle); + +CREATE INDEX AlbumsByAlbumTitle2 ON Albums(AlbumTitle) STORING (MarketingBudget); + +CREATE TABLE Songs ( + SingerId INT64 NOT NULL, + AlbumId INT64 NOT NULL, + TrackId INT64 NOT NULL, + SongName STRING(MAX), + Duration INT64, + SongGenre STRING(25) +) PRIMARY KEY(SingerId, AlbumId, TrackId), + INTERLEAVE IN PARENT Albums ON DELETE CASCADE; + +CREATE UNIQUE INDEX SongsBySingerAlbumSongNameDesc ON Songs(SingerId, AlbumId, SongName DESC), INTERLEAVE IN Albums; + +CREATE INDEX SongsBySongName ON Songs(SongName); + +CREATE TABLE Concerts ( + VenueId INT64 NOT NULL, + SingerId INT64 NOT NULL, + ConcertDate DATE NOT NULL, + BeginTime TIMESTAMP, + EndTime TIMESTAMP, + TicketPrices ARRAY, + CONSTRAINT Fk_Concerts_Singer FOREIGN KEY (SingerId) REFERENCES Singers (SingerId) +) PRIMARY KEY(VenueId, SingerId, ConcertDate); + +CREATE TABLE TableWithAllColumnTypes ( + ColInt64 INT64 NOT NULL, + ColFloat64 FLOAT64 NOT NULL, + ColBool BOOL NOT NULL, + ColString STRING(100) NOT NULL, + ColStringMax STRING(MAX) NOT NULL, + ColBytes BYTES(100) NOT NULL, + ColBytesMax BYTES(MAX) NOT NULL, + ColDate DATE NOT NULL, + ColTimestamp TIMESTAMP NOT NULL, + ColCommitTS TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true), + ColNumeric NUMERIC NOT NULL, + + ColInt64Array ARRAY, + ColFloat64Array ARRAY, + ColBoolArray ARRAY, + ColStringArray ARRAY, + ColStringMaxArray ARRAY, + ColBytesArray ARRAY, + ColBytesMaxArray ARRAY, + ColDateArray ARRAY, + ColTimestampArray ARRAY, + ColNumericArray ARRAY, + + ColComputed STRING(MAX) AS (CONCAT(COALESCE(ColString, ''), ' ', COALESCE(ColStringMax, ''))) STORED, +) PRIMARY KEY (ColInt64) +; + +CREATE TABLE TableWithRef ( + Id INT64 NOT NULL, + RefFloat FLOAT64 NOT NULL, + RefString STRING(100) NOT NULL, + RefDate DATE NOT NULL, + CONSTRAINT Fk_TableWithRef_TableWithAllColumnTypes + FOREIGN KEY (RefFloat, RefString, RefDate) + REFERENCES TableWithAllColumnTypes (ColFloat64, ColString, ColDate) +) PRIMARY KEY (Id) +; + +RUN BATCH; \ No newline at end of file