mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
sql parser support create database
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.alibaba.druid.sql;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.sql.parser.Keywords;
|
||||
|
||||
public class KeywordsMySqlTest extends TestCase {
|
||||
|
||||
public void test_sort() throws Exception {
|
||||
List<String> list = new ArrayList<String>(Keywords.DEFAULT_KEYWORDS.getKeywords().keySet());
|
||||
|
||||
Collections.sort(list);
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (i % 5 == 0) {
|
||||
System.out.println();
|
||||
}
|
||||
String item = list.get(i);
|
||||
System.out.println("map.put(\"" + item + "\", Token." + item + ");");
|
||||
// map.put("AS", Token.AS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.alibaba.druid.sql;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.sql.dialect.mysql.parser.MySqlLexer;
|
||||
import com.alibaba.druid.sql.parser.Keywords;
|
||||
|
||||
public class KeywordsTest extends TestCase {
|
||||
|
||||
public void test_sort() throws Exception {
|
||||
List<String> list = new ArrayList<String>(MySqlLexer.DEFAULT_MYSQL_KEYWORDS.getKeywords().keySet());
|
||||
|
||||
Collections.sort(list);
|
||||
|
||||
int i = 0;
|
||||
for (String item : list) {
|
||||
if (Keywords.DEFAULT_KEYWORDS.getKeywords().containsKey(item)) {
|
||||
continue;
|
||||
}
|
||||
if (i % 5 == 0) {
|
||||
System.out.println();
|
||||
}
|
||||
System.out.println("map.put(\"" + item + "\", Token." + item + ");");
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user