mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add sql testcases
This commit is contained in:
+5
-2
@@ -56,11 +56,13 @@ public class MySqlMatchAgainstExpr extends SQLExprImpl implements MySqlExpr {
|
||||
}
|
||||
|
||||
public static enum SearchModifier {
|
||||
IN_BOOLEAN_MODE("IN BOOLEAN MODE"), IN_NATURAL_LANGUAGE_MODE("IN NATURAL LANGUAGE MODE"),
|
||||
IN_BOOLEAN_MODE("IN BOOLEAN MODE"), //
|
||||
IN_NATURAL_LANGUAGE_MODE("IN NATURAL LANGUAGE MODE"), //
|
||||
IN_NATURAL_LANGUAGE_MODE_WITH_QUERY_EXPANSION("IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION"),
|
||||
WITH_QUERY_EXPANSION("WITH QUERY EXPANSION"), ;
|
||||
WITH_QUERY_EXPANSION("WITH QUERY EXPANSION");
|
||||
|
||||
public final String name;
|
||||
public final String name_lcase;
|
||||
|
||||
SearchModifier(){
|
||||
this(null);
|
||||
@@ -68,6 +70,7 @@ public class MySqlMatchAgainstExpr extends SQLExprImpl implements MySqlExpr {
|
||||
|
||||
SearchModifier(String name){
|
||||
this.name = name;
|
||||
this.name_lcase = name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
String key = option.getKey();
|
||||
|
||||
print(' ');
|
||||
print0(key);
|
||||
print0(ucase ? key : key.toLowerCase());
|
||||
|
||||
if ("TABLESPACE".equals(key)) {
|
||||
print(' ');
|
||||
@@ -812,7 +812,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
x.getAgainst().accept(this);
|
||||
if (x.getSearchModifier() != null) {
|
||||
print(' ');
|
||||
print0(x.getSearchModifier().name);
|
||||
print0(ucase ? x.getSearchModifier().name : x.getSearchModifier().name_lcase);
|
||||
}
|
||||
print(')');
|
||||
|
||||
@@ -2999,7 +2999,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
x.getExpr().accept(this);
|
||||
if (x.getType() != null) {
|
||||
print(' ');
|
||||
print0(x.getType().name());
|
||||
print0(ucase ? x.getType().name : x.getType().name_lcase);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -2989,56 +2989,65 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Printab
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableTruncatePartition x) {
|
||||
print0(ucase ? "TRUNCATE PARTITION " : "truncate partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableDiscardPartition x) {
|
||||
print0(ucase ? "DISCARD PARTITION " : "discard partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableImportPartition x) {
|
||||
print0(ucase ? "IMPORT PARTITION " : "import partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableAnalyzePartition x) {
|
||||
print0(ucase ? "ANALYZE PARTITION " : "analyze partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void printPartitions(List<SQLName> partitions) {
|
||||
if (partitions.size() == 1 && "ALL".equalsIgnoreCase(partitions.get(0).getSimpleName())) {
|
||||
print0(ucase ? "ALL" : "all");
|
||||
} else {
|
||||
printAndAccept(partitions, ", ");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableCheckPartition x) {
|
||||
print0(ucase ? "CHECK PARTITION " : "check partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableOptimizePartition x) {
|
||||
print0(ucase ? "OPTIMIZE PARTITION " : "optimize partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableRebuildPartition x) {
|
||||
print0(ucase ? "REBUILD PARTITION " : "rebuild partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAlterTableRepairPartition x) {
|
||||
print0(ucase ? "REPAIR PARTITION " : "repair partition ");
|
||||
printlnAndAccept(x.getPartitions(), ",");
|
||||
printPartitions(x.getPartitions());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user