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

#1353 Oracle 8 - views meta-info reading fix

上级 7e3c7eb1
......@@ -270,6 +270,10 @@ public class OracleDataSource extends JDBCDataSource
return publicSchema.getRecycledObjects(monitor);
}
public boolean isAtLeastV9() {
return getInfo().getDatabaseVersion().getMajor() >= 9;
}
public boolean isAtLeastV10() {
return getInfo().getDatabaseVersion().getMajor() >= 10;
}
......
......@@ -172,8 +172,9 @@ public class OracleView extends OracleTableBase implements OracleSourceObject
}
String viewText = null;
try (JDBCSession session = DBUtils.openMetaSession(monitor, getDataSource(), "Load table status")) {
boolean isOracle9 = getDataSource().isAtLeastV9();
try (JDBCPreparedStatement dbStat = session.prepareStatement(
"SELECT TEXT,TYPE_TEXT,OID_TEXT,VIEW_TYPE_OWNER,VIEW_TYPE,SUPERVIEW_NAME\n" +
"SELECT TEXT,TYPE_TEXT,OID_TEXT,VIEW_TYPE_OWNER,VIEW_TYPE" + (isOracle9 ? ",SUPERVIEW_NAME" : "") + "\n" +
"FROM SYS.ALL_VIEWS WHERE OWNER=? AND VIEW_NAME=?")) {
dbStat.setString(1, getContainer().getName());
dbStat.setString(2, getName());
......@@ -185,10 +186,11 @@ public class OracleView extends OracleTableBase implements OracleSourceObject
additionalInfo.setOidText(JDBCUtils.safeGetStringTrimmed(dbResult, "OID_TEXT"));
additionalInfo.typeOwner = JDBCUtils.safeGetStringTrimmed(dbResult, "VIEW_TYPE_OWNER");
additionalInfo.typeName = JDBCUtils.safeGetStringTrimmed(dbResult, "VIEW_TYPE");
String superViewName = JDBCUtils.safeGetString(dbResult, "SUPERVIEW_NAME");
if (!CommonUtils.isEmpty(superViewName)) {
additionalInfo.setSuperView(getContainer().getView(monitor, superViewName));
if (isOracle9) {
String superViewName = JDBCUtils.safeGetString(dbResult, "SUPERVIEW_NAME");
if (!CommonUtils.isEmpty(superViewName)) {
additionalInfo.setSuperView(getContainer().getView(monitor, superViewName));
}
}
} else {
log.warn("Cannot find view '" + getFullyQualifiedName(DBPEvaluationContext.UI) + "' metadata");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册