提交 77214dc9 编写于 作者: S Serge Rider

Column names copier fix (copy quoted column names if needed)

上级 71bd4b40
...@@ -43,6 +43,8 @@ import org.eclipse.ui.handlers.HandlerUtil; ...@@ -43,6 +43,8 @@ import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.jkiss.code.Nullable; import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.data.DBDAttributeBinding; import org.jkiss.dbeaver.model.data.DBDAttributeBinding;
import org.jkiss.dbeaver.model.data.DBDDisplayFormat; import org.jkiss.dbeaver.model.data.DBDDisplayFormat;
import org.jkiss.dbeaver.model.data.DBDValueDefaultGenerator; import org.jkiss.dbeaver.model.data.DBDValueDefaultGenerator;
...@@ -158,6 +160,7 @@ public class ResultSetHandlerMain extends AbstractHandler { ...@@ -158,6 +160,7 @@ public class ResultSetHandlerMain extends AbstractHandler {
Shell activeShell = HandlerUtil.getActiveShell(event); Shell activeShell = HandlerUtil.getActiveShell(event);
String actionId = event.getCommand().getId(); String actionId = event.getCommand().getId();
IResultSetPresentation presentation = rsv.getActivePresentation(); IResultSetPresentation presentation = rsv.getActivePresentation();
DBPDataSource dataSource = rsv.getDataContainer().getDataSource();
switch (actionId) { switch (actionId) {
case IWorkbenchCommandConstants.FILE_REFRESH: case IWorkbenchCommandConstants.FILE_REFRESH:
rsv.refreshData(null); rsv.refreshData(null);
...@@ -284,8 +287,8 @@ public class ResultSetHandlerMain extends AbstractHandler { ...@@ -284,8 +287,8 @@ public class ResultSetHandlerMain extends AbstractHandler {
} }
if (!sqlScript.isEmpty()) { if (!sqlScript.isEmpty()) {
String scriptText = SQLUtils.generateScript( String scriptText = SQLUtils.generateScript(
rsv.getDataContainer() == null ? null : rsv.getDataContainer().getDataSource(), rsv.getDataContainer() == null ? null : dataSource,
sqlScript.toArray(new DBEPersistAction[sqlScript.size()]), sqlScript.toArray(new DBEPersistAction[0]),
false); false);
scriptText = scriptText =
SQLUtils.generateCommentLine( SQLUtils.generateCommentLine(
...@@ -330,7 +333,11 @@ public class ResultSetHandlerMain extends AbstractHandler { ...@@ -330,7 +333,11 @@ public class ResultSetHandlerMain extends AbstractHandler {
if (CommonUtils.isEmpty(colName)) { if (CommonUtils.isEmpty(colName)) {
colName = attr.getName(); colName = attr.getName();
} }
buffer.append(colName); if (dataSource == null) {
buffer.append(colName);
} else {
buffer.append(DBUtils.getQuotedIdentifier(dataSource, colName));
}
} }
ResultSetUtils.copyToClipboard(buffer.toString()); ResultSetUtils.copyToClipboard(buffer.toString());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册