Commit 9f499896 authored by Ajit Deshmukh's avatar Ajit Deshmukh

Rresolved the issue reported by the QC for duplicate records in SQL Log screen

parent f9a9cae0
......@@ -569,7 +569,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
BaseLogger.log("1", null, null,
"Before Savepoint");
String sanitizedEnterprise = mainEnterprise.replaceAll("[^a-zA-Z0-9_]", "");
BaseLogger.log("1", null, null,
"Savepoint Name :: SP_" + sanitizedEnterprise);
......@@ -633,10 +632,15 @@ public class ManageSqlConf extends ActionHandlerEJB {
ResultSet rsToFetchEntForP = null;
// Added by Gagan B. on 13-NOV-25 [make connection with Driver for ENTERPRISE]
// -- END
BaseLogger.log("1", null, null,
"enterpriser<><<> "+enterpriser);
String EnterPriseInFormat = getFormattedStringBuff(mainEnterprise);
sql = "SELECT SCHEMA_NAME,ENTERPRISE FROM ENTERPRISE WHERE ENTERPRISE IN("
+ EnterPriseInFormat + ") ";
sql = "SELECT SCHEMA_NAME, ENTERPRISE " +
"FROM ENTERPRISE " +
"WHERE ENTERPRISE = ?";
pstmt = entCon.prepareStatement(sql);
pstmt.setString(1, enterpriser);
rsToFetchEntForP = pstmt.executeQuery();
while (rsToFetchEntForP.next()) {
// schemaName = checkNull( rs.getString("SCHEMA_NAME") );
......@@ -747,7 +751,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
"P",
false);
}
} else if ("C".equalsIgnoreCase(execRights)) {
}
else if ("C".equalsIgnoreCase(execRights)) {
// CLIENT DEV: DB_DEV is a schema name, not an enterprise code,
// so processSqlForEnterprise cannot look it up. Instead, apply
// schema injection and call executeAndLog directly using the
......@@ -1844,11 +1849,19 @@ public class ManageSqlConf extends ActionHandlerEJB {
String chgTerm,
String execRights) throws Exception {
try {
try{
BaseLogger.log(
"3",
null,
null,
"processSqlForEnterprise START -> enterpriseCode="
+ enterpriseCode
+ ", tranId="
+ tranId
+ ", execRights="
+ execRights);
System.out.println("processSqlForEnterprise START :: " + enterpriseCode);
// Change by Gagan B. on 16-JAN-26
// --- FIX: Don't inject placeholders into PL/SQL Bodies ---
String upperSql = checkNull(inputSql).trim().toUpperCase();
......@@ -2014,13 +2027,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
null,
"Pilot actual schema user : [" + schemaForPilot + "]");
if(connForPilotSchema!=null){
if (connForPilotSchema != null) {
connForPilotSchema.close();
connForPilotSchema = null;
}
}
/*
* Fetch actual Main schema user
* Required for execRights = P and A
......@@ -2030,7 +2042,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
ConnDriver connDriverForMainSchema = new ConnDriver();
Connection connForMainSchema = null;
System.out.println("dbMain hashcode = " + dbMain.hashCode());
System.out.println("dbMain value = " + dbMain);
connForMainSchema = connDriverForMainSchema.getConnectDB(dbMain);
String schemaForMainSql = "SELECT USER FROM DUAL";
......@@ -2085,7 +2098,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
*/
String grantSql = null;
// For Pilot transaction Create Table query grant rights of SELECT, INSERT,
// UPDATE, DELETE
if ("TABLE".equalsIgnoreCase(createObjectType)) {
......@@ -2206,8 +2218,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
System.out.println("Execution completed successfully.");
}
catch(Exception e){
} catch (Exception e) {
String error = (e.getMessage() != null)
? e.getMessage()
......@@ -2259,7 +2270,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
logSqlExecution(tranId, enterpriseCode, "0", requestID, inputSql, 0, "E", userId, chgTerm, error, "");
return; // Stop execution if connection fails
}
// Changes by Ajit D. on 08-JUNE-26 for the query execution schema name fetched it
// Changes by Ajit D. on 08-JUNE-26 for the query execution schema name fetched
// it
// from USERS
BaseLogger.log("3", null, null, "For schemaName: [" + schemaName + "]");
......@@ -2324,7 +2336,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
+ schemaForPlaceHolder + "]");
}
if(schemaName.equalsIgnoreCase("APPVIS")){
if (schemaName.equalsIgnoreCase("APPVIS")) {
BaseLogger.log(
"3",
null,
......@@ -2361,8 +2373,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
System.out.println("execSchema:: " + execSchema);
System.out.println("enterpriseCode:: " + enterpriseCode);
// 1. Get the Connection String for the Main Execution
String connForExecSql = "select schema_name from enterprise where enterprise = ?";
PreparedStatement connForExecPstmt = conn.prepareStatement(connForExecSql);
......@@ -2377,8 +2387,18 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
System.out.println("connForExec:: " + connForExec);
try {
// Connect to the specific schema
connForQueryExec = connDriver.getConnectDB(connForExec);
} catch (Exception e) {
String error = (e.getMessage() != null)
? e.getMessage()
: e.toString();
System.out.println("Catch block for executeAndLog method for creating connection...." + error);
logSqlExecution(tranId, enterpriseCode, "0", requestID, inputSql, 0, "E", userId, chgTerm, error, "");
}
int updCount = 0;
String error = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment