Skip to content
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

Support authorization parsing for Sharding core #996

Merged
merged 128 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
f639b83
filter redundant tables.
tristaZero Jun 28, 2018
780a115
add dcl type
tristaZero Jun 28, 2018
630a8fb
ADD DCL statement.
tristaZero Jun 28, 2018
d1475ac
add dcl file.
tristaZero Jun 28, 2018
ee79a08
add pre read next token function.
tristaZero Jun 28, 2018
549ab62
add pre read next token function.
tristaZero Jun 28, 2018
7495703
add ddl or dcl judgement.
tristaZero Jun 28, 2018
ad62e53
add dcl statement judgement.
tristaZero Jun 29, 2018
7ff30b1
add alter user handling.
tristaZero Jun 29, 2018
f979e84
rename parser and drop user parser.
tristaZero Jun 29, 2018
8835d7f
modify sql parser factory.
tristaZero Jun 29, 2018
ffe76cc
add role default key
tristaZero Jun 29, 2018
60b9a27
add role judgement
tristaZero Jun 29, 2018
ca1b8ec
modify rename user parser
tristaZero Jun 29, 2018
a42d15e
ADD default key : login.
tristaZero Jul 2, 2018
5771b79
add grant handling.
tristaZero Jul 2, 2018
74f15a2
ADD revoke handling.
tristaZero Jul 2, 2018
6301f16
add grant and revoke statement.
tristaZero Jul 2, 2018
fb31ae7
use grant and revoke statement.
tristaZero Jul 2, 2018
ad0084d
add containStarTable().
tristaZero Jul 2, 2018
fcf0fae
judge star table.
tristaZero Jul 2, 2018
acff311
remove grant and revoke statement.
tristaZero Jul 3, 2018
ed44809
add deny statement handling.
tristaZero Jul 3, 2018
4627ef3
modify contain star checking.
tristaZero Jul 3, 2018
5740418
ADD REVOKE JUDGEMENT.
tristaZero Jul 3, 2018
33c6d6b
reconstruct sql parser factory.
tristaZero Jul 4, 2018
3964c24
modify ddl parser.
tristaZero Jul 4, 2018
5634208
modify dcl parser.
tristaZero Jul 4, 2018
f0a892e
modify ddl or dcl judgement.
tristaZero Jul 4, 2018
8014f38
remove blank line.
tristaZero Jul 4, 2018
11776eb
modify create table parser.
tristaZero Jul 4, 2018
9648add
add create index parser.
tristaZero Jul 4, 2018
aa4acc9
modify drop index parser
tristaZero Jul 4, 2018
ff7ea01
add drop index parser
tristaZero Jul 4, 2018
55a878a
modify alter/truncate table parser.
tristaZero Jul 4, 2018
3644c58
modify the judgement of ddl of index and table.
tristaZero Jul 4, 2018
2721cfa
reconstruct sql parser factory.
tristaZero Jul 4, 2018
7d3f5fb
add author.
tristaZero Jul 4, 2018
1c43f7a
create user parser
tristaZero Jul 4, 2018
7cba9ca
create user sql.
tristaZero Jul 4, 2018
aba5540
modify create user parser result.
tristaZero Jul 4, 2018
3b9c7c3
add drop user sql.
tristaZero Jul 4, 2018
126f00c
add drop user parser result.
tristaZero Jul 4, 2018
b72bd13
add blank space.
tristaZero Jul 5, 2018
25382b0
add blank space.
tristaZero Jul 5, 2018
86c8cfb
add alter user sql case.
tristaZero Jul 5, 2018
c644569
add alter user parser result.
tristaZero Jul 5, 2018
74df360
rename user sql case.
tristaZero Jul 5, 2018
84cb67b
rename user parser result.
tristaZero Jul 5, 2018
cae7136
modify rename user sql case.
tristaZero Jul 5, 2018
eb96e00
add deny user sql case
tristaZero Jul 5, 2018
f05fbff
add deny user parser result.
tristaZero Jul 5, 2018
e1582c3
modify isDCL judgement.
tristaZero Jul 5, 2018
e26f550
add grant user sql cases.
tristaZero Jul 5, 2018
c55d34a
add grant user parser result.
tristaZero Jul 5, 2018
24bbd2a
modify grant sql parser and sql case
tristaZero Jul 5, 2018
df69a43
add revoke user sql cases.
tristaZero Jul 5, 2018
f091629
add revoke user parser result.
tristaZero Jul 5, 2018
0e2acc5
modify revoke user sql cases.
tristaZero Jul 5, 2018
a99619e
modify grant user sql cases.
tristaZero Jul 5, 2018
f737b28
modify create user sql cases.
tristaZero Jul 5, 2018
f6801f3
modify alter user cases and parser result.
tristaZero Jul 5, 2018
e80b3b1
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
tristaZero Jul 5, 2018
4c16493
modify sql judge engine.
tristaZero Jul 5, 2018
04f6cb0
add authour
tristaZero Jul 5, 2018
72cc553
add data source property class
tristaZero Jul 6, 2018
dcad613
add datasource property parser.
tristaZero Jul 6, 2018
8b178d9
modify data source property.
tristaZero Jul 8, 2018
31f47c8
modify sharding context.
tristaZero Jul 8, 2018
646dd85
modify data source property parser.
tristaZero Jul 8, 2018
0750e0c
add is in same instance function.
tristaZero Jul 8, 2018
f8d7467
modify data source parser and factory.
tristaZero Jul 8, 2018
a7feb47
add getAllInstanceDataSourceName();
tristaZero Jul 8, 2018
1720c37
modify to interface.
tristaZero Jul 8, 2018
ecafba9
modify routing engine.
tristaZero Jul 8, 2018
67edc71
modify sharding statement.
tristaZero Jul 8, 2018
b8e5634
add DataSourcePropertyManager
tristaZero Jul 9, 2018
fad55a1
add instanceDataSourceNames.
tristaZero Jul 9, 2018
db254cc
modify DataSourcePropertyFactory
tristaZero Jul 9, 2018
72a5bd2
add dataSourcePropertyManager.
tristaZero Jul 9, 2018
25653e8
add dataSourcePropertyManager.
tristaZero Jul 9, 2018
ef73d13
add getAllInstanceDataSourceNames.
tristaZero Jul 9, 2018
f1bf552
modify getAllInstanceDataSourceNames.
tristaZero Jul 9, 2018
a07042c
modify DatabaseTest.
tristaZero Jul 9, 2018
4efa785
ADD MySQLDataSourcePropertyParser
tristaZero Jul 9, 2018
58c6243
modify to abstract class.
tristaZero Jul 9, 2018
79f0733
add PostgreSQLDataSourcePropertyParser
tristaZero Jul 9, 2018
1a5411a
add OracleDataSourcePropertyParser
tristaZero Jul 9, 2018
b236aff
modify java doc.
tristaZero Jul 9, 2018
a5bb2c0
add SQLServerDataSourcePropertyParser
tristaZero Jul 9, 2018
d7da908
modify database type.
tristaZero Jul 9, 2018
58fe990
add H2DataSourcePropertyParser
tristaZero Jul 9, 2018
8890e21
MODIFY DataSourcePropertyFactory.
tristaZero Jul 9, 2018
d364d64
modify ParsingSQLRouter.
tristaZero Jul 9, 2018
62c9cb6
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
tristaZero Jul 9, 2018
ece1902
modify test case for data source property.
tristaZero Jul 9, 2018
ada41c0
modify h2 data source property parser.
tristaZero Jul 9, 2018
375b7da
add uri.getPath().isEmpty() judgement.
tristaZero Jul 9, 2018
3fe5b74
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
f984303
add getActualSchemaName
tristaZero Jul 10, 2018
f013798
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
a6040ba
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
4e3634f
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
76873ae
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
a8321a9
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
3486a27
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
f708063
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
cc1fb82
replace datasource name with actual database name.
tristaZero Jul 10, 2018
70e8f7f
pass through DataSourcePropertyManager.
tristaZero Jul 10, 2018
35f6ba7
add java doc
tristaZero Jul 10, 2018
feca45f
modify test case for toSQL.
tristaZero Jul 10, 2018
ab08f1e
modify test case.
tristaZero Jul 10, 2018
e0e0b4e
modify test case.
tristaZero Jul 10, 2018
9ff265f
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
tristaZero Jul 10, 2018
a8f5045
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
tristaZero Jul 11, 2018
f7aa1a0
modify case.
tristaZero Jul 11, 2018
b630304
modify alter_user
tristaZero Jul 11, 2018
29e260b
modify alter_user cases.
tristaZero Jul 11, 2018
aee4d26
modify create_user parse result.
tristaZero Jul 11, 2018
d388662
modify create_user sql case.
tristaZero Jul 11, 2018
35de591
modify grant user sql case.
tristaZero Jul 11, 2018
aad4dcc
modify grant_user parse result.
tristaZero Jul 11, 2018
1ff24cb
modify revoke_user parse result.
tristaZero Jul 11, 2018
4dd6d96
modify revoke_user sql case.
tristaZero Jul 11, 2018
2a62fc3
Merge branch 'dev' of ssh://github.com/shardingjdbc/sharding-jdbc int…
tristaZero Jul 11, 2018
6dc3cef
modify case name.
tristaZero Jul 11, 2018
a6bab87
modify case names.
tristaZero Jul 11, 2018
0888154
remove useless functions.
tristaZero Jul 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@ public enum SQLType {
/**
* Database administrator Language.
*/
DAL
DAL,

/**
* Database control Language.
*/
DCL
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private Iterator<MemoryQueryResultRow> init(final List<QueryResult> queryResults
String actualTableName = memoryResultSetRow.getCell(1).toString();
Optional<TableRule> tableRule = shardingRule.tryFindTableRuleByActualTable(actualTableName);
if (!tableRule.isPresent()) {
if (shardingMetaData.getTableMetaDataMap().keySet().contains(actualTableName)) {
if (shardingMetaData.getTableMetaDataMap().keySet().contains(actualTableName) && tableNames.add(actualTableName)) {
result.add(memoryResultSetRow);
} else if (!shardingMetaData.isSupportedDatabaseType()) {
} else if (!shardingMetaData.isSupportedDatabaseType() && tableNames.add(actualTableName)) {
result.add(memoryResultSetRow);
}
} else if (tableNames.add(tableRule.get().getLogicTable())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,22 @@
import io.shardingsphere.core.parsing.parser.dialect.mysql.statement.UseStatement;
import io.shardingsphere.core.parsing.parser.exception.SQLParsingException;
import io.shardingsphere.core.parsing.parser.sql.SQLStatement;
import io.shardingsphere.core.parsing.parser.sql.dcl.DCLStatement;
import io.shardingsphere.core.parsing.parser.sql.ddl.DDLStatement;
import io.shardingsphere.core.parsing.parser.sql.dml.DMLStatement;
import io.shardingsphere.core.parsing.parser.sql.dml.insert.InsertStatement;
import io.shardingsphere.core.parsing.parser.sql.dql.select.SelectStatement;
import io.shardingsphere.core.parsing.parser.sql.tcl.TCLStatement;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.Collection;

/**
* SQL judge engine.
*
* @author zhangliang
* @author panjuan
*/
@RequiredArgsConstructor
public final class SQLJudgeEngine {
Expand All @@ -67,20 +72,25 @@ public SQLStatement judge() {
if (isDML(tokenType)) {
return getDMLStatement(tokenType);
}
if (isDDL(tokenType)) {
return getDDLStatement();
}
if (isTCL(tokenType)) {
return getTCLStatement();
}
if (isDAL(tokenType)) {
return getDALStatement(tokenType, lexerEngine);
}
lexerEngine.nextToken();
if (isDCL(tokenType, lexerEngine)) {
return getDCLStatement();
}
if (isDDL(tokenType, lexerEngine)) {
return getDDLStatement();
}
} else {
lexerEngine.nextToken();
}
if (tokenType instanceof Assist && Assist.END == tokenType) {
throw new SQLParsingException("Unsupported SQL statement: [%s]", sql);
}
lexerEngine.nextToken();
}
}

Expand All @@ -92,8 +102,20 @@ private boolean isDML(final TokenType tokenType) {
return DefaultKeyword.INSERT == tokenType || DefaultKeyword.UPDATE == tokenType || DefaultKeyword.DELETE == tokenType;
}

private boolean isDDL(final TokenType tokenType) {
return DefaultKeyword.CREATE == tokenType || DefaultKeyword.ALTER == tokenType || DefaultKeyword.DROP == tokenType || DefaultKeyword.TRUNCATE == tokenType;
private static boolean isDDL(final TokenType tokenType, final LexerEngine lexerEngine) {
Collection<DefaultKeyword> primaryTokens = Arrays.asList(DefaultKeyword.CREATE, DefaultKeyword.ALTER, DefaultKeyword.DROP, DefaultKeyword.TRUNCATE);
Collection<DefaultKeyword> secondaryTokens = Arrays.asList(DefaultKeyword.LOGIN, DefaultKeyword.USER, DefaultKeyword.ROLE);
return primaryTokens.contains(tokenType) && !secondaryTokens.contains(lexerEngine.getCurrentToken().getType());
}

private static boolean isDCL(final TokenType tokenType, final LexerEngine lexerEngine) {
Collection<DefaultKeyword> primaryTokens = Arrays.asList(DefaultKeyword.GRANT, DefaultKeyword.REVOKE, DefaultKeyword.DENY);
Collection<DefaultKeyword> secondaryTokens = Arrays.asList(DefaultKeyword.LOGIN, DefaultKeyword.USER, DefaultKeyword.ROLE);
if (primaryTokens.contains(tokenType)) {
return true;
}
primaryTokens = Arrays.asList(DefaultKeyword.CREATE, DefaultKeyword.ALTER, DefaultKeyword.DROP, DefaultKeyword.RENAME);
return primaryTokens.contains(tokenType) && secondaryTokens.contains(lexerEngine.getCurrentToken().getType());
}

private boolean isTCL(final TokenType tokenType) {
Expand All @@ -120,6 +142,10 @@ private SQLStatement getDDLStatement() {
return new DDLStatement();
}

private SQLStatement getDCLStatement() {
return new DCLStatement();
}

private SQLStatement getTCLStatement() {
return new TCLStatement();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ public void nextToken() {
lexer.nextToken();
}

/**
* Is end or not.
*
* @return current token is end token or not.
*/
public boolean isEnd() {
return lexer.getCurrentToken().getType() == Assist.END;
}

/**
* Get current token.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public enum DefaultKeyword implements Keyword {
DISABLE,
VALIDATE,
USER,
ROLE,
LOGIN,
DENY,
IDENTIFIED,

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
package io.shardingsphere.core.parsing.parser.dialect.mysql.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.parser.sql.ddl.alter.AbstractAlterParser;
import io.shardingsphere.core.parsing.parser.sql.ddl.alter.table.AbstractAlterTableParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Alter parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLAlterParser extends AbstractAlterParser {
public final class MySQLAlterTableParser extends AbstractAlterTableParser {

public MySQLAlterParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
public MySQLAlterTableParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/

package io.shardingsphere.core.parsing.parser.dialect.mysql.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.lexer.dialect.mysql.MySQLKeyword;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.Keyword;
import io.shardingsphere.core.parsing.parser.sql.ddl.create.index.AbstractCreateIndexParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Create parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLCreateIndexParser extends AbstractCreateIndexParser {

public MySQLCreateIndexParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}

@Override
protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {DefaultKeyword.TEMPORARY};
}

@Override
protected Keyword[] getSkippedKeywordsBetweenCreateIndexAndKeyword() {
return new Keyword[] {DefaultKeyword.UNIQUE, DefaultKeyword.FULLTEXT, MySQLKeyword.SPATIAL};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
import io.shardingsphere.core.parsing.lexer.dialect.mysql.MySQLKeyword;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.Keyword;
import io.shardingsphere.core.parsing.parser.sql.ddl.create.AbstractCreateParser;
import io.shardingsphere.core.parsing.parser.sql.ddl.create.table.AbstractCreateTableParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Create parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLCreateParser extends AbstractCreateParser {
public final class MySQLCreateTableParser extends AbstractCreateTableParser {

public MySQLCreateParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
public MySQLCreateTableParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/

package io.shardingsphere.core.parsing.parser.dialect.mysql.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.Keyword;
import io.shardingsphere.core.parsing.parser.sql.ddl.drop.index.AbstractDropIndexParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Drop parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLDropIndexParser extends AbstractDropIndexParser {

public MySQLDropIndexParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}

@Override
protected Keyword[] getSkippedKeywordsBetweenDropAndTable() {
return new Keyword[] {DefaultKeyword.TEMPORARY};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@
import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.Keyword;
import io.shardingsphere.core.parsing.parser.sql.ddl.drop.AbstractDropParser;
import io.shardingsphere.core.parsing.parser.sql.ddl.drop.table.AbstractDropTableParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Drop parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLDropParser extends AbstractDropParser {
public final class MySQLDropTableParser extends AbstractDropTableParser {

public MySQLDropParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
public MySQLDropTableParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
package io.shardingsphere.core.parsing.parser.dialect.mysql.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.parser.sql.ddl.truncate.AbstractTruncateParser;
import io.shardingsphere.core.parsing.parser.sql.ddl.truncate.table.AbstractTruncateTableParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Truncate parser for MySQL.
*
* @author zhangliang
* @author panjuan
*/
public final class MySQLTruncateParser extends AbstractTruncateParser {
public final class MySQLTruncateTableParser extends AbstractTruncateTableParser {

public MySQLTruncateParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
public MySQLTruncateTableParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
package io.shardingsphere.core.parsing.parser.dialect.oracle.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.parser.sql.ddl.alter.AbstractAlterParser;
import io.shardingsphere.core.parsing.parser.sql.ddl.alter.table.AbstractAlterTableParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Alter parser for Oracle.
*
* @author zhangliang
* @author panjuan
*/
public final class OracleAlterParser extends AbstractAlterParser {
public final class OracleAlterTableParser extends AbstractAlterTableParser {

public OracleAlterParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
public OracleAlterTableParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed 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.
* </p>
*/

package io.shardingsphere.core.parsing.parser.dialect.oracle.sql;

import io.shardingsphere.core.parsing.lexer.LexerEngine;
import io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;
import io.shardingsphere.core.parsing.lexer.token.Keyword;
import io.shardingsphere.core.parsing.parser.sql.ddl.create.index.AbstractCreateIndexParser;
import io.shardingsphere.core.rule.ShardingRule;

/**
* Create parser for Oracle.
*
* @author zhangliang
* @author panjuan
*/
public final class OracleCreateIndexParser extends AbstractCreateIndexParser {

public OracleCreateIndexParser(final ShardingRule shardingRule, final LexerEngine lexerEngine) {
super(shardingRule, lexerEngine);
}

@Override
protected Keyword[] getSkippedKeywordsBetweenCreateAndKeyword() {
return new Keyword[] {DefaultKeyword.GLOBAL, DefaultKeyword.TEMPORARY};
}

@Override
protected Keyword[] getSkippedKeywordsBetweenCreateIndexAndKeyword() {
return new Keyword[] {DefaultKeyword.UNIQUE, DefaultKeyword.BITMAP};
}
}
Loading