提交 69a7bc4b 编写于 作者: S Serge Rider

#6921 YB: disable transactions, enable sql for limits

上级 3a0406c2
......@@ -342,6 +342,7 @@
<parameter name="serverType" value="yellowbrick"/>
<property name="loginTimeout" value="20"/>
<property name="connectTimeout" value="20"/>
<property name="@dbeaver-default-resultset.maxrows.sql" value="true"/>
</driver>
<driver
......
......@@ -26,12 +26,10 @@ import org.jkiss.utils.CommonUtils;
class PostgreDataSourceInfo extends JDBCDataSourceInfo {
private final PostgreDataSource dataSource;
private final boolean supportsLimits;
public PostgreDataSourceInfo(PostgreDataSource dataSource, JDBCDatabaseMetaData metaData) {
super(metaData);
this.dataSource = dataSource;
this.supportsLimits = dataSource.getServerType().isSupportsLimits();
}
@Override
......@@ -48,7 +46,12 @@ class PostgreDataSourceInfo extends JDBCDataSourceInfo {
@Override
public boolean supportsResultSetLimit() {
// ??? Disable maxRows for data transfer - it turns cursors off ?
return supportsLimits;
return dataSource.getServerType().supportsResultSetLimits();
}
@Override
public boolean supportsTransactions() {
return dataSource.getServerType().supportsTransactions();
}
@Override
......
......@@ -32,6 +32,8 @@ public interface PostgreServerExtension
{
String getServerTypeName();
boolean supportsTransactions();
boolean supportsOids();
boolean supportsIndexes();
......@@ -66,7 +68,7 @@ public interface PostgreServerExtension
boolean supportsAggregates();
boolean isSupportsLimits();
boolean supportsResultSetLimits();
boolean supportsClientInfo();
......@@ -74,10 +76,28 @@ public interface PostgreServerExtension
boolean supportFunctionDefRead();
String readTableDDL(DBRProgressMonitor monitor, PostgreTableBase table) throws DBException;
boolean supportsExplainPlan();
boolean supportsExplainPlanXML();
boolean supportsExplainPlanVerbose();
boolean supportsDatabaseDescription();
boolean supportsTemporalAccessor();
boolean supportsTeblespaceLocation();
boolean supportsTemplates();
// Stored procedures support (workarounds for Redshift mostly)
boolean supportsStoredProcedures();
String getProceduresSystemTable();
String getProceduresOidColumn();
// Table DDL extraction
String readTableDDL(DBRProgressMonitor monitor, PostgreTableBase table) throws DBException;
// Custom schema cache.
JDBCObjectLookupCache<PostgreDatabase, PostgreSchema> createSchemaCache(PostgreDatabase database);
......@@ -96,23 +116,4 @@ public interface PostgreServerExtension
List<PostgrePrivilege> readObjectPermissions(DBRProgressMonitor monitor, PostgreTableBase object, boolean includeNestedObjects) throws DBException;
boolean supportsExplainPlan();
boolean supportsExplainPlanXML();
boolean supportsExplainPlanVerbose();
boolean supportsDatabaseDescription();
boolean supportsTemporalAccessor();
boolean supportsTeblespaceLocation();
// Stored procedures support (workarounds for Redshift mostly)
boolean supportsStoredProcedures();
String getProceduresSystemTable();
String getProceduresOidColumn();
}
......@@ -127,7 +127,7 @@ public class PostgreServerCockroachDB extends PostgreServerExtensionBase {
}
@Override
public boolean isSupportsLimits() {
public boolean supportsResultSetLimits() {
return false;
}
......
......@@ -46,6 +46,11 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
this.dataSource = dataSource;
}
@Override
public boolean supportsTransactions() {
return true;
}
@Override
public boolean supportsOids() {
return true;
......@@ -132,7 +137,7 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
}
@Override
public boolean isSupportsLimits() {
public boolean supportsResultSetLimits() {
return true;
}
......
......@@ -158,7 +158,7 @@ public class PostgreServerRedshift extends PostgreServerExtensionBase {
}
@Override
public boolean isSupportsLimits() {
public boolean supportsResultSetLimits() {
return true;
}
......
......@@ -19,7 +19,6 @@ package org.jkiss.dbeaver.ext.postgresql.model.impls.yellowbrick;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreTableBase;
import org.jkiss.dbeaver.ext.postgresql.model.PostgreTableRegular;
import org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerExtensionBase;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.utils.CommonUtils;
......@@ -33,6 +32,11 @@ public class PostgreServerYellowBrick extends PostgreServerExtensionBase {
super(dataSource);
}
@Override
public boolean supportsTransactions() {
return false;
}
@Override
public String getServerTypeName() {
return "YellowBrick";
......
......@@ -44,14 +44,20 @@ import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.model.sql.SQLDataSource;
import org.jkiss.dbeaver.model.sql.SQLDialect;
import org.jkiss.dbeaver.model.sql.SQLState;
import org.jkiss.dbeaver.model.struct.*;
import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSInstanceContainer;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectContainer;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;
import java.net.SocketException;
import java.sql.*;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* JDBC data source
......@@ -368,7 +374,7 @@ public abstract class JDBCDataSource
try {
dataSourceInfo = createDataSourceInfo(monitor, metaData);
} catch (Throwable e) {
log.error("Error obtaining database info");
log.error("Error obtaining database info", e);
}
} catch (SQLException ex) {
throw new DBException("Error getting JDBC meta data", ex, this);
......
......@@ -159,20 +159,21 @@ public class JDBCDataSourceInfo extends AbstractDataSourceInfo
}
supportedIsolations = new ArrayList<>();
try {
for (JDBCTransactionIsolation txi : JDBCTransactionIsolation.values()) {
if (metaData.supportsTransactionIsolationLevel(txi.getCode())) {
supportedIsolations.add(txi);
if (supportsTransactions) {
try {
for (JDBCTransactionIsolation txi : JDBCTransactionIsolation.values()) {
if (metaData.supportsTransactionIsolationLevel(txi.getCode())) {
supportedIsolations.add(txi);
}
}
} catch (Throwable e) {
log.debug(e.getMessage());
}
} catch (Throwable e) {
log.debug(e.getMessage());
supportsTransactions = true;
}
if (!supportedIsolations.contains(JDBCTransactionIsolation.NONE)) {
supportedIsolations.add(0, JDBCTransactionIsolation.NONE);
if (!supportedIsolations.contains(JDBCTransactionIsolation.NONE)) {
supportedIsolations.add(0, JDBCTransactionIsolation.NONE);
}
addCustomTransactionIsolationLevels(supportedIsolations);
}
addCustomTransactionIsolationLevels(supportedIsolations);
supportsScroll = true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册