提交 f2522114 编写于 作者: S Serge Rider

Minor fixes (presto)

上级 8a4f2c72
......@@ -18,7 +18,7 @@ package org.jkiss.dbeaver.ext.sqlite.model;
import org.jkiss.dbeaver.ext.generic.model.GenericTableBase;
import org.jkiss.dbeaver.ext.generic.model.GenericTableColumn;
import org.jkiss.dbeaver.model.impl.DBPositiveNumberTransformer;
import org.jkiss.dbeaver.model.impl.DBDummyNumberTransformer;
import org.jkiss.dbeaver.model.meta.Property;
public class SQLiteTableColumn extends GenericTableColumn {
......@@ -33,7 +33,7 @@ public class SQLiteTableColumn extends GenericTableColumn {
return super.isAutoGenerated();
}
@Property(viewable = true, editable = true, order = 40, valueRenderer = DBPositiveNumberTransformer.class)
@Property(viewable = true, editable = true, order = 40, valueRenderer = DBDummyNumberTransformer.class)
@Override
public long getMaxLength() {
return super.getMaxLength();
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* 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.model.impl;
import org.jkiss.dbeaver.model.meta.IPropertyValueTransformer;
import org.jkiss.dbeaver.model.struct.DBSObject;
/**
* Shows numeric value if it is not zero and not MAX_VALUE
*/
public class DBDummyNumberTransformer implements IPropertyValueTransformer<DBSObject, Number> {
@Override
public Number transform(DBSObject object, Number value) {
if (value == null) {
return null;
}
if (value instanceof Double && (value.doubleValue() == 0.0 || value.doubleValue() == Double.MAX_VALUE)) {
return null;
} else if (value instanceof Float && (value.floatValue() == 0.0 || value.floatValue() == Float.MAX_VALUE)) {
return null;
} else if ((value.longValue() == 0 || value.longValue() == Long.MAX_VALUE || value.longValue() == Integer.MAX_VALUE)) {
return null;
}
return value;
}
}
......@@ -33,6 +33,7 @@ import org.jkiss.dbeaver.model.struct.cache.AbstractObjectCache;
import org.jkiss.utils.CommonUtils;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.*;
/**
......@@ -344,7 +345,11 @@ public abstract class JDBCCompositeCache<
}
}
catch (SQLException ex) {
throw new DBException(ex, dataSource);
if (ex instanceof SQLFeatureNotSupportedException) {
log.debug("Error reading cache: feature not supported", ex);
} else {
throw new DBException(ex, dataSource);
}
}
if (monitor.isCanceled()) {
......
......@@ -26,6 +26,7 @@ import org.jkiss.dbeaver.model.exec.DBCResultSet;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.DBCStatement;
import org.jkiss.dbeaver.model.exec.DBCStatementType;
import org.jkiss.dbeaver.model.impl.DBDummyNumberTransformer;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.meta.IPropertyValueListProvider;
import org.jkiss.dbeaver.model.meta.Property;
......@@ -37,7 +38,10 @@ import org.jkiss.dbeaver.model.struct.rdb.DBSTableColumn;
import org.jkiss.dbeaver.model.virtual.DBVUtils;
import org.jkiss.utils.CommonUtils;
import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
/**
* JDBC abstract table column
......@@ -132,7 +136,7 @@ public abstract class JDBCTableColumn<TABLE_TYPE extends DBSEntity> extends JDBC
}
}
@Property(viewable = true, editable = true, order = 40)
@Property(viewable = true, editable = true, order = 40, valueRenderer = DBDummyNumberTransformer.class)
@Override
public long getMaxLength()
{
......
......@@ -28,6 +28,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.jkiss.dbeaver.ui.data.IStreamValueManager;
import org.jkiss.dbeaver.ui.data.IValueManager;
import org.jkiss.dbeaver.ui.data.managers.DefaultValueManager;
import org.jkiss.utils.CommonUtils;
import org.jkiss.utils.MimeType;
......@@ -79,7 +80,7 @@ public class ValueManagerRegistry {
manager = findManager(dataSource, type, valueType, false, false);
}
if (manager == null) {
throw new IllegalStateException("Can't find default data manager for " + type);
return DefaultValueManager.INSTANCE;
}
return manager;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册