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

fix(schema): failed to query variables on native oracle #2649

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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 @@ -67,7 +67,7 @@ public String getConnectionId(Connection connection) {

@Override
public String getVariable(@NonNull Connection connection, @NonNull String variableName) {
String querySql = "SELECT VALUE FROM SYS.V$PARAMETER WHERE NAME = '" + variableName.toLowerCase() + "'";
String querySql = "SELECT VALUE FROM V$PARAMETER WHERE NAME = '" + variableName.toLowerCase() + "'";
String value = null;
try {
value = JdbcOperationsUtil.getJdbcOperations(connection).queryForObject(querySql, String.class);
Expand All @@ -78,7 +78,7 @@ public String getVariable(@NonNull Connection connection, @NonNull String variab
* nls parameters maybe null in V$PARAMETER, we need to query from V$NLS_PARAMETERS
*/
if (Objects.isNull(value) && variableName.toLowerCase().startsWith("nls_")) {
querySql = "SELECT VALUE FROM SYS.V$NLS_PARAMETERS WHERE PARAMETER = '" + variableName.toUpperCase() + "'";
querySql = "SELECT VALUE FROM V$NLS_PARAMETERS WHERE PARAMETER = '" + variableName.toUpperCase() + "'";
try {
value = JdbcOperationsUtil.getJdbcOperations(connection).queryForObject(querySql, String.class);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public SqlExecTime getExecuteDetail(Statement statement, String version) throws
SqlExecTime sqlExecTime = new SqlExecTime();
try {
String sql =
"SELECT PREV_SQL_ID FROM SYS.V$SESSION WHERE SID = SYS_CONTEXT('USERENV', 'SID') and AUDSID=SYS_CONTEXT('USERENV', 'SESSIONID')";
"SELECT PREV_SQL_ID FROM V$SESSION WHERE SID = SYS_CONTEXT('USERENV', 'SID') and AUDSID=SYS_CONTEXT('USERENV', 'SESSIONID')";
String preSqlId = null;
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
preSqlId = rs.getString("PREV_SQL_ID");
}
Validate.notNull(preSqlId, "PREV_SQL_ID can not be null");
sql = "select SQL_TEXT, ELAPSED_TIME, LAST_ACTIVE_TIME FROM SYS.V$SQL WHERE SQL_ID='" + preSqlId
sql = "select SQL_TEXT, ELAPSED_TIME, LAST_ACTIVE_TIME FROM V$SQL WHERE SQL_ID='" + preSqlId
+ "' ORDER BY LAST_ACTIVE_TIME DESC";
ResultSet resultSet = statement.executeQuery(sql);
if (resultSet.next()) {
Expand Down