Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOOLS-4574] Modify Oracle unsupported object DDL select query #179

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,7 @@ public final class OracleSchemaFetcher extends AbstractJDBCSchemaFetcher {
"SELECT NAME FROM ALL_SOURCE S "
+ "WHERE S.TYPE=? AND S.OWNER=? AND NOT S.NAME LIKE 'BIN$%'";

private static final String SQL_SHOW_DDL =
"SELECT DBMS_METADATA.GET_DDL(?, T.OBJECT_NAME, T.OWNER)\n"
+ "FROM (\n"
+ " SELECT S.OBJECT_NAME, S.OWNER AS OWNER FROM ALL_OBJECTS S, ALL_TAB_PRIVS P\n"
+ " WHERE S.OBJECT_NAME=P.TABLE_NAME AND S.OBJECT_TYPE=? AND P.TABLE_SCHEMA=? AND P.PRIVILEGE='SELECT'\n"
+ " UNION\n"
+ " SELECT OBJECT_NAME, ? AS OWNER FROM USER_OBJECTS\n"
+ " WHERE OBJECT_TYPE=? AND NOT OBJECT_NAME LIKE 'BIN$%'\n"
+ ") T WHERE OBJECT_NAME=?";
private static final String SQL_SHOW_DDL = "SELECT DBMS_METADATA.GET_DDL(?, ?, ?) FROM dual";

private static final String SQL_SHOW_SEQUENCES =
"SELECT S.* FROM ALL_SEQUENCES S "
Expand Down Expand Up @@ -1188,11 +1180,8 @@ protected String getObjectDDL(
try {
preStmt = conn.prepareStatement(SQL_SHOW_DDL);
preStmt.setString(1, objectType);
preStmt.setString(2, objectType);
preStmt.setString(2, objectName);
preStmt.setString(3, schemaName);
preStmt.setString(4, schemaName);
preStmt.setString(5, objectType);
preStmt.setString(6, objectName);
if (LOG.isDebugEnabled()) {
LOG.debug(
"[SQL]"
Expand All @@ -1202,19 +1191,10 @@ protected String getObjectDDL(
+ objectType
+ ", "
+ "2="
+ objectType
+ objectName
+ ", "
+ "3="
+ schemaName
+ ", "
+ "4="
+ schemaName
+ ", "
+ "5="
+ objectType
+ ", "
+ "6="
+ objectName);
+ schemaName);
}
rs = preStmt.executeQuery();

Expand Down
Loading