提交 907aeee8 编写于 作者: S Serge Rider

Virtual model additions


Former-commit-id: e6acd3eb
上级 120ab81a
......@@ -86,7 +86,7 @@ public interface DBDValueHandler
* @param session execution context
* @param type attribute type
* @param object source object
* @param copy
* @param copy copy object
* @return initial object value
* @throws org.jkiss.dbeaver.model.exec.DBCException on error
*/
......
......@@ -361,16 +361,11 @@ public final class SQLUtils {
}
public static String convertValueToSQL(DBPDataSource dataSource, DBSAttributeBase attribute, @Nullable Object value) {
String strValue;
if (DBUtils.isNullValue(value)) {
return SQLConstants.NULL_VALUE;
}
DBDValueHandler valueHandler = DBUtils.findValueHandler(dataSource, attribute);
if (valueHandler == null) {
strValue = String.valueOf(value);
} else {
strValue = valueHandler.getValueDisplayString(attribute, value, DBDDisplayFormat.NATIVE);
}
String strValue = valueHandler.getValueDisplayString(attribute, value, DBDDisplayFormat.NATIVE);
SQLDialect sqlDialect = null;
if (dataSource instanceof SQLDataSource) {
sqlDialect = ((SQLDataSource) dataSource).getSQLDialect();
......
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2015 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.model.virtual;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPDataKind;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.impl.struct.AbstractAttribute;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntity;
import org.jkiss.dbeaver.model.struct.DBSEntityAttribute;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectContainer;
/**
* Virtual attribute
*/
public class DBVEntityAttribute extends AbstractAttribute implements DBSEntityAttribute
{
private final DBVEntity entity;
private String name;
public DBVEntityAttribute(DBVEntity entity, String name) {
this.entity = entity;
}
@Nullable
public DBSEntityAttribute getRealAttribute(DBRProgressMonitor monitor) throws DBException
{
final DBSEntity realEntity = entity.getRealEntity(monitor);
return realEntity == null ? null : realEntity.getAttribute(monitor, getName());
}
@NotNull
@Override
public String getName() {
return name;
}
@Override
public DBPDataKind getDataKind() {
return null;
}
@Nullable
@Override
public String getDefaultValue() {
return null;
}
@NotNull
@Override
public DBSEntity getParentObject() {
return entity;
}
@NotNull
@Override
public DBPDataSource getDataSource() {
return entity.getDataSource();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册