Commit f1864c2c authored by Ajit Deshmukh's avatar Ajit Deshmukh

Updated the logic to append the placeholder ( {SCHEMA} ) before the trigger name.

parent 5d7b3f8d
...@@ -272,7 +272,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -272,7 +272,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String confirmedFlag = checkNull(rs.getString("CONFIRMED")); String confirmedFlag = checkNull(rs.getString("CONFIRMED"));
String depTranId = checkNull(rs.getString("TRAN_ID")); String depTranId = checkNull(rs.getString("TRAN_ID"));
// If any dependent (D or Q) is not confirmed block confirmation // If any dependent (D or Q) is not confirmed block confirmation
if (!"Y".equalsIgnoreCase(confirmedFlag)) { if (!"Y".equalsIgnoreCase(confirmedFlag)) {
unconfirmedFound = true; unconfirmedFound = true;
pendingTranId = depTranId; pendingTranId = depTranId;
...@@ -318,7 +318,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -318,7 +318,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
// Added the code to fetch the Executive Approval value for Main transaction on // Added the code to fetch the Executive Approval value for Main transaction on
// 21-APR[END] // 21-APR[END]
// No dependent D/Q records found workflow not yet approved // No dependent D/Q records found workflow not yet approved
// Added the condition if executive approval value is "Y" then only check the // Added the condition if executive approval value is "Y" then only check the
// workflow weather approved or not 21-APRIL // workflow weather approved or not 21-APRIL
...@@ -331,7 +331,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -331,7 +331,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
} }
// Dependent D or Q exists but NOT confirmed return error // Dependent D or Q exists but NOT confirmed return error
if (unconfirmedFound) { if (unconfirmedFound) {
System.out.println( System.out.println(
"Cannot confirm. Dependent transaction [" + pendingTranId + "] is not yet confirmed."); "Cannot confirm. Dependent transaction [" + pendingTranId + "] is not yet confirmed.");
...@@ -688,7 +688,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -688,7 +688,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
* enterpriseArr = enterpriseArrayList.get(0).split(","); * enterpriseArr = enterpriseArrayList.get(0).split(",");
* }else if(applDB.equalsIgnoreCase("E")){ * }else if(applDB.equalsIgnoreCase("E")){
* *
* // Values are NOT comma-separated copy list directly * // Values are NOT comma-separated copy list directly
* enterpriseArr = enterpriseArrayList.toArray(new String[0]); * enterpriseArr = enterpriseArrayList.toArray(new String[0]);
* } * }
*/ */
...@@ -704,7 +704,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -704,7 +704,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
Savepoint entSavepoint = null; Savepoint entSavepoint = null;
try { try {
// ENTERPRISE-LEVEL SAVEPOINT //  ENTERPRISE-LEVEL SAVEPOINT
entSavepoint = con.setSavepoint("SP_" + ent); entSavepoint = con.setSavepoint("SP_" + ent);
processSqlForEnterprise( processSqlForEnterprise(
...@@ -717,12 +717,12 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -717,12 +717,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId, userId,
chgTerm); chgTerm);
// commit enterprise success //  commit enterprise success
con.commit(); con.commit();
} catch (Exception e) { } catch (Exception e) {
// rollback ONLY this enterprise // L rollback ONLY this enterprise
if (entSavepoint != null) { if (entSavepoint != null) {
con.rollback(entSavepoint); con.rollback(entSavepoint);
} }
...@@ -2306,12 +2306,12 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -2306,12 +2306,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
"(?i)CREATE\\s+OR\\s+REPLACE\\s+VIEW\\s+(?!\\{SCHEMA\\}|[A-Z0-9_]+\\.)", "(?i)CREATE\\s+OR\\s+REPLACE\\s+VIEW\\s+(?!\\{SCHEMA\\}|[A-Z0-9_]+\\.)",
"CREATE OR REPLACE VIEW {SCHEMA}."); "CREATE OR REPLACE VIEW {SCHEMA}.");
// 1️⃣ PACKAGE BODY (FIRST) // 1� PACKAGE BODY (FIRST)
s = s.replaceAll( s = s.replaceAll(
"(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+BODY\\s+(?![A-Z0-9_]+\\.)", "(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+BODY\\s+(?![A-Z0-9_]+\\.)",
"CREATE OR REPLACE PACKAGE BODY {SCHEMA}."); "CREATE OR REPLACE PACKAGE BODY {SCHEMA}.");
// 2️⃣ PACKAGE (EXCLUDE BODY) // 2� PACKAGE (EXCLUDE BODY)
s = s.replaceAll( s = s.replaceAll(
"(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+(?!BODY\\s+)(?![A-Z0-9_]+\\.)", "(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+(?!BODY\\s+)(?![A-Z0-9_]+\\.)",
"CREATE OR REPLACE PACKAGE {SCHEMA}."); "CREATE OR REPLACE PACKAGE {SCHEMA}.");
...@@ -2319,9 +2319,19 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -2319,9 +2319,19 @@ public class ManageSqlConf extends ActionHandlerEJB {
// TRIGGER: ON table // TRIGGER: ON table
// FIX IS HERE: Added \\b before ON // FIX IS HERE: Added \\b before ON
// This prevents matching "actiON", "positiON", "unicON", etc. // This prevents matching "actiON", "positiON", "unicON", etc.
s = s.replaceAll( //Updated the logic to appent the placeholder ( {SCHEMA} ) before the trigger name.
"(?i)\\bON\\s+(?!\\{SCHEMA\\}|[A-Z0-9_]+\\.)", String upper = s.toUpperCase();
"ON {SCHEMA}.");
if (upper.startsWith("TRIGGER ")
|| upper.startsWith("CREATE TRIGGER ")
|| upper.startsWith("CREATE OR REPLACE TRIGGER ")) {
s = s.replaceFirst(
"(?i)^(CREATE\\s+OR\\s+REPLACE\\s+TRIGGER|CREATE\\s+TRIGGER|TRIGGER)\\s+",
"$1 {SCHEMA}.");
return s;
}
// INSERT INTO table // INSERT INTO table
// Added \\b before INSERT // Added \\b before INSERT
...@@ -2398,7 +2408,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -2398,7 +2408,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String s = sql.trim().toUpperCase(); String s = sql.trim().toUpperCase();
// 🔴 Normalize CREATE OR REPLACE // =4 Normalize CREATE OR REPLACE
if (s.startsWith("CREATE OR REPLACE")) { if (s.startsWith("CREATE OR REPLACE")) {
s = s.replaceFirst("CREATE\\s+OR\\s+REPLACE\\s+", "CREATE "); s = s.replaceFirst("CREATE\\s+OR\\s+REPLACE\\s+", "CREATE ");
} }
...@@ -2528,4 +2538,4 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -2528,4 +2538,4 @@ public class ManageSqlConf extends ActionHandlerEJB {
return null; return null;
} }
} }
\ No newline at end of file
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