Skip to content

Commit

Permalink
Support parsing DROP LOCKDOWN PROFILE in Oracle (#18171)
Browse files Browse the repository at this point in the history
  • Loading branch information
chakkk309 authored Jun 4, 2022
1 parent a919434 commit 72b723a
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2475,3 +2475,6 @@ dynamicBaseProfile
: INCLUDING profileName
;

dropLockdownProfile
: DROP LOCKDOWN PROFILE profileName
;
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,6 @@ execute
| createRollbackSegment
| dropRollbackSegment
| createLockdownProfile
| dropLockdownProfile
) SEMI_?
;
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.CreateRollbackSegmentContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.DropRollbackSegmentContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.CreateLockdownProfileContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.DropLockdownProfileContext;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.AlterDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.CreateDefinitionSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.ColumnDefinitionSegment;
Expand Down Expand Up @@ -151,6 +152,7 @@
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleCreateRollbackSegmentStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleDropRollbackSegmentStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleCreateLockdownProfileStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleDropLockdownProfileStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleDropEditionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleDropOutlineStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterOutlineStatement;
Expand Down Expand Up @@ -818,4 +820,9 @@ public ASTNode visitDropRollbackSegment(final DropRollbackSegmentContext ctx) {
public ASTNode visitCreateLockdownProfile(final CreateLockdownProfileContext ctx) {
return new OracleCreateLockdownProfileStatement();
}

@Override
public ASTNode visitDropLockdownProfile(final DropLockdownProfileContext ctx) {
return new OracleDropLockdownProfileStatement();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ public enum SQLVisitorRule {

CREATE_LOCKDOWN_PROFILE("CreateLockdownProfile", SQLStatementType.DDL),

DROP_LOCKDOWN_PROFILE("DropLockdownProfile", SQLStatementType.DDL),

CURSOR("Cursor", SQLStatementType.DDL),

CLOSE("Close", SQLStatementType.DDL),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 lombok.ToString;
import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.OracleStatement;

/**
* Drop lockdown profile statement.
*/
@ToString
public final class OracleDropLockdownProfileStatement extends AbstractSQLStatement implements OracleStatement {
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropDiskgroupStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateRollbackSegmentStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateLockdownProfileStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropLockdownProfileStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropRollbackSegmentStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.AddShardingHintDatabaseValueStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.AddShardingHintTableValueStatementTestCase;
Expand Down Expand Up @@ -1406,6 +1407,9 @@ public final class SQLParserTestCases {
@XmlElement(name = "create-lockdown-profile")
private final List<CreateLockdownProfileStatementTestCase> createLockdownProfileTestCases = new LinkedList<>();

@XmlElement(name = "drop-lockdown-profile")
private final List<DropLockdownProfileStatementTestCase> dropLockdownProfileTestCases = new LinkedList<>();

@XmlElement(name = "cursor")
private final List<CursorStatementTestCase> cursorTestCases = new LinkedList<>();

Expand Down Expand Up @@ -1773,6 +1777,7 @@ public Map<String, SQLParserTestCase> getAllSQLParserTestCases() {
putAll(createRollbackSegmentTestCases, result);
putAll(dropRollbackSegmentTestCases, result);
putAll(createLockdownProfileTestCases, result);
putAll(dropLockdownProfileTestCases, result);
putAll(cursorTestCases, result);
putAll(closeTestCases, result);
putAll(moveTestCases, result);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;

import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;

/**
* Drop lockdown profile statement test case.
*/
public final class DropLockdownProfileStatementTestCase extends SQLParserTestCase {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-parser-test-cases>
<drop-lockdown-profile sql-case-id="drop_lockdown_profile" />
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-cases>
<sql-case id="drop_lockdown_profile" value="DROP LOCKDOWN PROFILE hr_prof;" db-types="Oracle" />
</sql-cases>

0 comments on commit 72b723a

Please sign in to comment.