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 {
String confirmedFlag = checkNull(rs.getString("CONFIRMED"));
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)) {
unconfirmedFound = true;
pendingTranId = depTranId;
......@@ -318,7 +318,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
// Added the code to fetch the Executive Approval value for Main transaction on
// 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
// workflow weather approved or not 21-APRIL
......@@ -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) {
System.out.println(
"Cannot confirm. Dependent transaction [" + pendingTranId + "] is not yet confirmed.");
......@@ -688,7 +688,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
* enterpriseArr = enterpriseArrayList.get(0).split(",");
* }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]);
* }
*/
......@@ -704,7 +704,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
Savepoint entSavepoint = null;
try {
// ENTERPRISE-LEVEL SAVEPOINT
//  ENTERPRISE-LEVEL SAVEPOINT
entSavepoint = con.setSavepoint("SP_" + ent);
processSqlForEnterprise(
......@@ -717,12 +717,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId,
chgTerm);
// commit enterprise success
//  commit enterprise success
con.commit();
} catch (Exception e) {
// rollback ONLY this enterprise
// L rollback ONLY this enterprise
if (entSavepoint != null) {
con.rollback(entSavepoint);
}
......@@ -2306,12 +2306,12 @@ public class ManageSqlConf extends ActionHandlerEJB {
"(?i)CREATE\\s+OR\\s+REPLACE\\s+VIEW\\s+(?!\\{SCHEMA\\}|[A-Z0-9_]+\\.)",
"CREATE OR REPLACE VIEW {SCHEMA}.");
// 1️⃣ PACKAGE BODY (FIRST)
// 1� PACKAGE BODY (FIRST)
s = s.replaceAll(
"(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+BODY\\s+(?![A-Z0-9_]+\\.)",
"CREATE OR REPLACE PACKAGE BODY {SCHEMA}.");
// 2️⃣ PACKAGE (EXCLUDE BODY)
// 2� PACKAGE (EXCLUDE BODY)
s = s.replaceAll(
"(?i)CREATE\\s+OR\\s+REPLACE\\s+PACKAGE\\s+(?!BODY\\s+)(?![A-Z0-9_]+\\.)",
"CREATE OR REPLACE PACKAGE {SCHEMA}.");
......@@ -2319,9 +2319,19 @@ public class ManageSqlConf extends ActionHandlerEJB {
// TRIGGER: ON table
// FIX IS HERE: Added \\b before ON
// This prevents matching "actiON", "positiON", "unicON", etc.
s = s.replaceAll(
"(?i)\\bON\\s+(?!\\{SCHEMA\\}|[A-Z0-9_]+\\.)",
"ON {SCHEMA}.");
//Updated the logic to appent the placeholder ( {SCHEMA} ) before the trigger name.
String upper = s.toUpperCase();
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
// Added \\b before INSERT
......@@ -2398,7 +2408,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String s = sql.trim().toUpperCase();
// 🔴 Normalize CREATE OR REPLACE
// =4 Normalize CREATE OR REPLACE
if (s.startsWith("CREATE OR REPLACE")) {
s = s.replaceFirst("CREATE\\s+OR\\s+REPLACE\\s+", "CREATE ");
}
......
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