Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Component Sharing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gagandeep Singh Bhatia
Component Sharing
Commits
f78362f8
Commit
f78362f8
authored
Dec 24, 2025
by
Ajit Deshmukh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated ManageSqlConf source for updated logic of create function queries.
parent
dde99e52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
Ajit/Manage SQL/Manage SQL/ManageSqlConf.java
Ajit/Manage SQL/Manage SQL/ManageSqlConf.java
+17
-5
No files found.
Ajit/Manage SQL/Manage SQL/ManageSqlConf.java
View file @
f78362f8
...
@@ -1411,6 +1411,7 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1411,6 +1411,7 @@ public class ManageSqlConf extends ActionHandlerEJB
String
createObjectType
=
getCreateObjectType
(
inputSql
);
String
createObjectType
=
getCreateObjectType
(
inputSql
);
boolean
isCreateObject
=
createObjectType
!=
null
;
boolean
isCreateObject
=
createObjectType
!=
null
;
String
objectName
=
isCreateObject
?
extractObjectName
(
inputSql
)
:
null
;
String
objectName
=
isCreateObject
?
extractObjectName
(
inputSql
)
:
null
;
System
.
out
.
println
(
"objectName::: "
+
objectName
);
/* -------------------------------
/* -------------------------------
* Execute per schema
* Execute per schema
...
@@ -1443,10 +1444,12 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1443,10 +1444,12 @@ public class ManageSqlConf extends ActionHandlerEJB
);
);
}
}
else
if
(
rule
.
equals
(
"SYN"
))
{
else
if
(
rule
.
equals
(
"SYN"
))
{
System
.
out
.
println
(
"objectName::: "
+
objectName
+
" schemaName::"
+
schemaName
+
" dbMain::"
+
dbMain
);
String
synonymSql
=
String
synonymSql
=
"CREATE SYNONYM "
+
schemaName
+
"."
+
objectName
+
"CREATE SYNONYM "
+
schemaName
+
"."
+
objectName
+
" FOR "
+
dbMain
+
"."
+
objectName
;
" FOR "
+
dbMain
+
"."
+
objectName
;
System
.
out
.
println
(
"synonymSql::: "
+
synonymSql
);
executeAndLog
(
executeAndLog
(
schemaName
,
schemaName
,
...
@@ -1620,7 +1623,6 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1620,7 +1623,6 @@ public class ManageSqlConf extends ActionHandlerEJB
if
(
sql
==
null
)
return
null
;
if
(
sql
==
null
)
return
null
;
// Normalize whitespace
String
s
=
sql
.
replace
(
"\n"
,
" "
)
String
s
=
sql
.
replace
(
"\n"
,
" "
)
.
replace
(
"\t"
,
" "
)
.
replace
(
"\t"
,
" "
)
.
trim
()
.
trim
()
...
@@ -1628,7 +1630,6 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1628,7 +1630,6 @@ public class ManageSqlConf extends ActionHandlerEJB
s
=
s
.
replaceAll
(
"\\s+"
,
" "
);
s
=
s
.
replaceAll
(
"\\s+"
,
" "
);
// IMPORTANT: 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 "
);
}
}
...
@@ -1663,6 +1664,12 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1663,6 +1664,12 @@ public class ManageSqlConf extends ActionHandlerEJB
case
"VIEW"
:
case
"VIEW"
:
keyword
=
"CREATE VIEW"
;
keyword
=
"CREATE VIEW"
;
break
;
break
;
case
"SYNONYM"
:
keyword
=
"CREATE SYNONYM"
;
break
;
case
"INDEX"
:
keyword
=
"CREATE INDEX"
;
break
;
default
:
default
:
return
null
;
return
null
;
}
}
...
@@ -1672,18 +1679,23 @@ public class ManageSqlConf extends ActionHandlerEJB
...
@@ -1672,18 +1679,23 @@ public class ManageSqlConf extends ActionHandlerEJB
String
after
=
s
.
substring
(
idx
+
keyword
.
length
()).
trim
();
String
after
=
s
.
substring
(
idx
+
keyword
.
length
()).
trim
();
// Remove schema if present (SCHEMA.OBJECT)
if
(
"PACKAGE BODY"
.
equals
(
objectType
))
{
after
=
after
.
replaceFirst
(
"^BODY\\s+"
,
""
);
}
if
(
after
.
contains
(
"."
))
{
if
(
after
.
contains
(
"."
))
{
after
=
after
.
substring
(
after
.
indexOf
(
"."
)
+
1
);
after
=
after
.
substring
(
after
.
indexOf
(
"."
)
+
1
);
}
}
// Stop at first delimiter: space, (, AS, IS
after
=
after
.
split
(
"\\s|\\(|\\bAS\\b|\\bIS\\b|\\bFOR\\b|\\bON\\b"
,
2
)[
0
].
trim
();
after
=
after
.
split
(
"\\s|\\(|AS|IS"
,
2
)[
0
].
trim
();
after
=
after
.
replaceAll
(
"[^A-Z0-9_]"
,
""
).
trim
();
return
after
;
return
after
;
}
}
//Created a method to fetch the table name from provided SQL string by Ajit on 03-DEC-25 -- END
//Created a method to fetch the table name from provided SQL string by Ajit on 03-DEC-25 -- END
//Created a method to add a placeholder before the table name which will be replaced by the schema name by Ajit on 03-DEC-25 -- START
//Created a method to add a placeholder before the table name which will be replaced by the schema name by Ajit on 03-DEC-25 -- START
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment