提交 88b36529 编写于 作者: O Olav Loite

feat: add support for the official Cloud Spanner JDBC driver

Former-commit-id: 366d0629
上级 08dd1703
......@@ -28,6 +28,7 @@
<plugin id="org.jkiss.dbeaver.ext.athena" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.bigquery" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.clickhouse" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.cloudspanner" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.db2.zos" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.db2.i" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.derby" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
......
......@@ -30,6 +30,7 @@
<plugin id="org.jkiss.dbeaver.ext.athena.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.bigquery.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.cloudspanner.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.spanner.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.snowflake.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.jkiss.dbeaver.ext.sqlite.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
......
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jkiss.dbeaver.ext.cloudspanner.ui;singleton:=true
Bundle-Version: 1.0.5.qualifier
Bundle-Release-Date: 20200622
Bundle-Activator: org.jkiss.dbeaver.ext.cloudspanner.ui.CloudSpannerActivator
Require-Bundle: org.eclipse.ui,
org.jkiss.dbeaver.ui.editors.connection,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.ui,
org.jkiss.dbeaver.ext.cloudspanner
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: OSGI-INF/l10n/bundle
Automatic-Module-Name: org.jkiss.dbeaver.ext.cloudspanner.ui
Bundle-Vendor = DBeaver Corp
Bundle-Name = DBeaver Google Spanner UI
spanner.dialog.connection.header=Google Spanner Connection Settings
\ No newline at end of file
spanner.dialog.connection.header=Google Spanner Verbindungseinstellungen
\ No newline at end of file
Bundle-Name = DBeaver Google UI
Bundle-Vendor = DBeaver Corp
spanner.dialog.connection.header = Google Spanner Configura\u00E7\u00F5es de conex\u00E3o
spanner.dialog.connection.header=\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F Google Spanner
source.. = src/
output.. = target/classes/
bin.includes = plugin.xml,\
META-INF/,\
.,\
OSGI-INF/,\
icons/,\
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.jkiss.dbeaver.dataSourceView">
<view
id="org.jkiss.dbeaver.ext.cloudspanner.dataSourceWizardView"
targetID="org.jkiss.dbeaver.ext.ui.newConnectionWizard"
dataSource="google_cloudspanner"
label="%spanner.dialog.connection.header"
class="org.jkiss.dbeaver.ext.cloudspanner.ui.views.CloudSpannerConnectionPage"
icon="platform:/plugin/org.jkiss.dbeaver.ext.cloudspanner/icons/spanner_icon.png">
</view>
<view
class="org.jkiss.dbeaver.ext.cloudspanner.ui.views.CloudSpannerConnectionPage"
icon="platform:/plugin/org.jkiss.dbeaver.ext.cloudspanner/icons/spanner_icon.png"
id="org.jkiss.dbeaver.ext.cloudspanner.dataSourceEditorView"
dataSource="google_cloudspanner"
label="%spanner.dialog.connection.header"
targetID="org.jkiss.dbeaver.ext.ui.editConnectionDialog">
</view>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jkiss.dbeaver</groupId>
<artifactId>plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>org.jkiss.dbeaver.ext.cloudspanner.ui</artifactId>
<version>1.0.5-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.ui;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class CloudSpannerActivator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.jkiss.dbeaver.ext.cloudspanner.ui";
// The shared instance
private static CloudSpannerActivator plugin;
public CloudSpannerActivator() {
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static CloudSpannerActivator getDefault() {
return plugin;
}
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}
package org.jkiss.dbeaver.ext.cloudspanner.ui.internal;
import org.eclipse.osgi.util.NLS;
public class CloudSpannerMessages extends NLS {
private static final String BUNDLE_NAME = "org.jkiss.dbeaver.ext.cloudspanner.ui.internal.messages"; //$NON-NLS-1$
public static String label_connection;
public static String label_private_key_path;
public static String label_project;
public static String label_instance;
public static String label_database;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, CloudSpannerMessages.class);
}
private CloudSpannerMessages() {
}
}
label_connection=Connection
label_private_key_path=Private key path (p12 or JSON)
label_project=Project
label_instance=Instance
label_database=Database
\ No newline at end of file
label_connection=Verbindung
label_private_key_path=Privater Schl\u00fcsselpfad (p12 oder JSON)
label_project=Projekt
label_instance=Instanz
label_database=Datenbank
\ No newline at end of file
label_connection=\u0421\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435
label_private_key_path=\u041F\u0443\u0442\u044C \u043A \u0437\u0430\u043A\u0440\u044B\u0442\u043E\u043C\u0443 \u043A\u043B\u044E\u0447\u0443 (p12 \u0438\u043B\u0438 JSON)
label_project=\u041F\u0440\u043E\u0435\u043A\u0442
label_instance=\u042D\u043A\u0437\u0435\u043C\u043F\u043B\u044F\u0440
label_database=\u0411\u0430\u0437\u0430 \u0434\u0430\u043D\u043D\u044B\u0445
\ No newline at end of file
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.ui.views;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.cloudspanner.ui.CloudSpannerActivator;
import org.jkiss.dbeaver.ext.cloudspanner.ui.internal.CloudSpannerMessages;
import org.jkiss.dbeaver.ext.cloudspanner.model.CloudSpannerConstants;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.ui.ICompositeDialogPage;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.controls.TextWithOpenFile;
import org.jkiss.dbeaver.ui.dialogs.connection.ConnectionPageAbstract;
import org.jkiss.dbeaver.ui.dialogs.connection.DriverPropertiesDialogPage;
import org.jkiss.utils.CommonUtils;
/**
* CloudSpannerConnectionPage
*/
public class CloudSpannerConnectionPage extends ConnectionPageAbstract implements ICompositeDialogPage
{
private static final Log log = Log.getLog(CloudSpannerConnectionPage.class);
private Text projectText;
private Text instanceText;
private Text databaseText;
private TextWithOpenFile privateKeyFile;
private static ImageDescriptor logoImage = CloudSpannerActivator.getImageDescriptor("icons/spanner_logo.png"); //$NON-NLS-1$
private DriverPropertiesDialogPage driverPropsPage;
public CloudSpannerConnectionPage() {
driverPropsPage = new DriverPropertiesDialogPage(this);
}
@Override
public void dispose()
{
super.dispose();
}
@Override
public void createControl(Composite composite)
{
setImageDescriptor(logoImage);
Composite settingsGroup = new Composite(composite, SWT.NONE);
settingsGroup.setLayout(new GridLayout(1, false));
settingsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
ModifyListener textListener = e -> site.updateButtons();
{
Composite addrGroup = UIUtils.createControlGroup(settingsGroup, CloudSpannerMessages.label_connection, 2, 0, 0);
addrGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
projectText = UIUtils.createLabelText(addrGroup, CloudSpannerMessages.label_project, ""); //$NON-NLS-2$
projectText.setToolTipText("Cloud Spanner Project ID"); //$NON-NLS-1$
projectText.addModifyListener(textListener);
instanceText = UIUtils.createLabelText(addrGroup, CloudSpannerMessages.label_instance, ""); //$NON-NLS-2$
instanceText.setToolTipText("Cloud Spanner Instance ID"); //$NON-NLS-1$
instanceText.addModifyListener(textListener);
databaseText = UIUtils.createLabelText(addrGroup, CloudSpannerMessages.label_database, ""); //$NON-NLS-2$
databaseText.setToolTipText("Cloud Spanner Database ID"); //$NON-NLS-1$
databaseText.addModifyListener(textListener);
UIUtils.createControlLabel(addrGroup, CloudSpannerMessages.label_private_key_path);
privateKeyFile = new TextWithOpenFile(addrGroup, CloudSpannerMessages.label_private_key_path, new String[] { "*", "*.json" } ); //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
//gd.horizontalSpan = 3;
privateKeyFile.setLayoutData(gd);
}
createDriverPanel(settingsGroup);
setControl(settingsGroup);
}
@Override
public boolean isComplete()
{
return projectText != null && !CommonUtils.isEmpty(projectText.getText()) &&
instanceText != null && !CommonUtils.isEmpty(instanceText.getText()) &&
databaseText != null && !CommonUtils.isEmpty(databaseText.getText());
}
@Override
public void loadSettings()
{
super.loadSettings();
// Load values from new connection info
DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
if (projectText != null) {
projectText.setText(CommonUtils.notEmpty(connectionInfo.getServerName()));
}
if (instanceText != null) {
instanceText.setText(CommonUtils.notEmpty(connectionInfo.getHostName()));
}
if (databaseText != null) {
databaseText.setText(CommonUtils.notEmpty(connectionInfo.getDatabaseName()));
}
if (privateKeyFile != null) {
privateKeyFile.setText(CommonUtils.notEmpty(connectionInfo.getProviderProperty(CloudSpannerConstants.DRIVER_PROP_CREDENTIALS_FILE)));
}
}
@Override
public void saveSettings(DBPDataSourceContainer dataSource)
{
DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
if (projectText != null) {
connectionInfo.setServerName(projectText.getText().trim());
}
if (instanceText != null) {
connectionInfo.setHostName(instanceText.getText().trim());
}
if (databaseText != null) {
connectionInfo.setDatabaseName(databaseText.getText().trim());
}
if (privateKeyFile != null) {
connectionInfo.setProviderProperty(CloudSpannerConstants.DRIVER_PROP_CREDENTIALS_FILE, privateKeyFile.getText());
}
super.saveSettings(dataSource);
}
@Override
public IDialogPage[] getSubPages(boolean extrasOnly, boolean forceCreate)
{
return new IDialogPage[] {
driverPropsPage
};
}
}
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DBeaver Cloud Spanner extension
Bundle-SymbolicName: org.jkiss.dbeaver.ext.cloudspanner;singleton:=true
Bundle-Version: 1.0.22.qualifier
Bundle-Release-Date: 20200622
Require-Bundle: org.jkiss.dbeaver.ext.generic
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Vendor: DBeaver Corp
Bundle-Localization: OSGI-INF/l10n/bundle
Automatic-Module-Name: org.jkiss.dbeaver.ext.cloudspanner
Export-Package: org.jkiss.dbeaver.ext.cloudspanner.model
Bundle-Vendor = DBeaver Corp
Bundle-Name = DBeaver Google Cloud Spanner Extension
datasource.cloudspanner.description = Google Cloud Spanner Datasource
\ No newline at end of file
source.. = src/
output.. = target/classes/
bin.includes = plugin.xml,\
META-INF/,\
OSGI-INF/,\
.,\
icons/
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.jkiss.dbeaver.dataSourceProvider">
<!-- Spanner -->
<datasource
class="org.jkiss.dbeaver.ext.cloudspanner.CloudSpannerDataSourceProvider"
description="%datasource.cloudspanner.description"
id="google_cloudspanner"
parent="generic"
label="Google Cloud Spanner"
icon="icons/spanner_icon.png"
dialect="cloudspanner">
<drivers managable="true">
<driver
id="cloudspanner_jdbc"
label="Google Cloud Spanner"
icon="icons/spanner_icon.png"
iconBig="icons/spanner_icon_big.png"
class="com.google.cloud.spanner.jdbc.JdbcDriver"
sampleURL="jdbc:cloudspanner:/projects/my-project/instances/my-instance/databases/my-database"
defaultPort=""
description="Google Cloud Spanner Open Source JDBC Driver"
webURL="https://cloud.google.com/spanner/docs/use-oss-jdbc"
categories="bigdata,cloud">
<parameter name="omit-catalog" value="true"/>
<parameter name="omit-schema" value="false"/>
<file type="jar" path="maven:/com.google.cloud:google-cloud-spanner-jdbc:RELEASE"/>
</driver>
</drivers>
</datasource>
</extension>
<extension point="org.jkiss.dbeaver.sqlDialect">
<dialect id="cloudspanner" parent="generic" class="org.jkiss.dbeaver.ext.cloudspanner.model.CloudSpannerSQLDialect" label="Cloud Spanner" description="Google Spanner SQL dialect." icon="icons/spanner_icon.png">
</dialect>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jkiss.dbeaver</groupId>
<artifactId>plugins</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>org.jkiss.dbeaver.ext.cloudspanner</artifactId>
<version>1.0.22-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.generic.GenericDataSourceProvider;
import org.jkiss.dbeaver.ext.cloudspanner.model.CloudSpannerDataSource;
import org.jkiss.dbeaver.ext.cloudspanner.model.CloudSpannerMetaModel;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
public class CloudSpannerDataSourceProvider extends GenericDataSourceProvider {
private static final Log log = Log.getLog(CloudSpannerDataSourceProvider.class);
public CloudSpannerDataSourceProvider()
{
}
@Override
public void init(@NotNull DBPPlatform platform) {
}
@NotNull
@Override
public DBPDataSource openDataSource(
@NotNull DBRProgressMonitor monitor,
@NotNull DBPDataSourceContainer container)
throws DBException
{
return new CloudSpannerDataSource(monitor, container, new CloudSpannerMetaModel());
}
@Override
public String getConnectionURL(DBPDriver driver, DBPConnectionConfiguration connectionInfo) {
StringBuilder url = new StringBuilder();
url.append("jdbc:cloudspanner:");
return url.toString();
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.model;
/**
* Cloud Spanner constants
*/
public class CloudSpannerConstants {
public static final String DRIVER_PROP_CREDENTIALS_FILE = "credentials";
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.model;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import java.util.HashMap;
import java.util.Map;
public class CloudSpannerDataSource extends GenericDataSource {
public CloudSpannerDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container, CloudSpannerMetaModel metaModel)
throws DBException
{
super(monitor, container, metaModel, new CloudSpannerSQLDialect());
}
@Override
protected String getConnectionURL(DBPConnectionConfiguration connectionInfo) {
StringBuilder url = new StringBuilder(super.getConnectionURL(connectionInfo));
url.append("/projects/").append(connectionInfo.getServerName());
url.append("/instances/").append(connectionInfo.getHostName());
url.append("/databases/").append(connectionInfo.getDatabaseName());
return url.toString();
}
@Override
protected Map<String, String> getInternalConnectionProperties(DBRProgressMonitor monitor, DBPDriver driver, JDBCExecutionContext context, String purpose, DBPConnectionConfiguration connectionInfo) throws DBCException {
Map<String, String> props = new HashMap<>();
props.put(CloudSpannerConstants.DRIVER_PROP_CREDENTIALS_FILE, connectionInfo.getProviderProperty(CloudSpannerConstants.DRIVER_PROP_CREDENTIALS_FILE));
return props;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.model;
import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel;
import java.util.regex.Pattern;
/**
* Spanner meta model
*/
public class CloudSpannerMetaModel extends GenericMetaModel {
private Pattern ERROR_POSITION_PATTERN = Pattern.compile(" at \\[([0-9]+)\\:([0-9]+)\\]");
public CloudSpannerMetaModel() {
}
// The default schema in Cloud Spanner is an empty string. This ensures that this
// default schema will be shown as 'DEFAULT' in DBeaver, and enables auto complete
// for tables and views in both the DEFAULT schema, as well as the INFORMATION_SCHEMA
// and SPANNER_SYS schemas.
public boolean supportsNullSchemas() {
return true;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2020 DBeaver Corp and others
*
* 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 org.jkiss.dbeaver.ext.cloudspanner.model;
import org.jkiss.dbeaver.ext.generic.model.GenericSQLDialect;
/**
* Cloud Spanner dialect.
*/
public class CloudSpannerSQLDialect extends GenericSQLDialect {
public CloudSpannerSQLDialect() {
super("Cloud Spanner");
}
}
......@@ -24,6 +24,7 @@
<module>org.jkiss.dbeaver.ext.athena</module>
<module>org.jkiss.dbeaver.ext.bigquery</module>
<module>org.jkiss.dbeaver.ext.clickhouse</module>
<module>org.jkiss.dbeaver.ext.cloudspanner</module>
<module>org.jkiss.dbeaver.ext.db2</module>
<module>org.jkiss.dbeaver.ext.db2.zos</module>
<module>org.jkiss.dbeaver.ext.db2.i</module>
......@@ -79,6 +80,7 @@
<module>org.jkiss.dbeaver.ext.athena.ui</module>
<module>org.jkiss.dbeaver.ext.bigquery.ui</module>
<module>org.jkiss.dbeaver.ext.cloudspanner.ui</module>
<module>org.jkiss.dbeaver.ext.exasol.ui</module>
<module>org.jkiss.dbeaver.ext.db2.ui</module>
......
......@@ -230,6 +230,8 @@
<setEntry value="org.jkiss.dbeaver.ext.bigquery.ui@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.bigquery@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.clickhouse@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.cloudspanner.ui@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.cloudspanner@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.db2.i@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.db2.ui@default:default"/>
<setEntry value="org.jkiss.dbeaver.ext.db2.zos@default:default"/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册