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

Merge remote-tracking branch 'origin/devel' into devel

......@@ -154,7 +154,7 @@ class ResultSetFilterPanel extends Composite
e.gc.setForeground(shadowColor);
e.gc.setFont(hintFont);
e.gc.drawText(supportsDataFilter ?
"Enter an SQL expression to filter results" :
"Enter a SQL expression to filter results" :
"Data filter is not supported",
2, 0);
e.gc.setFont(null);
......
......@@ -104,8 +104,15 @@ public class DB2TableColumnManager extends SQLTableColumnManager<DB2TableColumn,
List<DBEPersistAction> actions = new ArrayList<>(3);
String sqlAlterColumn = String.format(SQL_ALTER, db2Column.getTable().getFullQualifiedName(), computeDeltaSQL(command));
actions.add(new SQLDatabasePersistAction(CMD_ALTER, sqlAlterColumn));
boolean hasColumnChanges = false;
if (!command.getProperties().isEmpty()) {
final String deltaSQL = computeDeltaSQL(command);
if (!deltaSQL.isEmpty()) {
hasColumnChanges = true;
String sqlAlterColumn = String.format(SQL_ALTER, db2Column.getTable().getFullQualifiedName(), deltaSQL);
actions.add(new SQLDatabasePersistAction(CMD_ALTER, sqlAlterColumn));
}
}
// Comment
DBEPersistAction commentAction = buildCommentAction(db2Column);
......@@ -113,8 +120,10 @@ public class DB2TableColumnManager extends SQLTableColumnManager<DB2TableColumn,
actions.add(commentAction);
}
// Be Safe, Add a reorg action
actions.add(buildReorgAction(db2Column));
if (hasColumnChanges) {
// Be Safe, Add a reorg action
actions.add(buildReorgAction(db2Column));
}
return actions.toArray(new DBEPersistAction[actions.size()]);
}
......@@ -125,7 +134,9 @@ public class DB2TableColumnManager extends SQLTableColumnManager<DB2TableColumn,
private String computeDeltaSQL(ObjectChangeCommand command)
{
if (command.getProperties().isEmpty()) {
if (command.getProperties().isEmpty() ||
(command.getProperties().size() == 1 && command.getProperty("description") != null))
{
return "";
}
......
......@@ -317,7 +317,7 @@ public class DB2TableColumn extends JDBCTableColumn<DB2TableBase>
@Nullable
@Override
@Property(viewable = false, order = 999, editable = true, updatable = true)
@Property(viewable = true, order = 999, editable = true, updatable = true)
public String getDescription()
{
return remarks;
......
......@@ -33,7 +33,12 @@ import org.jkiss.dbeaver.model.impl.jdbc.data.*;
import org.jkiss.dbeaver.model.messages.ModelMessages;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import org.jkiss.dbeaver.utils.MimeTypes;
import org.jkiss.utils.IOUtils;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringWriter;
import java.sql.*;
/**
......@@ -183,6 +188,29 @@ public class JDBCContentValueHandler extends JDBCAbstractValueHandler {
return clob;
} else if (object instanceof SQLXML) {
return new JDBCContentXML(session.getDataSource(), (SQLXML) object);
} else if (object instanceof InputStream) {
// Some weird drivers returns InputStream instead of Xlob.
// Copy stream to byte array
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
final InputStream stream = (InputStream) object;
try {
IOUtils.copyStream(stream, buffer);
} catch (Exception e) {
throw new DBCException("Error reading content stream", e);
}
IOUtils.close(stream);
return new JDBCContentBytes(session.getDataSource(), buffer.toByteArray());
} else if (object instanceof Reader) {
// Copy reader to string
StringWriter buffer = new StringWriter();
final Reader reader = (Reader) object;
try {
IOUtils.copyText(reader, buffer);
} catch (Exception e) {
throw new DBCException("Error reading content reader", e);
}
IOUtils.close(reader);
return new JDBCContentChars(session.getDataSource(), buffer.toString());
} else if (object instanceof DBDContent) {
if (copy && object instanceof DBDValueCloneable) {
return (DBDContent) ((DBDValueCloneable)object).cloneValue(session.getProgressMonitor());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册