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

添加对Lealone数据库的支持 #5285

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/src/main/java/com/alibaba/druid/DbType.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public enum DbType {

starrocks(1L << 43),

lealone(1L << 44),

ingres(0),
cloudscape(0),
timesten(0),
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/com/alibaba/druid/sql/PagerUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private static boolean limitQueryBlock(SQLSelect select, DbType dbType, int offs
case mariadb:
case tidb:
case h2:
case lealone:
case ads:
case clickhouse:
return limitMySqlQueryBlock(queryBlock, dbType, offset, count, check);
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/com/alibaba/druid/sql/SQLUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ public static SQLASTOutputVisitor createFormatOutputVisitor(Appendable out,
case odps:
return new OdpsOutputVisitor(out);
case h2:
case lealone:
return new H2OutputVisitor(out);
case hive:
return new HiveOutputVisitor(out);
Expand Down Expand Up @@ -577,6 +578,7 @@ public static SchemaStatVisitor createSchemaStatVisitor(SchemaRepository reposit
case odps:
return new OdpsSchemaStatVisitor(repository);
case h2:
case lealone:
return new H2SchemaStatVisitor(repository);
case hive:
return new HiveSchemaStatVisitor(repository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public static SQLStatementParser createSQLStatementParser(String sql, DbType dbT
case jtds:
return new SQLServerStatementParser(sql, features);
case h2:
case lealone:
return new H2StatementParser(sql, features);
case blink:
return new BlinkStatementParser(sql, features);
Expand Down Expand Up @@ -173,6 +174,7 @@ public static SQLExprParser createExprParser(String sql, DbType dbType, SQLParse
return parser;
}
case h2:
case lealone:
return new H2ExprParser(sql, features);
case postgresql:
case edb:
Expand Down Expand Up @@ -223,6 +225,7 @@ public static Lexer createLexer(String sql, DbType dbType, SQLParserFeature... f
return lexer;
}
case h2:
case lealone:
return new H2Lexer(sql, features);
case postgresql:
case edb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public static ExportParameterVisitor createExportParameterVisitor(Appendable out
case db2:
return new DB2ExportParameterVisitor(out);
case h2:
case lealone:
return new MySqlExportParameterVisitor(out);
case sqlserver:
case jtds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ public static ParameterizedVisitor createParameterizedOutputVisitor(Appendable o
case elastic_search:
return new MySqlOutputVisitor(out, true);
case h2:
case lealone:
return new H2OutputVisitor(out, true);
case postgresql:
case edb:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static SQLEvalVisitor createEvalVisitor(DbType dbType) {
case mariadb:
case tidb:
case h2:
case lealone:
return new MySqlEvalVisitorImpl();
case oracle:
return new OracleEvalVisitor();
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/com/alibaba/druid/util/JdbcConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public interface JdbcConstants {
DbType H2 = DbType.h2;
String H2_DRIVER = "org.h2.Driver";

DbType LEALONE = DbType.lealone;
String LEALONE_DRIVER = "org.lealone.client.jdbc.JdbcDriver";

DbType DM = DbType.dm;
String DM_DRIVER = "dm.jdbc.driver.DmDriver";

Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/com/alibaba/druid/util/JdbcUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ public static String getDriverClassName(String rawUrl) throws SQLException {
return "com.ingres.jdbc.IngresDriver";
} else if (rawUrl.startsWith("jdbc:h2:")) {
return H2_DRIVER;
} else if (rawUrl.startsWith("jdbc:lealone:")) {
return LEALONE_DRIVER;
} else if (rawUrl.startsWith("jdbc:mckoi:")) {
return "com.mckoi.JDBCDriver";
} else if (rawUrl.startsWith("jdbc:cloudscape:")) {
Expand Down Expand Up @@ -579,6 +581,8 @@ public static DbType getDbTypeRaw(String rawUrl, String driverClassName) {
return DbType.ingres;
} else if (rawUrl.startsWith("jdbc:h2:") || rawUrl.startsWith("jdbc:log4jdbc:h2:")) {
return DbType.h2;
} else if (rawUrl.startsWith("jdbc:lealone:")) {
return DbType.lealone;
} else if (rawUrl.startsWith("jdbc:mckoi:")) {
return DbType.mock;
} else if (rawUrl.startsWith("jdbc:cloudscape:")) {
Expand Down Expand Up @@ -961,6 +965,7 @@ public static boolean isMysqlDbType(DbType dbType) {
case mariadb:
case tidb:
case h2:
case lealone:
return true;
default:
return false;
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/com/alibaba/druid/wall/WallFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public synchronized void init(DataSourceProxy dataSource) {
case mariadb:
case tidb:
case h2:
case lealone:
case presto:
case trino:
if (config == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
{
"value": "h2"
},
{
"value": "lealone"
},
{
"value": "dm"
},
Expand Down Expand Up @@ -168,6 +171,9 @@
{
"value": "h2"
},
{
"value": "lealone"
},
{
"value": "dm"
},
Expand Down