-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support DATABASE statements #1143
Conversation
Adds support for the following DATABASE statements in the Connection API: - CREATE DATABASE <database_id> - ALTER DATABASE <database_id> - DROP DATABASE <database_id> - USE DATABASE <database_id> Needed for googleapis/java-spanner-jdbc#457
Codecov Report
@@ Coverage Diff @@
## main #1143 +/- ##
=======================================
Coverage ? 84.92%
Complexity ? 2797
=======================================
Files ? 156
Lines ? 14430
Branches ? 1392
=======================================
Hits ? 12255
Misses ? 1598
Partials ? 577 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started an internal discussion in regards to the syntax of the following statements:
SHOW VARIABLE DATABASES
USE DATABASE <database id>
I will let you know once we have a response here, sorry for the delay.
Adds support for the following DATABASE statements in the Connection API:
CREATE DATABASE <database_id>
: Creates a database (passes the statement through to theCreateDatabase
RPC)ALTER DATABASE <database_id>
: Alters an existing database (passes the statement through to theUpdateDatabaseDdl
RPC)DROP DATABASE <database_id>
: Drops an existing database (parsed and translated into a call to theDropDatabase
RPC)SHOW VARIABLE DATABASES
: Lists the databases on the current instance (parsed and translated into a call to theListDatabases
RPC)USE DATABASE <database_id>
: Changes the database that is used by the connection to execute queries, updates, etc.Also adds support for creating a
Connection
that is not connected to a specific database, but only to a Spanner instance. This can be used to connect to an empty instance, then create a database on the instance, and then callUSE DATABASE <database_id>
to use the database with the connection.This feature allows users to execute scripts like this directly through the Connection API (and thereby also through JDBC):
Needed for googleapis/java-spanner-jdbc#457