-
Notifications
You must be signed in to change notification settings - Fork 24
Support for Babelfish v.5.2.0 (17.5) and v.4.6.0 (16.9) #145
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
Changes from 1 commit
17b9c3e
1bd331a
bce02db
1cc09ee
f4e364c
9346567
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -502,7 +502,7 @@ else if (CompassUtilities.grammarRuleNames[ruleIxParent].equals(parentRuleName)) | |
| return findParent(parent.parent, parentRuleName); | ||
| } | ||
|
|
||
| // covnert a section of a parse tree to text | ||
| // convert a section of a parse tree to text | ||
| public String parseTreeToString(RuleContext ctx) { | ||
| String treeString = ""; | ||
| TSQLParser parser = new TSQLParser(null); | ||
|
|
@@ -767,6 +767,27 @@ private String lookupProc(String name) { | |
| return resultType; | ||
| } | ||
|
|
||
| // is there a trigger on this view? this can only be an INSTEAD-OF trigger | ||
| private String lookupTrigOnView(String viewName) { | ||
| u.appOutput("viewName=["+viewName+"] "); | ||
| viewName = u.resolveName(viewName); | ||
| u.appOutput("viewName resolved=["+viewName+"] "); | ||
| String trigName = ""; | ||
| for (String trig : CompassUtilities.trigSymTab.keySet()) { | ||
| String rawAttributes = CompassUtilities.trigSymTab.get(trig); | ||
| List<String> trigAttributes = new ArrayList<String>(Arrays.asList(rawAttributes.split(u.symTabSeparator2))); | ||
| String trigType = trigAttributes.get(0); | ||
| String baseTable = trigAttributes.get(1); | ||
| if (!trigType.equals("INSTEAD OF")) continue; | ||
| u.appOutput("trigAttributes=["+trigAttributes+"] baseTable=["+baseTable+"] viewName=["+viewName+"] "); | ||
| if (baseTable.equals(viewName)) { | ||
| trigName = trig; | ||
| break; | ||
| } | ||
| } | ||
| return trigName; | ||
| } | ||
|
|
||
| // lookup a column; must be called with resolved object name | ||
| private String lookupCol(String objName, String colName) { | ||
| String resultType = ""; | ||
|
|
@@ -1645,6 +1666,15 @@ private void HandleSystemProcPass1(TSQLParser.Func_proc_name_server_database_sch | |
| @Override public String visitCreate_or_alter_dml_trigger(TSQLParser.Create_or_alter_dml_triggerContext ctx) { | ||
| if (u.debugging) dbgTraceVisitEntry(CompassUtilities.thisProc()); | ||
| String trigName = ctx.simple_name().getText(); | ||
| String trigType = ""; | ||
| if ((ctx.FOR() != null) || (ctx.AFTER() != null)) { | ||
| trigType = "FOR/AFTER"; | ||
| } | ||
| else if (ctx.INSTEAD() != null) { | ||
| trigType = "INSTEAD OF"; | ||
| } | ||
| String trigBaseTable = ctx.table_name().getText(); | ||
| u.addTrigSymTab(trigName, trigType, trigBaseTable); | ||
|
|
||
| // set context | ||
| u.setContext("TRIGGER", trigName); | ||
|
|
@@ -5723,12 +5753,21 @@ else if (objType.equalsIgnoreCase("TRIGGER")) { | |
|
|
||
| String kwd = "CREATE"; | ||
| String status = u.Supported; | ||
| String hasTrigger = null; | ||
| if (ctx.ALTER() != null) { | ||
| kwd = "ALTER"; | ||
| if (ctx.CREATE() != null) kwd = "CREATE OR ALTER"; | ||
| status = featureSupportedInVersion("ALTER VIEW"); // ALTER and CREATE OR ALTER go together | ||
|
|
||
| String trigName = lookupTrigOnView(viewName); | ||
| if (!trigName.isEmpty()) { | ||
| status = u.NotSupported; | ||
|
||
| hasTrigger = "with trigger"; | ||
| } | ||
| } | ||
| if (!hasTrigger) { | ||
| captureItem(kwd + " VIEW" + hasTrigger, viewName, ViewsReportGroup, kwd + " VIEW" + hasTrigger, status, ctx.start.getLine(), batchLines.toString()); | ||
| } | ||
| captureItem(kwd + " VIEW", viewName, ViewsReportGroup, "", status, ctx.start.getLine(), batchLines.toString()); | ||
|
|
||
| // set context | ||
| u.setContext("VIEW", viewName); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use boolean instead of string