-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
176 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...e/src/main/java/io/shardingjdbc/core/parsing/parser/dialect/AliasClauseParserFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.shardingjdbc.core.parsing.parser.dialect; | ||
|
||
import io.shardingjdbc.core.parsing.lexer.LexerEngine; | ||
import io.shardingjdbc.core.parsing.parser.clause.AliasClauseParser; | ||
import io.shardingjdbc.core.parsing.parser.dialect.mysql.clause.MySQLAliasClauseParser; | ||
import io.shardingjdbc.core.parsing.parser.dialect.oracle.clause.OracleAliasClauseParser; | ||
import io.shardingjdbc.core.parsing.parser.dialect.postgresql.clause.PostgreSQLAliasClauseParser; | ||
import io.shardingjdbc.core.parsing.parser.dialect.sqlserver.clause.SQLServerAliasClauseParser; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Alias clause parser factory. | ||
* | ||
* @author zhangliang | ||
*/ | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public final class AliasClauseParserFactory { | ||
|
||
/** | ||
* Create alias clause parser instance. | ||
* | ||
* @param lexerEngine lexical analysis engine. | ||
* @return alias clause parser instance | ||
*/ | ||
public static AliasClauseParser createInstance(final LexerEngine lexerEngine) { | ||
switch (lexerEngine.getDatabaseType()) { | ||
case MySQL: | ||
return new MySQLAliasClauseParser(lexerEngine); | ||
case Oracle: | ||
return new OracleAliasClauseParser(lexerEngine); | ||
case SQLServer: | ||
return new SQLServerAliasClauseParser(lexerEngine); | ||
case PostgreSQL: | ||
return new PostgreSQLAliasClauseParser(lexerEngine); | ||
default: | ||
throw new UnsupportedOperationException(String.format("Cannot support database type: %s", lexerEngine.getDatabaseType())); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...java/io/shardingjdbc/core/parsing/parser/dialect/mysql/clause/MySQLAliasClauseParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.shardingjdbc.core.parsing.parser.dialect.mysql.clause; | ||
|
||
import io.shardingjdbc.core.parsing.lexer.LexerEngine; | ||
import io.shardingjdbc.core.parsing.lexer.token.TokenType; | ||
import io.shardingjdbc.core.parsing.parser.clause.AliasClauseParser; | ||
|
||
/** | ||
* Alias clause parser for MySQL. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public final class MySQLAliasClauseParser extends AliasClauseParser { | ||
|
||
public MySQLAliasClauseParser(final LexerEngine lexerEngine) { | ||
super(lexerEngine); | ||
} | ||
|
||
@Override | ||
protected TokenType[] getCustomizedAvailableKeywordsForAlias() { | ||
return new TokenType[0]; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...va/io/shardingjdbc/core/parsing/parser/dialect/oracle/clause/OracleAliasClauseParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.shardingjdbc.core.parsing.parser.dialect.oracle.clause; | ||
|
||
import io.shardingjdbc.core.parsing.lexer.LexerEngine; | ||
import io.shardingjdbc.core.parsing.lexer.token.TokenType; | ||
import io.shardingjdbc.core.parsing.parser.clause.AliasClauseParser; | ||
|
||
/** | ||
* Alias clause parser for Oracle. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public final class OracleAliasClauseParser extends AliasClauseParser { | ||
|
||
public OracleAliasClauseParser(final LexerEngine lexerEngine) { | ||
super(lexerEngine); | ||
} | ||
|
||
@Override | ||
protected TokenType[] getCustomizedAvailableKeywordsForAlias() { | ||
return new TokenType[0]; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ardingjdbc/core/parsing/parser/dialect/postgresql/clause/PostgreSQLAliasClauseParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.shardingjdbc.core.parsing.parser.dialect.postgresql.clause; | ||
|
||
import io.shardingjdbc.core.parsing.lexer.LexerEngine; | ||
import io.shardingjdbc.core.parsing.lexer.token.TokenType; | ||
import io.shardingjdbc.core.parsing.parser.clause.AliasClauseParser; | ||
|
||
/** | ||
* Alias clause parser for PostgreSQL. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public final class PostgreSQLAliasClauseParser extends AliasClauseParser { | ||
|
||
public PostgreSQLAliasClauseParser(final LexerEngine lexerEngine) { | ||
super(lexerEngine); | ||
} | ||
|
||
@Override | ||
protected TokenType[] getCustomizedAvailableKeywordsForAlias() { | ||
return new TokenType[0]; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...shardingjdbc/core/parsing/parser/dialect/sqlserver/clause/SQLServerAliasClauseParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.shardingjdbc.core.parsing.parser.dialect.sqlserver.clause; | ||
|
||
import io.shardingjdbc.core.parsing.lexer.LexerEngine; | ||
import io.shardingjdbc.core.parsing.lexer.token.TokenType; | ||
import io.shardingjdbc.core.parsing.parser.clause.AliasClauseParser; | ||
|
||
/** | ||
* Alias clause parser for SQLServer. | ||
* | ||
* @author zhangliang | ||
*/ | ||
public final class SQLServerAliasClauseParser extends AliasClauseParser { | ||
|
||
public SQLServerAliasClauseParser(final LexerEngine lexerEngine) { | ||
super(lexerEngine); | ||
} | ||
|
||
@Override | ||
protected TokenType[] getCustomizedAvailableKeywordsForAlias() { | ||
return new TokenType[0]; | ||
} | ||
} |