提交 da5507a5 编写于 作者: S serge-rider

Properties model refactoring


Former-commit-id: 10b7015b
上级 2f30b154
......@@ -168,7 +168,7 @@ public class DatabaseTransferProducer implements IDataTransferProducer<DatabaseP
}
boolean newConnection = settings.isOpenNewConnections() && !getDatabaseObject().getDataSource().getContainer().getDriver().isEmbedded();
boolean forceDataReadTransactions = Boolean.TRUE.equals(dataSource.getDataSourceFeature(DBConstants.FEATURE_LOB_REQUIRE_TRANSACTIONS));
boolean forceDataReadTransactions = Boolean.TRUE.equals(dataSource.getDataSourceFeature(DBPDataSource.FEATURE_LOB_REQUIRE_TRANSACTIONS));
boolean selectiveExportFromUI = settings.isSelectedColumnsOnly() || settings.isSelectedRowsOnly();
try {
......
......@@ -20,6 +20,7 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.generic.model.GenericStructContainer;
import org.jkiss.dbeaver.ext.generic.model.GenericTable;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPObjectStatistics;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCSession;
......@@ -58,13 +59,13 @@ public class ClickhouseTable extends GenericTable implements DBPObjectStatistics
return tableSize != null;
}
@Property(category = CAT_STATISTICS, viewable = true, order = 20, formatter = ByteNumberFormat.class)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 20, formatter = ByteNumberFormat.class)
@Override
public long getStatObjectSize() {
return tableSize == null ? 0 : tableSize;
}
@Property(category = CAT_STATISTICS, viewable = true, order = 21)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 21)
@Nullable
@Override
public synchronized Long getRowCount(DBRProgressMonitor monitor) {
......@@ -72,25 +73,25 @@ public class ClickhouseTable extends GenericTable implements DBPObjectStatistics
return tableRows;
}
@Property(category = CAT_STATISTICS, order = 22)
@Property(category = DBConstants.CAT_STATISTICS, order = 22)
public Date getLastModifyTime(DBRProgressMonitor monitor) {
readStatistics(monitor);
return lastModifyTime;
}
@Property(category = CAT_STATISTICS, order = 23)
@Property(category = DBConstants.CAT_STATISTICS, order = 23)
public String getMinDate(DBRProgressMonitor monitor) {
readStatistics(monitor);
return minDate;
}
@Property(category = CAT_STATISTICS, order = 24)
@Property(category = DBConstants.CAT_STATISTICS, order = 24)
public String getMaxDate(DBRProgressMonitor monitor) {
readStatistics(monitor);
return maxDate;
}
@Property(category = CAT_STATISTICS, viewable = true, order = 25)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 25)
public String getEngine(DBRProgressMonitor monitor) {
readStatistics(monitor);
return engine;
......
......@@ -92,7 +92,6 @@ public class DB2Constants {
public static final String CAT_PERFORMANCE = "Performance";
public static final String CAT_REMOTE = "Remote";
public static final String CAT_TEMPORAL = "Temporal";
public static final String CAT_STATS = "Statistics";
public static final String CAT_TABLESPACE = "Tablespace";
public static final String PLAN_COST_FORMAT = "###,###,###,##0.000";
......
......@@ -133,7 +133,7 @@ public class DB2DataSource extends JDBCDataSource implements DBCQueryPlanner, IA
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
return 32764;
}
......
......@@ -26,6 +26,7 @@ import org.jkiss.dbeaver.ext.db2.model.dict.DB2IndexPageSplit;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2IndexType;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2UniqueRule;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2YesNo;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
......@@ -270,43 +271,43 @@ public class DB2Index extends JDBCTableIndex<DB2Schema, DB2TableBase> {
return createTime;
}
@Property(viewable = false, editable = false, order = 30, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 30, category = DBConstants.CAT_STATISTICS)
public Timestamp getStatsTime()
{
return statsTime;
}
@Property(viewable = true, editable = false, order = 31, category = DB2Constants.CAT_STATS)
@Property(viewable = true, editable = false, order = 31, category = DBConstants.CAT_STATISTICS)
public Long getFullKeycard()
{
return fullKeycard;
}
@Property(viewable = false, editable = false, order = 32, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 32, category = DBConstants.CAT_STATISTICS)
public Long getFirstKeycard()
{
return firstKeycard;
}
@Property(viewable = false, editable = false, order = 33, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 33, category = DBConstants.CAT_STATISTICS)
public Long getFirst2Keycard()
{
return first2Keycard;
}
@Property(viewable = false, editable = false, order = 34, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 34, category = DBConstants.CAT_STATISTICS)
public Long getFirst3Keycard()
{
return first3Keycard;
}
@Property(viewable = false, editable = false, order = 35, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 35, category = DBConstants.CAT_STATISTICS)
public Long getFirst4Keycard()
{
return first4Keycard;
}
@Property(viewable = false, editable = false, order = 36, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, order = 36, category = DBConstants.CAT_STATISTICS)
public Integer getClusterRatio()
{
return clusterRatio;
......
......@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.ext.db2.editors.DB2SourceObject;
import org.jkiss.dbeaver.ext.db2.editors.DB2TableTablespaceListProvider;
import org.jkiss.dbeaver.ext.db2.model.cache.DB2TableTriggerCache;
import org.jkiss.dbeaver.ext.db2.model.dict.*;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.data.DBDPseudoAttribute;
......@@ -328,7 +329,7 @@ public class DB2Table extends DB2TableBase
return super.getName();
}
@Property(viewable = true, editable = false, order = 3, category = DB2Constants.CAT_STATS)
@Property(viewable = true, editable = false, order = 3, category = DBConstants.CAT_STATISTICS)
public Long getCard()
{
return card;
......@@ -379,25 +380,25 @@ public class DB2Table extends DB2TableBase
this.longTablespace = longTablespace;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Timestamp getStatsTime()
{
return statsTime;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getnPages()
{
return nPages;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getfPages()
{
return fPages;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getOverFLow()
{
return overFLow;
......
......@@ -23,6 +23,7 @@ import org.jkiss.dbeaver.ext.db2.DB2Constants;
import org.jkiss.dbeaver.ext.db2.editors.DB2SourceObject;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2OwnerType;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TableCheckConstraintType;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
......@@ -203,7 +204,7 @@ public class DB2TableCheckConstraint extends JDBCTableConstraint<DB2Table> imple
return fumcPath;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Integer getPrecentValid()
{
return precentValid;
......
......@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.ext.db2.model.dict.DB2ColumnHiddenState;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TableColumnCompression;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TableColumnGenerated;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2YesNo;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPHiddenObject;
......@@ -399,55 +400,55 @@ public class DB2TableColumn extends JDBCTableColumn<DB2TableBase>
return transactionStartId;
}
@Property(viewable = false, order = 150, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 150, category = DBConstants.CAT_STATISTICS)
public Long getColcard()
{
return colcard;
}
@Property(viewable = false, order = 152, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 152, category = DBConstants.CAT_STATISTICS)
public Integer getAvgLength()
{
return avgLength;
}
@Property(viewable = false, order = 153, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 153, category = DBConstants.CAT_STATISTICS)
public String getLow2key()
{
return low2key;
}
@Property(viewable = false, order = 154, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 154, category = DBConstants.CAT_STATISTICS)
public String getHigh2key()
{
return high2key;
}
@Property(viewable = false, order = 155, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 155, category = DBConstants.CAT_STATISTICS)
public Integer getPctInlined()
{
return pctInlined;
}
@Property(viewable = false, order = 156, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 156, category = DBConstants.CAT_STATISTICS)
public Integer getPctEncoded()
{
return pctEncoded;
}
@Property(viewable = false, order = 157, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 157, category = DBConstants.CAT_STATISTICS)
public Integer getNbQuantiles()
{
return nbQuantiles;
}
@Property(viewable = false, order = 158, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 158, category = DBConstants.CAT_STATISTICS)
public Integer getNbMostFreq()
{
return nbMostFreq;
}
@Property(viewable = false, order = 159, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 159, category = DBConstants.CAT_STATISTICS)
public Long getNbNulls()
{
return nbNulls;
......
......@@ -24,6 +24,7 @@ import org.jkiss.dbeaver.ext.db2.DB2Utils;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TablePartitionAccessMode;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TablePartitionStatus;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2YesNo;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
......@@ -191,31 +192,31 @@ public class DB2TablePartition extends DB2Object<DB2Table> implements DBSTablePa
return highValue;
}
@Property(viewable = false, order = 20, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 20, category = DBConstants.CAT_STATISTICS)
public Timestamp getStatsTime()
{
return statsTime;
}
@Property(viewable = false, order = 21, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 21, category = DBConstants.CAT_STATISTICS)
public Long getCard()
{
return card;
}
@Property(viewable = false, order = 22, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 22, category = DBConstants.CAT_STATISTICS)
public Long getnPages()
{
return nPages;
}
@Property(viewable = false, order = 23, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 23, category = DBConstants.CAT_STATISTICS)
public Long getfPages()
{
return fPages;
}
@Property(viewable = false, order = 24, category = DB2Constants.CAT_STATS)
@Property(viewable = false, order = 24, category = DBConstants.CAT_STATISTICS)
public Long getOverFLow()
{
return overFLow;
......
......@@ -18,7 +18,7 @@
package org.jkiss.dbeaver.ext.db2.model;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.ext.db2.DB2Constants;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
......@@ -83,13 +83,13 @@ public class DB2TablespaceContainer extends DB2Object<DB2Tablespace> {
return containerType;
}
@Property(viewable = true, editable = false, order = 4, category = DB2Constants.CAT_STATS)
@Property(viewable = true, editable = false, order = 4, category = DBConstants.CAT_STATISTICS)
public Long getTotalPages()
{
return totalPages;
}
@Property(viewable = true, editable = false, order = 5, category = DB2Constants.CAT_STATS)
@Property(viewable = true, editable = false, order = 5, category = DBConstants.CAT_STATISTICS)
public Long getUsablePages()
{
return usablePages;
......
......@@ -29,6 +29,7 @@ import org.jkiss.dbeaver.ext.db2.model.dict.DB2TableAccessMode;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TablePartitionMode;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2TableStatus;
import org.jkiss.dbeaver.ext.db2.model.dict.DB2YesNo;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.exec.DBCException;
......@@ -176,31 +177,31 @@ public class DB2Nickname extends DB2TableBase implements DBPNamedObject2, DBPRef
return cachingAllowed;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getCard()
{
return card;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Timestamp getStatsTime()
{
return statsTime;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getnPages()
{
return nPages;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getfPages()
{
return fPages;
}
@Property(viewable = false, editable = false, category = DB2Constants.CAT_STATS)
@Property(viewable = false, editable = false, category = DBConstants.CAT_STATISTICS)
public Long getOverFLow()
{
return overFLow;
......
......@@ -18,6 +18,7 @@
package org.jkiss.dbeaver.ext.db2.model.plan;
import org.jkiss.dbeaver.ext.db2.DB2Constants;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.plan.DBCPlanCostNode;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
......@@ -243,7 +244,7 @@ public class DB2PlanObject extends DB2PlanNode implements DBCPlanCostNode {
return createTime;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Timestamp getStatsTime()
{
return statsTime;
......@@ -285,91 +286,91 @@ public class DB2PlanObject extends DB2PlanNode implements DBCPlanCostNode {
return extentSize;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getPages()
{
return pages;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Double getOverHead()
{
return overHead;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Double getTransferRate()
{
return transferRate;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Double getCluster()
{
return cluster;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getnLeaf()
{
return nLeaf;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Integer getnLevels()
{
return nLevels;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getOverFlow()
{
return overFlow;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getFullKeyCard()
{
return fullKeyCard;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getFirstKeyCard()
{
return firstKeyCard;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getFirst2KeyCard()
{
return first2KeyCard;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getFirst3KeyCard()
{
return first3KeyCard;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getFirst4KeyCard()
{
return first4KeyCard;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Long getSequentialPages()
{
return sequentialPages;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public Integer getDensity()
{
return density;
}
@Property(editable = false, viewable = false, category = DB2Constants.CAT_STATS)
@Property(editable = false, viewable = false, category = DBConstants.CAT_STATISTICS)
public String getStatsSrc()
{
return statsSrc;
......
......@@ -35,7 +35,7 @@ public class ExasolConstants {
public static final String CAT_OWNER = "Owner";
public static final String CAT_SOURCE = "Source";
public static final String CAT_PERFORMANCE = "Performance";
public static final String CAT_STATS = "Statistics";
public static final String DRV_CLIENT_NAME = "clientname";
public static final String DRV_CLIENT_VERSION = "clientversion";
public static final String DRV_QUERYTIMEOUT = "querytimeout";
......
......@@ -20,17 +20,13 @@ package org.jkiss.dbeaver.ext.exasol.model;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.exasol.ExasolConstants;
import org.jkiss.dbeaver.ext.exasol.ExasolMessages;
import org.jkiss.dbeaver.ext.exasol.ExasolSysTablePrefix;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTableForeignKeyCache;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTableIndexCache;
import org.jkiss.dbeaver.ext.exasol.model.cache.ExasolTablePartitionColumnCache;
import org.jkiss.dbeaver.ext.exasol.tools.ExasolUtils;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.DBPRefreshableObject;
import org.jkiss.dbeaver.model.DBPScriptObject;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
......@@ -108,22 +104,22 @@ public class ExasolTable extends ExasolTableBase implements DBPRefreshableObject
return createTime;
}
@Property(viewable = true, expensive = false, editable = false, order = 150, category = ExasolConstants.CAT_STATS, formatter = ByteNumberFormat.class)
@Property(viewable = true, expensive = false, editable = false, order = 150, category = DBConstants.CAT_STATISTICS, formatter = ByteNumberFormat.class)
public long getRawsize(DBRProgressMonitor monitor) throws DBCException {
return sizeRaw;
}
@Property(viewable = true, expensive = false, editable = false, order = 200, category = ExasolConstants.CAT_STATS, formatter = ByteNumberFormat.class)
@Property(viewable = true, expensive = false, editable = false, order = 200, category = DBConstants.CAT_STATISTICS, formatter = ByteNumberFormat.class)
public long getCompressedsize(DBRProgressMonitor monitor) throws DBCException {
return sizeCompressed;
}
@Property(viewable = true, expensive = false, editable = false, order = 250, category = ExasolConstants.CAT_STATS)
@Property(viewable = true, expensive = false, editable = false, order = 250, category = DBConstants.CAT_STATISTICS)
public float getDeletePercentage(DBRProgressMonitor monitor) throws DBCException {
return this.deletePercentage;
}
@Property(viewable = true, expensive = false, editable = false, order = 300, category = ExasolConstants.CAT_STATS)
@Property(viewable = true, expensive = false, editable = false, order = 300, category = DBConstants.CAT_STATISTICS)
public long getTableCount(DBRProgressMonitor monitor) throws DBCException {
return this.tablecount;
}
......
......@@ -248,7 +248,7 @@ public abstract class GenericTableBase extends JDBCTable<GenericDataSource, Gene
// Comment row count calculation - it works too long and takes a lot of resources without serious reason
@Nullable
@Property(viewable = false, expensive = true, order = 5, category = CAT_STATISTICS)
@Property(viewable = false, expensive = true, order = 5, category = DBConstants.CAT_STATISTICS)
public Long getRowCount(DBRProgressMonitor monitor)
{
if (rowCount != null) {
......
......@@ -206,9 +206,9 @@ public class SQLServerDataSource extends JDBCDataSource implements DBSInstanceCo
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_LIMIT_AFFECTS_DML:
case DBPDataSource.FEATURE_LIMIT_AFFECTS_DML:
return true;
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
return 8000;
}
return super.getDataSourceFeature(featureId);
......
......@@ -21,6 +21,7 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.mssql.SQLServerUtils;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPObjectStatistics;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
......@@ -35,12 +36,9 @@ import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAssociation;
import org.jkiss.dbeaver.model.struct.DBSEntityAttribute;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBStructUtils;
import org.jkiss.dbeaver.model.struct.cache.DBSObjectCache;
import org.jkiss.dbeaver.model.struct.rdb.DBSCheckConstraintContainer;
import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
......@@ -48,7 +46,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* SQLServerTable
......@@ -80,20 +77,20 @@ public class SQLServerTable extends SQLServerTableBase implements DBPObjectStati
return false;
}
@Property(category = CAT_STATISTICS, viewable = false, expensive = true, order = 30)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, expensive = true, order = 30)
@Override
public Long getRowCount(DBRProgressMonitor monitor) throws DBCException {
readTableStats(monitor);
return super.getRowCount(monitor);
}
@Property(viewable = true, category = CAT_STATISTICS, order = 31)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 31)
public long getTotalBytes(DBRProgressMonitor monitor) throws DBCException {
readTableStats(monitor);
return totalBytes;
}
@Property(viewable = true, category = CAT_STATISTICS, order = 32)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 32)
public long getUsedBytes(DBRProgressMonitor monitor) throws DBCException {
readTableStats(monitor);
return usedBytes;
......
......@@ -181,7 +181,7 @@ public abstract class SQLServerTableBase extends JDBCTable<SQLServerDataSource,
return null;
}
@Property(category = CAT_STATISTICS, viewable = false, expensive = true, order = 23)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, expensive = true, order = 23)
public Long getRowCount(DBRProgressMonitor monitor) throws DBCException
{
if (rowCount != null || !isPersisted()) {
......
......@@ -23,8 +23,8 @@ import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.mssql.SQLServerConstants;
import org.jkiss.dbeaver.ext.mssql.SQLServerUtils;
import org.jkiss.dbeaver.ext.mssql.model.SQLServerDialect;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
......@@ -70,9 +70,9 @@ public class SQLServerGenericDataSource extends GenericDataSource {
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_LIMIT_AFFECTS_DML:
case DBPDataSource.FEATURE_LIMIT_AFFECTS_DML:
return true;
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
return 8000;
}
return super.getDataSourceFeature(featureId);
......
......@@ -16,6 +16,7 @@
*/
package org.jkiss.dbeaver.ext.mssql.model.session;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.admin.sessions.AbstractServerSession;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
......@@ -29,7 +30,6 @@ import java.util.Date;
public class SQLServerSession extends AbstractServerSession {
private static final String CAT_CLIENT = "Client";
private static final String CAT_TIMING = "Timings";
private static final String CAT_STATISTICS = "Statistics";
private long id;
......@@ -165,37 +165,37 @@ public class SQLServerSession extends AbstractServerSession {
return ntUserName;
}
@Property(viewable = true, category = CAT_STATISTICS, order = 40)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 40)
public long getCpuTime() {
return cpuTime;
}
@Property(viewable = true, category = CAT_STATISTICS, order = 41)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 41)
public long getMemoryUsage() {
return memoryUsage;
}
@Property(viewable = false, category = CAT_STATISTICS, order = 42)
@Property(viewable = false, category = DBConstants.CAT_STATISTICS, order = 42)
public long getTotalScheduledTime() {
return totalScheduledTime;
}
@Property(viewable = false, category = CAT_STATISTICS, order = 43)
@Property(viewable = false, category = DBConstants.CAT_STATISTICS, order = 43)
public long getTotalElapsedTime() {
return totalElapsedTime;
}
@Property(viewable = true, category = CAT_STATISTICS, order = 44)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 44)
public long getReadsNum() {
return readsNum;
}
@Property(viewable = true, category = CAT_STATISTICS, order = 45)
@Property(viewable = true, category = DBConstants.CAT_STATISTICS, order = 45)
public long getWritesNum() {
return writesNum;
}
@Property(viewable = false, category = CAT_STATISTICS, order = 46)
@Property(viewable = false, category = DBConstants.CAT_STATISTICS, order = 46)
public long getRowCount() {
return rowCount;
}
......
......@@ -95,7 +95,7 @@ public class MySQLDataSource extends JDBCDataSource implements DBPObjectStatisti
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
if (isServerVersionAtLeast(5, 0)) {
return 65535;
} else {
......
......@@ -41,7 +41,6 @@ import java.util.Map;
public class MySQLEvent implements MySQLSourceObject, DBPSaveableObject, DBPQualifiedObject {
private static final String CAT_DETAILS = "Details";
private static final String CAT_STATS = "Statistics";
private MySQLCatalog catalog;
private boolean persisted;
......@@ -199,7 +198,7 @@ public class MySQLEvent implements MySQLSourceObject, DBPSaveableObject, DBPQual
return ends;
}
@Property(category = CAT_STATS, order = 35)
@Property(category = DBConstants.CAT_STATISTICS, order = 35)
public String getStatus() {
return status;
}
......@@ -209,17 +208,17 @@ public class MySQLEvent implements MySQLSourceObject, DBPSaveableObject, DBPQual
return onCompletion;
}
@Property(category = CAT_STATS, order = 37)
@Property(category = DBConstants.CAT_STATISTICS, order = 37)
public Date getCreated() {
return created;
}
@Property(category = CAT_STATS, order = 38)
@Property(category = DBConstants.CAT_STATISTICS, order = 38)
public Date getLastAltered() {
return lastAltered;
}
@Property(category = CAT_STATS, order = 39)
@Property(category = DBConstants.CAT_STATISTICS, order = 39)
public Date getLastExecuted() {
return lastExecuted;
}
......
......@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.ext.mysql.model;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.ext.mysql.MySQLConstants;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTableObject;
import org.jkiss.dbeaver.model.meta.Property;
......@@ -34,9 +35,7 @@ import java.util.List;
/**
* MySQLPartition
*/
public class MySQLPartition extends JDBCTableObject<MySQLTable> implements DBSTablePartition
{
private static final String CAT_STATS = "Statistics";
public class MySQLPartition extends JDBCTableObject<MySQLTable> implements DBSTablePartition {
private MySQLPartition parent;
private List<MySQLPartition> subPartitions;
......@@ -179,61 +178,61 @@ public class MySQLPartition extends JDBCTableObject<MySQLTable> implements DBSTa
return nodegroup;
}
@Property(category = CAT_STATS, viewable = true, order = 6)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 6)
public long getTableRows()
{
return tableRows;
}
@Property(category = CAT_STATS, viewable = true, order = 7)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 7)
public long getAvgRowLength()
{
return avgRowLength;
}
@Property(category = CAT_STATS, viewable = true, order = 8)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 8)
public long getDataLength()
{
return dataLength;
}
@Property(category = CAT_STATS, viewable = true, order = 9)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 9)
public long getMaxDataLength()
{
return maxDataLength;
}
@Property(category = CAT_STATS, viewable = true, order = 10)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 10)
public long getIndexLength()
{
return indexLength;
}
@Property(category = CAT_STATS, viewable = true, order = 11)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 11)
public long getDataFree()
{
return dataFree;
}
@Property(category = CAT_STATS, viewable = false, order = 12)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 12)
public Date getCreateTime()
{
return createTime;
}
@Property(category = CAT_STATS, viewable = false, order = 13)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 13)
public Date getUpdateTime()
{
return updateTime;
}
@Property(category = CAT_STATS, viewable = false, order = 14)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 14)
public Date getCheckTime()
{
return checkTime;
}
@Property(category = CAT_STATS, viewable = true, order = 15)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 15)
public long getChecksum()
{
return checksum;
......
......@@ -21,6 +21,7 @@ import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.mysql.MySQLConstants;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPObjectStatistics;
import org.jkiss.dbeaver.model.DBUtils;
......@@ -54,7 +55,6 @@ public class MySQLTable extends MySQLTableBase implements DBPObjectStatistics
private static final Log log = Log.getLog(MySQLTable.class);
private static final String INNODB_COMMENT = "InnoDB free";
public static final String CATEGORY_STATISTICS = "Statistics";
public static class AdditionalInfo {
private volatile boolean loaded = false;
......@@ -78,17 +78,17 @@ public class MySQLTable extends MySQLTableBase implements DBPObjectStatistics
@Property(viewable = false, editable = true, updatable = true, listProvider = CollationListProvider.class, order = 6) public MySQLCollation getCollation() { return collation; }
@Property(viewable = true, editable = true, updatable = true, length = PropertyLength.MULTILINE, order = 100) public String getDescription() { return description; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 10) public long getRowCount() { return rowCount; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 11) public long getAvgRowLength() { return avgRowLength; }
@Property(category = CATEGORY_STATISTICS, viewable = true, order = 12, formatter = ByteNumberFormat.class) public long getDataLength() { return dataLength; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 13, formatter = ByteNumberFormat.class) public long getMaxDataLength() { return maxDataLength; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 14, formatter = ByteNumberFormat.class) public long getDataFree() { return dataFree; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 15, formatter = ByteNumberFormat.class) public long getIndexLength() { return indexLength; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 16) public String getRowFormat() { return rowFormat; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 20) public Date getCreateTime() { return createTime; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 21) public Date getUpdateTime() { return updateTime; }
@Property(category = CATEGORY_STATISTICS, viewable = false, order = 22) public Date getCheckTime() { return checkTime; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 10) public long getRowCount() { return rowCount; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 11) public long getAvgRowLength() { return avgRowLength; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 12, formatter = ByteNumberFormat.class) public long getDataLength() { return dataLength; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 13, formatter = ByteNumberFormat.class) public long getMaxDataLength() { return maxDataLength; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 14, formatter = ByteNumberFormat.class) public long getDataFree() { return dataFree; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 15, formatter = ByteNumberFormat.class) public long getIndexLength() { return indexLength; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 16) public String getRowFormat() { return rowFormat; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 20) public Date getCreateTime() { return createTime; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 21) public Date getUpdateTime() { return updateTime; }
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 22) public Date getCheckTime() { return checkTime; }
public void setEngine(MySQLEngine engine) { this.engine = engine; }
public void setAutoIncrement(long autoIncrement) { this.autoIncrement = autoIncrement; }
......
......@@ -93,7 +93,7 @@ public class OracleDataSource extends JDBCDataSource implements DBPObjectStatist
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
return 4000;
}
......
......@@ -48,7 +48,6 @@ import java.util.Map;
public class OracleSchedulerJob extends OracleSchemaObject implements OracleStatefulObject, DBPScriptObjectExt {
private static final String CAT_SETTINGS = "Settings";
private static final String CAT_STATISTICS = "Statistics";
private static final String CAT_EVENTS = "Events";
private static final String CAT_ADVANCED = "Advanced";
......@@ -339,37 +338,37 @@ public class OracleSchedulerJob extends OracleSchemaObject implements OracleStat
return jobPriority;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 39)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 39)
public long getRunCount() {
return runCount;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 40)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 40)
public long getMaxRuns() {
return maxRuns;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 41)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 41)
public long getFailureCount() {
return failureCount;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 42)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 42)
public long getMaxFailures() {
return maxFailures;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 43)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 43)
public long getRetryCount() {
return retryCount;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 44)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 44)
public String getLastStartDate() {
return lastStartDate;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 45)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 45)
public String getLastRunDuration() {
return lastRunDuration;
}
......
......@@ -42,7 +42,10 @@ import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* OracleTable
......@@ -81,41 +84,41 @@ public class OracleTable extends OracleTablePhysical implements DBPScriptObject,
private int avgSpaceFreelistBlocks;
private int numFreelistBlocks;
@Property(category = CAT_STATISTICS, order = 31)
@Property(category = DBConstants.CAT_STATISTICS, order = 31)
public int getPctFree() { return pctFree; }
@Property(category = CAT_STATISTICS, order = 32)
@Property(category = DBConstants.CAT_STATISTICS, order = 32)
public int getPctUsed() { return pctUsed; }
@Property(category = CAT_STATISTICS, order = 33)
@Property(category = DBConstants.CAT_STATISTICS, order = 33)
public int getIniTrans() { return iniTrans; }
@Property(category = CAT_STATISTICS, order = 34)
@Property(category = DBConstants.CAT_STATISTICS, order = 34)
public int getMaxTrans() { return maxTrans; }
@Property(category = CAT_STATISTICS, order = 35)
@Property(category = DBConstants.CAT_STATISTICS, order = 35)
public int getInitialExtent() { return initialExtent; }
@Property(category = CAT_STATISTICS, order = 36)
@Property(category = DBConstants.CAT_STATISTICS, order = 36)
public int getNextExtent() { return nextExtent; }
@Property(category = CAT_STATISTICS, order = 37)
@Property(category = DBConstants.CAT_STATISTICS, order = 37)
public int getMinExtents() { return minExtents; }
@Property(category = CAT_STATISTICS, order = 38)
@Property(category = DBConstants.CAT_STATISTICS, order = 38)
public int getMaxExtents() { return maxExtents; }
@Property(category = CAT_STATISTICS, order = 39)
@Property(category = DBConstants.CAT_STATISTICS, order = 39)
public int getPctIncrease() { return pctIncrease; }
@Property(category = CAT_STATISTICS, order = 40)
@Property(category = DBConstants.CAT_STATISTICS, order = 40)
public int getFreelists() { return freelists; }
@Property(category = CAT_STATISTICS, order = 41)
@Property(category = DBConstants.CAT_STATISTICS, order = 41)
public int getFreelistGroups() { return freelistGroups; }
@Property(category = CAT_STATISTICS, order = 42)
@Property(category = DBConstants.CAT_STATISTICS, order = 42)
public int getBlocks() { return blocks; }
@Property(category = CAT_STATISTICS, order = 43)
@Property(category = DBConstants.CAT_STATISTICS, order = 43)
public int getEmptyBlocks() { return emptyBlocks; }
@Property(category = CAT_STATISTICS, order = 44)
@Property(category = DBConstants.CAT_STATISTICS, order = 44)
public int getAvgSpace() { return avgSpace; }
@Property(category = CAT_STATISTICS, order = 45)
@Property(category = DBConstants.CAT_STATISTICS, order = 45)
public int getChainCount() { return chainCount; }
@Property(category = CAT_STATISTICS, order = 46)
@Property(category = DBConstants.CAT_STATISTICS, order = 46)
public int getAvgRowLen() { return avgRowLen; }
@Property(category = CAT_STATISTICS, order = 47)
@Property(category = DBConstants.CAT_STATISTICS, order = 47)
public int getAvgSpaceFreelistBlocks() { return avgSpaceFreelistBlocks; }
@Property(category = CAT_STATISTICS, order = 48)
@Property(category = DBConstants.CAT_STATISTICS, order = 48)
public int getNumFreelistBlocks() { return numFreelistBlocks; }
}
......@@ -188,7 +191,7 @@ public class OracleTable extends OracleTablePhysical implements DBPScriptObject,
}
@Property(viewable = false, category = CAT_STATISTICS, formatter = ByteNumberFormat.class)
@Property(viewable = false, category = DBConstants.CAT_STATISTICS, formatter = ByteNumberFormat.class)
public Long getTableSize(DBRProgressMonitor monitor) throws DBCException {
if (tableSize == null) {
loadSize(monitor);
......
......@@ -20,6 +20,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
......@@ -76,13 +77,13 @@ public abstract class OracleTablePhysical extends OracleTableBase implements DBS
this.partitionCache = partitioned ? new PartitionCache() : null;
}
@Property(category = CAT_STATISTICS, viewable = true, order = 20)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 20)
public long getRowCount()
{
return rowCount;
}
@Property(category = CAT_STATISTICS, viewable = false, expensive = true, order = 21)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, expensive = true, order = 21)
public synchronized Long getRealRowCount(DBRProgressMonitor monitor)
{
if (realRowCount != null) {
......
......@@ -33,7 +33,6 @@ public class OracleServerSession extends AbstractServerSession {
public static final String CAT_PROCESS = "Process";
public static final String CAT_IO = "IO";
public static final String CAT_WAIT = "Wait";
//public static final String CAT_STAT = "Statistics";
private long instId;
private long sid;
......
......@@ -103,9 +103,9 @@ public class PostgreDataSource extends JDBCDataSource implements DBSInstanceCont
@Override
public Object getDataSourceFeature(String featureId) {
switch (featureId) {
case DBConstants.FEATURE_MAX_STRING_LENGTH:
case DBPDataSource.FEATURE_MAX_STRING_LENGTH:
return 10485760;
case DBConstants.FEATURE_LOB_REQUIRE_TRANSACTIONS:
case DBPDataSource.FEATURE_LOB_REQUIRE_TRANSACTIONS:
return true;
}
return super.getDataSourceFeature(featureId);
......
......@@ -54,7 +54,6 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
private static final String CAT_FLAGS = "Flags";
private static final String CAT_PROPS = "Properties";
private static final String CAT_STATS = "Statistics";
public static final float DEFAULT_EST_ROWS = 1000.0f;
public static final float DEFAULT_COST = 100.0f;
......@@ -549,12 +548,12 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
return procTransform;
}
@Property(category = CAT_STATS, viewable = false, order = 30)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 30)
public float getExecCost() {
return execCost;
}
@Property(category = CAT_STATS, viewable = false, order = 31)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 31)
public float getEstRows() {
return estRows;
}
......
......@@ -20,6 +20,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPObjectStatistics;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCSession;
......@@ -86,12 +87,12 @@ public abstract class PostgreTableReal extends PostgreTableBase implements DBPOb
return triggerCache;
}
@Property(category = CAT_STATISTICS, viewable = true, order = 22)
@Property(category = DBConstants.CAT_STATISTICS, viewable = true, order = 22)
public long getRowCountEstimate() {
return rowCountEstimate;
}
@Property(category = CAT_STATISTICS, viewable = false, expensive = true, order = 23)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, expensive = true, order = 23)
public Long getRowCount(DBRProgressMonitor monitor)
{
if (rowCount != null) {
......@@ -115,7 +116,7 @@ public abstract class PostgreTableReal extends PostgreTableBase implements DBPOb
return rowCount;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 24, formatter = ByteNumberFormat.class)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 24, formatter = ByteNumberFormat.class)
public Long getDiskSpace(DBRProgressMonitor monitor)
{
readTableStats(monitor);
......@@ -123,7 +124,7 @@ public abstract class PostgreTableReal extends PostgreTableBase implements DBPOb
return diskSpace;
}
@Property(category = CAT_STATISTICS, viewable = false, order = 25, formatter = ByteNumberFormat.class)
@Property(category = DBConstants.CAT_STATISTICS, viewable = false, order = 25, formatter = ByteNumberFormat.class)
public long getRelationSize(DBRProgressMonitor monitor) {
readTableStats(monitor);
return tableRelSize;
......
......@@ -29,31 +29,7 @@ import java.util.Locale;
public class DBConstants {
/////////////////////////////////
// Features
/**
* Row limit (setMaxSize) affects DML (UPDATE, INSERT, etc) statements.
*/
public static final String FEATURE_LIMIT_AFFECTS_DML = "datasource.limit-affects-dml";
/**
* LOB value operations require enabled transactions. I.e. LOB locator life time is 1 transaction.
*/
public static final String FEATURE_LOB_REQUIRE_TRANSACTIONS = "datasource.lob-require-transactions";
/**
* Max string length. Used by data transfer/compare/migration tools.
* null means "unknown", -1 means any length (i.e. explicit length is not needed)
*/
public static final String FEATURE_MAX_STRING_LENGTH = "datasource.max-string-type-length";
/////////////////////////////////
// Misc
public static final int METADATA_FETCH_SIZE = 1000;
public static final String DATA_SOURCE_PROPERTY_USER = "user"; //NON-NLS-1
public static final String DATA_SOURCE_PROPERTY_PASSWORD = "password"; //NON-NLS-1
public static final String NULL_VALUE_LABEL = "[NULL]"; //NON-NLS-1
// Standard properties
public static final String PROP_ID_NAME = "name"; //NON-NLS-1
public static final String PROP_ID_DESCRIPTION = "description"; //NON-NLS-1
......@@ -68,9 +44,22 @@ public class DBConstants {
public static final String PARAM_OBJECT_DEFINITION_TEXT = "objectDefinitionText"; //NON-NLS-1
public static final String PARAM_EXTENDED_DEFINITION_TEXT = "extendedDefinitionText"; //NON-NLS-1
/////////////////////////////////
// Variables
public static final String VAR_CONTEXT_NAME = "context.name";
public static final String VAR_CONTEXT_ID = "context.id";
/////////////////////////////////
// Misc
public static final int METADATA_FETCH_SIZE = 1000;
public static final String DATA_SOURCE_PROPERTY_USER = "user"; //NON-NLS-1
public static final String DATA_SOURCE_PROPERTY_PASSWORD = "password"; //NON-NLS-1
public static final String NULL_VALUE_LABEL = "[NULL]"; //NON-NLS-1
// Internal properties prefix. This is a legacy properties marker (used to divide driver properties from provider properties)
// Left for backward compatibility. Do not use it for new provider property names
public static final String INTERNAL_PROP_PREFIX = "@dbeaver-"; //NON-NLS-1
......@@ -123,4 +112,27 @@ public class DBConstants {
public static final String LABEL_NA = "N/A";
public static final String DEBUG_LOG_FILE_NAME = "dbeaver-debug.log";
/////////////////////////////////
// Property categories and features
public static final String CAT_MAIN = "Main";
public static final String CAT_STATISTICS = "Statistics";
public static final String PROP_FEATURE_EXPENSIVE = "expensive";
public static final String PROP_FEATURE_NUMERIC = "numeric";
public static final String PROP_FEATURE_DATETME = "datetme";
public static final String PROP_FEATURE_HIDDEN = "hidden";
public static final String PROP_FEATURE_REMOTE = "remote";
public static final String PROP_FEATURE_OPTIONAL = "optional";
public static final String PROP_FEATURE_SPECIFIC = "specific";
public static final String PROP_FEATURE_REQUIRED = "required";
public static final String PROP_FEATURE_PASSWORD = "password";
public static final String PROP_FEATURE_NAME = "name";
public static final String PROP_FEATURE_MULTILINE = "multiline";
public static final String PROP_FEATURE_EDIT_POSSIBLE = "editPossible";
public static final String PROP_FEATURE_LINK_POSSIBLE = "linkPossible";
public static final String PROP_FEATURE_HREF = "href";
public static final String PROP_FEATURE_VIEWABLE = "viewable";
}
......@@ -33,6 +33,20 @@ import org.jkiss.dbeaver.model.struct.DBSInstanceContainer;
*/
public interface DBPDataSource extends DBSInstanceContainer
{
/**
* Row limit (setMaxSize) affects DML (UPDATE, INSERT, etc) statements.
*/
String FEATURE_LIMIT_AFFECTS_DML = "datasource.limit-affects-dml";
/**
* LOB value operations require enabled transactions. I.e. LOB locator life time is 1 transaction.
*/
String FEATURE_LOB_REQUIRE_TRANSACTIONS = "datasource.lob-require-transactions";
/**
* Max string length. Used by data transfer/compare/migration tools.
* null means "unknown", -1 means any length (i.e. explicit length is not needed)
*/
String FEATURE_MAX_STRING_LENGTH = "datasource.max-string-type-length";
/**
* Datasource container
* @return container implementation
......
......@@ -1211,7 +1211,7 @@ public final class DBUtils {
final boolean hasLimits = (offset > 0 || selectQuery) && maxRows > 0;
// This is a flag for any potential SELECT query
boolean possiblySelect = sqlQuery.getType() == SQLQueryType.SELECT || sqlQuery.getType() == SQLQueryType.UNKNOWN;
boolean limitAffectsDML = Boolean.TRUE.equals(session.getDataSource().getDataSourceFeature(DBConstants.FEATURE_LIMIT_AFFECTS_DML));
boolean limitAffectsDML = Boolean.TRUE.equals(session.getDataSource().getDataSourceFeature(DBPDataSource.FEATURE_LIMIT_AFFECTS_DML));
DBCQueryTransformer limitTransformer = null, fetchAllTransformer = null;
if (selectQuery) {
......
......@@ -60,8 +60,6 @@ public abstract class JDBCTable<DATASOURCE extends DBPDataSource, CONTAINER exte
{
private static final Log log = Log.getLog(JDBCTable.class);
protected static final String CAT_STATISTICS = "Statistics";
private static final String DEFAULT_TABLE_ALIAS = "x";
private boolean persisted;
......
......@@ -660,7 +660,7 @@ public abstract class AbstractSQLDialect implements SQLDialect {
if (typeName.indexOf('(') == -1) {
long maxLength = column.getMaxLength();
if (maxLength > 0 && maxLength != Integer.MAX_VALUE && maxLength != Long.MAX_VALUE) {
Object maxStringLength = dataSource.getDataSourceFeature(DBConstants.FEATURE_MAX_STRING_LENGTH);
Object maxStringLength = dataSource.getDataSourceFeature(DBPDataSource.FEATURE_MAX_STRING_LENGTH);
if (maxStringLength instanceof Number) {
int lengthLimit = ((Number) maxStringLength).intValue();
if (lengthLimit < 0) {
......
......@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.runtime.properties;
import org.eclipse.core.internal.runtime.Activator;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPPersistedObject;
import org.jkiss.dbeaver.model.exec.DBExecUtils;
import org.jkiss.dbeaver.model.impl.AbstractDescriptor;
......@@ -49,6 +50,7 @@ import java.util.ResourceBundle;
*/
public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implements DBPPropertyDescriptor, IPropertyValueListProvider<Object>
{
private final Property propInfo;
private final String propName;
private final String propDescription;
......@@ -223,56 +225,58 @@ public class ObjectPropertyDescriptor extends ObjectAttributeDescriptor implemen
@Override
public String[] getFeatures() {
List<String> features = new ArrayList<>();
if (this.isRequired()) features.add("required");
if (this.isSpecific()) features.add("specific");
if (this.isOptional()) features.add("optional");
if (this.isHidden()) features.add("hidden");
if (this.isRemote()) features.add("remote");
if (this.isDateTime()) features.add("datetme");
if (this.isNumeric()) features.add("numeric");
if (this.isNameProperty()) features.add("name");
if (this.getLength() == PropertyLength.MULTILINE) features.add("multiline");
if (this.isExpensive()) features.add("expensive");
if (this.isEditPossible()) features.add("editPossible");
if (this.isLinkPossible()) features.add("linkPossible");
if (this.isHref()) features.add("href");
if (this.isViewable()) features.add("viewable");
if (this.isPassword()) features.add("password");
if (this.isRequired()) features.add(DBConstants.PROP_FEATURE_REQUIRED);
if (this.isSpecific()) features.add(DBConstants.PROP_FEATURE_SPECIFIC);
if (this.isOptional()) features.add(DBConstants.PROP_FEATURE_OPTIONAL);
if (this.isHidden()) features.add(DBConstants.PROP_FEATURE_HIDDEN);
if (this.isRemote()) features.add(DBConstants.PROP_FEATURE_REMOTE);
if (this.isDateTime()) features.add(DBConstants.PROP_FEATURE_DATETME);
if (this.isNumeric()) features.add(DBConstants.PROP_FEATURE_NUMERIC);
if (this.isNameProperty()) features.add(DBConstants.PROP_FEATURE_NAME);
if (this.getLength() == PropertyLength.MULTILINE) features.add(DBConstants.PROP_FEATURE_MULTILINE);
if (this.isExpensive()) features.add(DBConstants.PROP_FEATURE_EXPENSIVE);
if (this.isEditPossible()) features.add(DBConstants.PROP_FEATURE_EDIT_POSSIBLE);
if (this.isLinkPossible()) features.add(DBConstants.PROP_FEATURE_LINK_POSSIBLE);
if (this.isHref()) features.add(DBConstants.PROP_FEATURE_HREF);
if (this.isViewable()) features.add(DBConstants.PROP_FEATURE_VIEWABLE);
if (this.isPassword()) features.add(DBConstants.PROP_FEATURE_PASSWORD);
return features.toArray(new String[0]);
}
@Override
public boolean hasFeature(@NotNull String feature) {
switch (feature) {
case "required":
case DBConstants.PROP_FEATURE_REQUIRED:
return this.isRequired();
case "specific":
case DBConstants.PROP_FEATURE_SPECIFIC:
return this.isSpecific();
case "optional":
case DBConstants.PROP_FEATURE_OPTIONAL:
return this.isOptional();
case "hidden":
case DBConstants.PROP_FEATURE_HIDDEN:
return this.isHidden();
case "datetme":
case DBConstants.PROP_FEATURE_DATETME:
return this.isDateTime();
case "numeric":
case DBConstants.PROP_FEATURE_NUMERIC:
return this.isNumeric();
case "name":
case DBConstants.PROP_FEATURE_NAME:
return this.isNameProperty();
case "multiline":
case DBConstants.PROP_FEATURE_MULTILINE:
return this.getLength() == PropertyLength.MULTILINE;
case "expensive":
case DBConstants.PROP_FEATURE_EXPENSIVE:
return this.isExpensive();
case "editPossible":
case DBConstants.PROP_FEATURE_EDIT_POSSIBLE:
return this.isEditPossible();
case "linkPossible":
case DBConstants.PROP_FEATURE_LINK_POSSIBLE:
return this.isLinkPossible();
case "viewable":
case DBConstants.PROP_FEATURE_HREF:
return this.isHref();
case DBConstants.PROP_FEATURE_VIEWABLE:
return this.isViewable();
case "password":
case DBConstants.PROP_FEATURE_PASSWORD:
return this.isPassword();
}
return false;
......
......@@ -66,6 +66,7 @@ public class PropertyPageStandard extends PropertySheetPage implements ILazyProp
}
);
setPropertySourceProvider(this);
// Register lazy load listener
PropertiesContributor.getInstance().addLazyListener(this);
}
......
......@@ -23,6 +23,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySheetEntry;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
......@@ -83,7 +84,11 @@ public class PropertyDescriptorDelegate implements IPropertyDescriptor
@Override
public String getCategory() {
return delegate.getCategory();
String category = delegate.getCategory();
if (CommonUtils.isEmpty(category)) {
category = DBConstants.CAT_MAIN;
}
return category;
}
@Override
......@@ -98,6 +103,12 @@ public class PropertyDescriptorDelegate implements IPropertyDescriptor
@Override
public String[] getFilterFlags() {
if (delegate.hasFeature(DBConstants.PROP_FEATURE_EXPENSIVE) ||
delegate.hasFeature(DBConstants.PROP_FEATURE_HIDDEN) ||
DBConstants.CAT_STATISTICS.equals(delegate.getCategory()))
{
return new String[] { IPropertySheetEntry.FILTER_ID_EXPERT };
}
return null;
}
......
......@@ -18,6 +18,7 @@ package org.jkiss.dbeaver.ui.properties;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
import org.jkiss.dbeaver.model.DBPNamedObject;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.utils.CommonUtils;
......@@ -58,7 +59,11 @@ public class PropertySourceDelegate implements IPropertySource2
@Override
public Object getPropertyValue(Object id) {
return source.getPropertyValue(null, CommonUtils.toString(id));
Object value = source.getPropertyValue(null, CommonUtils.toString(id));
if (value instanceof DBPNamedObject) {
return ((DBPNamedObject) value).getName();
}
return CommonUtils.toString(value);
}
@Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册