mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
support mariadb java client
This commit is contained in:
@@ -94,7 +94,9 @@ public class PagerUtils {
|
||||
|
||||
private static String limitQueryBlock(SQLSelect select, String dbType, int offset, int count) {
|
||||
SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) select.getQuery();
|
||||
if (JdbcConstants.MYSQL.equals(dbType)) {
|
||||
if (JdbcConstants.MYSQL.equals(dbType) || //
|
||||
JdbcConstants.MARIADB.equals(dbType) || //
|
||||
JdbcConstants.H2.equals(dbType)) {
|
||||
return limitMySqlQueryBlock((MySqlSelectQueryBlock) queryBlock, dbType, offset, count);
|
||||
}
|
||||
|
||||
@@ -205,6 +207,14 @@ public class PagerUtils {
|
||||
return new MySqlSelectQueryBlock();
|
||||
}
|
||||
|
||||
if (JdbcConstants.MARIADB.equals(dbType)) {
|
||||
return new MySqlSelectQueryBlock();
|
||||
}
|
||||
|
||||
if (JdbcConstants.H2.equals(dbType)) {
|
||||
return new MySqlSelectQueryBlock();
|
||||
}
|
||||
|
||||
if (JdbcConstants.ORACLE.equals(dbType)) {
|
||||
return new OracleSelectQueryBlock();
|
||||
}
|
||||
|
||||
@@ -45,11 +45,9 @@ public class SQLUtils {
|
||||
private final static Log LOG = LogFactory.getLog(SQLUtils.class);
|
||||
|
||||
public static String toSQLString(SQLObject sqlObject, String dbType) {
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
return toMySqlString(sqlObject);
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
if (JdbcUtils.MYSQL.equals(dbType) || //
|
||||
JdbcUtils.MARIADB.equals(dbType) || //
|
||||
JdbcUtils.H2.equals(dbType)) {
|
||||
return toMySqlString(sqlObject);
|
||||
}
|
||||
|
||||
@@ -139,7 +137,7 @@ public class SQLUtils {
|
||||
public static SQLExpr toSQLExpr(String sql) {
|
||||
return toSQLExpr(sql, null);
|
||||
}
|
||||
|
||||
|
||||
public static String format(String sql, String dbType) {
|
||||
return format(sql, dbType, null);
|
||||
}
|
||||
@@ -158,7 +156,7 @@ public class SQLUtils {
|
||||
public static String toSQLString(List<SQLStatement> statementList, String dbType) {
|
||||
return toSQLString(statementList, dbType, null);
|
||||
}
|
||||
|
||||
|
||||
public static String toSQLString(List<SQLStatement> statementList, String dbType, List<Object> parameters) {
|
||||
StringBuilder out = new StringBuilder();
|
||||
SQLASTOutputVisitor visitor = createFormatOutputVisitor(out, statementList, dbType);
|
||||
@@ -183,7 +181,9 @@ public class SQLUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
if (JdbcUtils.MYSQL.equals(dbType) || //
|
||||
JdbcUtils.MARIADB.equals(dbType) || //
|
||||
JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlOutputVisitor(out);
|
||||
}
|
||||
|
||||
@@ -194,15 +194,11 @@ public class SQLUtils {
|
||||
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
|
||||
return new SQLServerOutputVisitor(out);
|
||||
}
|
||||
|
||||
|
||||
if (JdbcUtils.JTDS.equals(dbType)) {
|
||||
return new SQLServerOutputVisitor(out);
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlOutputVisitor(out);
|
||||
}
|
||||
|
||||
return new SQLASTOutputVisitor(out);
|
||||
}
|
||||
|
||||
@@ -215,7 +211,9 @@ public class SQLUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
if (JdbcUtils.MYSQL.equals(dbType) || //
|
||||
JdbcUtils.MARIADB.equals(dbType) || //
|
||||
JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlSchemaStatVisitor();
|
||||
}
|
||||
|
||||
@@ -226,15 +224,11 @@ public class SQLUtils {
|
||||
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
|
||||
return new SQLServerSchemaStatVisitor();
|
||||
}
|
||||
|
||||
|
||||
if (JdbcUtils.JTDS.equals(dbType)) {
|
||||
return new SQLServerSchemaStatVisitor();
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlSchemaStatVisitor();
|
||||
}
|
||||
|
||||
return new SchemaStatVisitor();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ public class SQLParserUtils {
|
||||
return new MySqlStatementParser(sql);
|
||||
}
|
||||
|
||||
if (JdbcUtils.MARIADB.equals(dbType)) {
|
||||
return new MySqlStatementParser(sql);
|
||||
}
|
||||
|
||||
if (JdbcUtils.POSTGRESQL.equals(dbType)) {
|
||||
return new PGSQLStatementParser(sql);
|
||||
}
|
||||
@@ -43,7 +47,7 @@ public class SQLParserUtils {
|
||||
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
|
||||
return new SQLServerStatementParser(sql);
|
||||
}
|
||||
|
||||
|
||||
if (JdbcUtils.JTDS.equals(dbType)) {
|
||||
return new SQLServerStatementParser(sql);
|
||||
}
|
||||
@@ -60,11 +64,9 @@ public class SQLParserUtils {
|
||||
return new OracleExprParser(sql);
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlExprParser(sql);
|
||||
}
|
||||
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
if (JdbcUtils.MYSQL.equals(dbType) || //
|
||||
JdbcUtils.MARIADB.equals(dbType) || //
|
||||
JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlExprParser(sql);
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@ public class SQLParserUtils {
|
||||
if (JdbcUtils.SQL_SERVER.equals(dbType)) {
|
||||
return new SQLServerExprParser(sql);
|
||||
}
|
||||
|
||||
|
||||
if (JdbcUtils.JTDS.equals(dbType)) {
|
||||
return new SQLServerExprParser(sql);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ public class ParameterizedOutputVisitorUtils {
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
return new MySqlParameterizedOutputVisitor(out);
|
||||
}
|
||||
|
||||
if (JdbcUtils.MARIADB.equals(dbType)) {
|
||||
return new MySqlParameterizedOutputVisitor(out);
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlParameterizedOutputVisitor(out);
|
||||
|
||||
@@ -139,6 +139,10 @@ public class SQLEvalVisitorUtils {
|
||||
if (JdbcUtils.MYSQL.equals(dbType)) {
|
||||
return new MySqlEvalVisitorImpl();
|
||||
}
|
||||
|
||||
if (JdbcUtils.MARIADB.equals(dbType)) {
|
||||
return new MySqlEvalVisitorImpl();
|
||||
}
|
||||
|
||||
if (JdbcUtils.H2.equals(dbType)) {
|
||||
return new MySqlEvalVisitorImpl();
|
||||
|
||||
Reference in New Issue
Block a user