未验证 提交 5d807ea2 编写于 作者: A Anastasiya 提交者: GitHub

#15763 fix potential NPEs and recreate statement (#15787)

上级 c9be8634
......@@ -113,7 +113,7 @@ public class OracleMaterializedViewManager extends SQLObjectEditor<OracleMateria
boolean hasComment = command.hasProperty("comment");
if (!hasComment || command.getProperties().size() > 1) {
String mViewDefinition = view.getMViewText().trim();
if (mViewDefinition.startsWith("CREATE MATERIALIZED VIEW")) {
if (mViewDefinition.contains("CREATE MATERIALIZED VIEW")) {
if (mViewDefinition.endsWith(";")) mViewDefinition = mViewDefinition.substring(0, mViewDefinition.length() - 1);
decl.append(mViewDefinition);
} else {
......@@ -131,7 +131,7 @@ public class OracleMaterializedViewManager extends SQLObjectEditor<OracleMateria
actions.add(new SQLDatabasePersistAction(
"Comment table",
"COMMENT ON MATERIALIZED VIEW " + view.getFullyQualifiedName(DBPEvaluationContext.DDL) +
" IS " + SQLUtils.quoteString(view.getDataSource(), view.getComment())));
" IS " + SQLUtils.quoteString(view.getDataSource(), CommonUtils.notEmpty(view.getComment()))));
}
}
......
......@@ -35,6 +35,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectLazy;
import org.jkiss.dbeaver.model.struct.DBSObjectState;
import org.jkiss.utils.CommonUtils;
import java.sql.ResultSet;
import java.sql.SQLException;
......@@ -175,7 +176,7 @@ public class OracleMaterializedView extends OracleTableBase implements OracleSou
currentDDLFormat = OracleDDLFormat.getCurrentFormat(getDataSource());
}
OracleDDLFormat newFormat = OracleDDLFormat.FULL;
boolean isFormatInOptions = options.containsKey(OracleConstants.PREF_KEY_DDL_FORMAT);
boolean isFormatInOptions = !CommonUtils.isEmpty(options) && options.containsKey(OracleConstants.PREF_KEY_DDL_FORMAT);
if (isFormatInOptions) {
newFormat = (OracleDDLFormat) options.get(OracleConstants.PREF_KEY_DDL_FORMAT);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册