You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "ilyasahsan123 (via GitHub)" <gi...@apache.org> on 2023/12/30 11:29:54 UTC
[PR] Support Create Trigger Parser in Oracle [shardingsphere]
ilyasahsan123 opened a new pull request, #29604:
URL: https://github.com/apache/shardingsphere/pull/29604
Fixes #27119.
Changes proposed in this pull request:
- Support Create Trigger Parser in Oracle
---
Before committing this PR, I'm sure that I have checked the following options:
- [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [ ] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [ ] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Parser Oracle] Support Create Trigger Statement [shardingsphere]
Posted by "ilyasahsan123 (via GitHub)" <gi...@apache.org>.
ilyasahsan123 commented on code in PR #29604:
URL: https://github.com/apache/shardingsphere/pull/29604#discussion_r1438851842
##########
parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -43,6 +43,10 @@ createType
: CREATE (OR REPLACE)? (EDITIONABLE | NONEDITIONABLE)? TYPE plsqlTypeSource
;
+createTrigger
+ : CREATE (OR REPLACE)? TRIGGER triggerName (BEFORE | AFTER | INSTEAD OF) dmlEventClause
Review Comment:
Sure, I was thinking the same thing because a trigger statement needs a 'body' function, but I'm unsure about where to put it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Parser Oracle] Support Create Trigger Statement [shardingsphere]
Posted by "zihaoAK47 (via GitHub)" <gi...@apache.org>.
zihaoAK47 merged PR #29604:
URL: https://github.com/apache/shardingsphere/pull/29604
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Parser Oracle] Support Create Trigger Statement [shardingsphere]
Posted by "zihaoAK47 (via GitHub)" <gi...@apache.org>.
zihaoAK47 commented on code in PR #29604:
URL: https://github.com/apache/shardingsphere/pull/29604#discussion_r1438844676
##########
parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DMLStatement.g4:
##########
@@ -77,6 +77,14 @@ dmlSubqueryClause
: LP_ selectSubquery subqueryRestrictionClause? RP_
;
+dmlEventClause
+ : dmlEventElement (OR dmlEventElement)* ON viewName
Review Comment:
Suggest the same as above.
##########
parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4:
##########
@@ -43,6 +43,10 @@ createType
: CREATE (OR REPLACE)? (EDITIONABLE | NONEDITIONABLE)? TYPE plsqlTypeSource
;
+createTrigger
+ : CREATE (OR REPLACE)? TRIGGER triggerName (BEFORE | AFTER | INSTEAD OF) dmlEventClause
Review Comment:
Hi can we put the definition of this syntax in the PLSQL.g4 file?

Syntax ref: https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/CREATE-TRIGGER-statement.html#GUID-AF9E33F1-64D1-4382-A6A4-EC33C36F237B
##########
parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DMLStatement.g4:
##########
@@ -77,6 +77,14 @@ dmlSubqueryClause
: LP_ selectSubquery subqueryRestrictionClause? RP_
;
+dmlEventClause
+ : dmlEventElement (OR dmlEventElement)* ON viewName
+ ;
+
+dmlEventElement
+ : (DELETE | INSERT | UPDATE) (OF LP_ columnName (COMMA_ columnName)* RP_)?
Review Comment:
Suggest the same as above.
##########
parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleCreateTriggerStatement.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl;
+
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTablespaceStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle create trigger statement.
+ */
+public final class OracleCreateTriggerStatement extends CreateTablespaceStatement implements OracleStatement {
Review Comment:
Why do we need to extend the `CreatTablespaceStatement` here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Parser Oracle] Support Create Trigger Statement [shardingsphere]
Posted by "ilyasahsan123 (via GitHub)" <gi...@apache.org>.
ilyasahsan123 commented on code in PR #29604:
URL: https://github.com/apache/shardingsphere/pull/29604#discussion_r1438852026
##########
parser/sql/statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/oracle/ddl/OracleCreateTriggerStatement.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl;
+
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTablespaceStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;
+
+/**
+ * Oracle create trigger statement.
+ */
+public final class OracleCreateTriggerStatement extends CreateTablespaceStatement implements OracleStatement {
Review Comment:
Typo. Thanks for noticing this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org