Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/dbeaver/dbeaver into #29999-…
Browse files Browse the repository at this point in the history
…project-loading-race-condition
  • Loading branch information
ShadelessFox committed May 22, 2024
2 parents 3718103 + 3ec05a1 commit b731faf
Show file tree
Hide file tree
Showing 69 changed files with 431 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@
'org.jkiss.dbeaver.ui.navigator.node.transient.foreground=71,180,65'
'org.jkiss.dbeaver.ui.navigator.node.new.background=41,66,0'
'org.jkiss.dbeaver.ui.navigator.node.modified.background=82,52,0'
'org.jkiss.dbeaver.ui.navigator.node.foreground=140,140,140'
'org.jkiss.dbeaver.ui.navigator.node.statistics.background=105,105,105'
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
/**
* PrefPageConnections
*/
public class PrefPageConnectionClient extends TargetPrefPage
{
public class PrefPageConnectionClient extends TargetPrefPage {
public static final String PAGE_ID = "org.jkiss.dbeaver.preferences.client.connections"; //$NON-NLS-1$

private static final String[] ALLOWED_VARIABLES = new String[] {
Expand Down Expand Up @@ -73,14 +72,12 @@ public class PrefPageConnectionClient extends TargetPrefPage

private Button connUseEnvVariables;

public PrefPageConnectionClient()
{
public PrefPageConnectionClient() {
super();
}

@Override
protected boolean hasDataSourceSpecificOptions(DBPDataSourceContainer dataSourceDescriptor)
{
protected boolean hasDataSourceSpecificOptions(DBPDataSourceContainer dataSourceDescriptor) {
DBPPreferenceStore store = dataSourceDescriptor.getPreferenceStore();
return
store.contains(ModelPreferences.META_CLIENT_NAME_DISABLE) ||
Expand All @@ -92,8 +89,7 @@ protected boolean hasDataSourceSpecificOptions(DBPDataSourceContainer dataSource
}

@Override
protected boolean supportsDataSourceSpecificOptions()
{
protected boolean supportsDataSourceSpecificOptions() {
return true;
}

Expand Down Expand Up @@ -129,7 +125,6 @@ public void widgetSelected(SelectionEvent e) {

{
Group connGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_connection_label_general, 2, GridData.FILL_HORIZONTAL, 0);

connUseEnvVariables = UIUtils.createCheckbox(connGroup, CoreMessages.pref_page_connection_label_use_environment, null, false, 2);
}
return composite;
Expand All @@ -140,13 +135,11 @@ private void updateClientAppEnablement() {
}

@Override
protected void loadPreferences(DBPPreferenceStore store)
{
protected void loadPreferences(DBPPreferenceStore store) {
try {
disableClientApplicationNameCheck.setSelection(store.getBoolean(ModelPreferences.META_CLIENT_NAME_DISABLE));
overrideClientApplicationNameCheck.setSelection(store.getBoolean(ModelPreferences.META_CLIENT_NAME_OVERRIDE));
clientApplicationNameText.setText(store.getString(ModelPreferences.META_CLIENT_NAME_VALUE));

connUseEnvVariables.setSelection(store.getBoolean(ModelPreferences.CONNECT_USE_ENV_VARS));

updateClientAppEnablement();
Expand All @@ -156,13 +149,11 @@ protected void loadPreferences(DBPPreferenceStore store)
}

@Override
protected void savePreferences(DBPPreferenceStore store)
{
protected void savePreferences(DBPPreferenceStore store) {
try {
store.setValue(ModelPreferences.META_CLIENT_NAME_DISABLE, disableClientApplicationNameCheck.getSelection());
store.setValue(ModelPreferences.META_CLIENT_NAME_OVERRIDE, overrideClientApplicationNameCheck.getSelection());
store.setValue(ModelPreferences.META_CLIENT_NAME_VALUE, clientApplicationNameText.getText());

store.setValue(ModelPreferences.CONNECT_USE_ENV_VARS, connUseEnvVariables.getSelection());
} catch (Exception e) {
log.warn(e);
Expand All @@ -171,19 +162,25 @@ protected void savePreferences(DBPPreferenceStore store)
}

@Override
protected void clearPreferences(DBPPreferenceStore store)
{
protected void clearPreferences(DBPPreferenceStore store) {
store.setToDefault(ModelPreferences.META_CLIENT_NAME_DISABLE);
store.setToDefault(ModelPreferences.META_CLIENT_NAME_OVERRIDE);
store.setToDefault(ModelPreferences.META_CLIENT_NAME_VALUE);

store.setToDefault(ModelPreferences.CONNECT_USE_ENV_VARS);
}

@Override
protected String getPropertyPageID()
{
protected String getPropertyPageID() {
return PAGE_ID;
}

@Override
protected void performDefaults() {
DBPPreferenceStore store = getTargetPreferenceStore();
disableClientApplicationNameCheck.setSelection(store.getDefaultBoolean(ModelPreferences.META_CLIENT_NAME_DISABLE));
overrideClientApplicationNameCheck.setSelection(store.getDefaultBoolean(ModelPreferences.META_CLIENT_NAME_OVERRIDE));
clientApplicationNameText.setText(store.getDefaultString(ModelPreferences.META_CLIENT_NAME_VALUE));
connUseEnvVariables.setSelection(store.getDefaultBoolean(ModelPreferences.CONNECT_USE_ENV_VARS));
updateClientAppEnablement();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.PlatformUI;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
Expand Down Expand Up @@ -319,7 +318,7 @@ public boolean performOk()
getShell(),
"Restart " + GeneralUtils.getProductName(),
"You need to restart " + GeneralUtils.getProductName() + " to perform actual language change.\nDo you want to restart?")) {
UIUtils.asyncExec(() -> PlatformUI.getWorkbench().restart());
restartWorkbenchOnPrefChange();
}
}
} catch (DBException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ protected void clearPreferences(DBPPreferenceStore store)
protected void performDefaults() {
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
readExpensiveCheck.setSelection(store.getDefaultBoolean(ModelPreferences.READ_EXPENSIVE_PROPERTIES));
UIUtils.setComboSelection(separateMetaConnectionCombo, store.getDefaultString(ModelPreferences.META_SEPARATE_CONNECTION));
separateMetaConnectionCombo.select(metaUseSeparateConnectionValues.indexOf(
SeparateConnectionBehavior.parse(store.getDefaultString(ModelPreferences.META_SEPARATE_CONNECTION))
));
caseSensitiveNamesCheck.setSelection(store.getDefaultBoolean(ModelPreferences.META_CASE_SENSITIVE));
addExtraDDLInfo.setSelection(store.getDefaultBoolean(ModelPreferences.META_EXTRA_DDL_INFO));
serverSideFiltersCheck.setSelection(store.getDefaultBoolean(ModelPreferences.META_USE_SERVER_SIDE_FILTERS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,16 @@ private static void updateBookmark(DBNDatabaseNode node, String title, IFile fil
throws DBException
{
if (CommonUtils.isEmpty(title)) {
title = node.getNodeDisplayName();
title = node.getNodeId();
}

List<String> nodePath = new ArrayList<>();
for (DBNNode parent = node; !(parent instanceof DBNDataSource); parent = parent.getParentNode()) {
nodePath.add(0, parent.getNodeDisplayName());
nodePath.add(0, parent.getNodeId());
}
BookmarkStorage storage = new BookmarkStorage(
title,
node.getNodeTypeLabel() + " " + node.getNodeDisplayName(), //$NON-NLS-1$
node.getNodeTypeLabel() + " " + node.getNodeId(), //$NON-NLS-1$
node.getNodeIconDefault(),
node.getDataSourceContainer().getId(),
nodePath);
Expand Down Expand Up @@ -277,7 +277,7 @@ public void run(DBRProgressMonitor monitor) throws InvocationTargetException {
final DBNNode[] children = currentNode.getChildren(monitor);
if (!ArrayUtils.isEmpty(children)) {
for (DBNNode node : children) {
if (path.equals(node.getNodeDisplayName())) {
if (path.equals(node.getNodeId()) || path.equals(node.getNodeDisplayName())) {
nextChild = node;
break;
}
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.athena/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
category="AWS"
webURL="https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html"
propertiesURL="https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC-2.0.25.1001/doc/Simba+Athena+JDBC+Connector+Install+and+Configuration+Guide.pdf"
databaseDocumentationSuffixURL="Database-driver-Amazon-Athena"
categories="bigdata,aws"
singleConnection="true">
<replace provider="generic" driver="aws_athena_42"/>
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.bigquery/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
description="Google BigQuery driver"
webURL="https://cloud.google.com/bigquery/partners/simba-drivers/"
propertiesURL="https://cdn.simba.com/products/BigQuery/doc/JDBC_InstallGuide/"
databaseDocumentationSuffixURL="Database-driver-BigQuery"
categories="bigdata,gcp"
singleConnection="true">
<file type="jar" path="https://storage.googleapis.com/simba-bq-release/jdbc/SimbaJDBCDriverforGoogleBigQuery42_1.5.0.1001.zip" bundle="!drivers.bigquery"/>
Expand Down
2 changes: 2 additions & 0 deletions plugins/org.jkiss.dbeaver.ext.clickhouse/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
description="Yandex ClickHouse legacy driver (server version &lt; 21.3)"
supportedConfigurationTypes="MANUAL,URL"
webURL="https://github.com/yandex/clickhouse-jdbc"
databaseDocumentationSuffixURL="Clickhouse"
categories="sql,analytic,columns"
singleConnection="true">
<replace provider="generic" driver="yandex_clickhouse"/>
Expand All @@ -56,6 +57,7 @@
description="Official ClickHouse driver (server version 21.3+)"
supportedConfigurationTypes="MANUAL,URL"
webURL="https://github.com/ClickHouse/clickhouse-java"
databaseDocumentationSuffixURL="Clickhouse"
categories="sql,analytic,columns"
singleConnection="true">
<file type="jar" path="maven:/com.clickhouse:clickhouse-jdbc:RELEASE[0.5.0]" load-optional-dependencies="true" bundle="!drivers.clickhouse_com" />
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.databricks/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
iconBig="platform:/plugin/org.jkiss.dbeaver.ext.generic/icons/databricks_icon_big.png"
class="com.databricks.client.jdbc.Driver"
webURL="https://docs.databricks.com/integrations/jdbc-odbc-bi.html"
databaseDocumentationSuffixURL="Database-driver-Azure-Databricks"
description="Azure Databricks driver"
supportedConfigurationTypes="URL"
categories="sql,analytic,cloud"
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.db2.i/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
supportedConfigurationTypes="MANUAL,URL"
defaultPort="446"
description="IBM Db2 driver for IBM i (replacement for iSeries and AS/400)"
databaseDocumentationSuffixURL="Database-driver-IBM-Db2"
categories="sql">
<replace provider="generic" driver="db2_iseries"/>

Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.db2.zos/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
sampleURL="jdbc:db2://{host}[:{port}]/{database}"
supportedConfigurationTypes="MANUAL,URL"
defaultPort="50000"
databaseDocumentationSuffixURL="Database-driver-IBM-Db2"
description="IBM Db2 driver for z/OS"
note="In order to connect to z/OS DB2 instance you have to install license file 'db2jcc_license_cisuz.jar'. Edit driver settings and and license file as a library."
categories="sql,legacy,mainframe">
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jkiss.dbeaver.ext.db2/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@
defaultPort="50000"
webURL="https://www-01.ibm.com/support/docview.wss?uid=swg21363866"
propertiesURL="https://www.ibm.com/docs/en/db2/latest?topic=pdsdjs-common-data-server-driver-jdbc-sqlj-properties-all-database-products"
databaseDocumentationSuffixURL="Database-driver-IBM-Db2"
description="IBM Db2 for Linux/Unix/Windows driver"
promoted="1"
categories="sql">
Expand Down
6 changes: 3 additions & 3 deletions plugins/org.jkiss.dbeaver.ext.duckdb/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

<extension point="org.jkiss.dbeaver.dataTypeProvider">
<provider
class="org.jkiss.dbeaver.ext.duckdb.model.data.DuckDbValueHandlerProvider"
class="org.jkiss.dbeaver.ext.duckdb.model.data.DuckDBValueHandlerProvider"
description="DuckDB data types provider"
id="org.jkiss.dbeaver.ext.duckdb.model.data.DuckDbValueHandlerProvider"
id="org.jkiss.dbeaver.ext.duckdb.model.data.DuckDBValueHandlerProvider"
label="DuckDB data types provider">

<datasource class="org.jkiss.dbeaver.ext.duckdb.model.DuckDbDataSource"/>
<datasource class="org.jkiss.dbeaver.ext.duckdb.model.DuckDBDataSource"/>
<type name="GEOMETRY"/>
</provider>
</extension>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,36 @@

import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.duckdb.model.data.DuckDbGeometryValueHandler;
import org.jkiss.dbeaver.ext.duckdb.model.data.DuckDBGeometryValueHandler;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.GenericSQLDialect;
import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.sql.SQLDialect;
import org.jkiss.utils.ArrayUtils;

import java.util.Locale;

/**
* DuckDB Data source
*/
public class DuckDbDataSource extends GenericDataSource {
public DuckDbDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container, GenericMetaModel metaModel) throws DBException {
public class DuckDBDataSource extends GenericDataSource {
public DuckDBDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container, GenericMetaModel metaModel) throws DBException {
super(monitor, container, metaModel, new GenericSQLDialect());
}

@NotNull
@Override
public SQLDialect getSQLDialect() {
return DuckDBSQLDialect.INSTANCE;
}

@NotNull
@Override
public DBPDataKind resolveDataKind(@NotNull String typeName, int valueType) {
if (ArrayUtils.contains(DuckDbGeometryValueHandler.GEOMETRY_TYPES, typeName.toUpperCase(Locale.ROOT))) {
if (ArrayUtils.contains(DuckDBGeometryValueHandler.GEOMETRY_TYPES, typeName.toUpperCase(Locale.ROOT))) {
return DBPDataKind.OBJECT;
}
return super.resolveDataKind(typeName, valueType);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 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.duckdb.model;

import org.jkiss.dbeaver.ext.generic.model.GenericSQLDialect;

public class DuckDBSQLDialect extends GenericSQLDialect {

public static final DuckDBSQLDialect INSTANCE = new DuckDBSQLDialect();

@Override
public boolean supportsAliasInSelect() {
return true;
}

@Override
public boolean supportsAliasInUpdate() {
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ public GenericSequence createSequenceImpl(

@Override
public GenericDataSource createDataSourceImpl(DBRProgressMonitor monitor, DBPDataSourceContainer container) throws DBException {
return new DuckDbDataSource(monitor, container, this);
return new DuckDBDataSource(monitor, container, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import java.sql.SQLException;


public class DuckDbGeometryValueHandler extends GISGeometryValueHandler {
public class DuckDBGeometryValueHandler extends GISGeometryValueHandler {

public static final String[] GEOMETRY_TYPES = new String[]{"GEOMETRY"};

public static final DuckDbGeometryValueHandler INSTANCE = new DuckDbGeometryValueHandler();
public static final DuckDBGeometryValueHandler INSTANCE = new DuckDBGeometryValueHandler();

@Override
protected Object fetchColumnValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.jkiss.utils.ArrayUtils;

public class DuckDbValueHandlerProvider implements DBDValueHandlerProvider {
public class DuckDBValueHandlerProvider implements DBDValueHandlerProvider {

@Nullable
@Override
public DBDValueHandler getValueHandler(DBPDataSource dataSource, DBDFormatSettings preferences, DBSTypedObject typedObject) {

if (ArrayUtils.contains(DuckDbGeometryValueHandler.GEOMETRY_TYPES, typedObject.getTypeName())) {
return DuckDbGeometryValueHandler.INSTANCE;
if (ArrayUtils.contains(DuckDBGeometryValueHandler.GEOMETRY_TYPES, typedObject.getTypeName())) {
return DuckDBGeometryValueHandler.INSTANCE;
}
return null;
}
Expand Down

0 comments on commit b731faf

Please sign in to comment.