-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtestIndexStorageType.java
More file actions
40 lines (33 loc) · 1.85 KB
/
Copy pathtestIndexStorageType.java
File metadata and controls
40 lines (33 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package mysql;
/*
* Date: 12-2-6
*/
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.TGSqlParser;
import gudusoft.gsqlparser.nodes.TAlterTableOption;
import gudusoft.gsqlparser.nodes.TMySQLIndexStorageType;
import gudusoft.gsqlparser.nodes.mysql.TMySQLIndexOption;
import gudusoft.gsqlparser.stmt.TAlterTableStatement;
import junit.framework.TestCase;
public class testIndexStorageType extends TestCase {
public void test1(){
TGSqlParser sqlparser = new TGSqlParser(EDbVendor.dbvmysql);
sqlparser.sqltext = "ALTER TABLE jr_story ADD INDEX INK01_jr_story (story_no) using BTREE";
assertTrue(sqlparser.parse() == 0);
TAlterTableStatement alterTableStatement = (TAlterTableStatement)sqlparser.sqlstatements.get(0);
TAlterTableOption alterTableOption = alterTableStatement.getAlterTableOptionList().getAlterTableOption(0);
TMySQLIndexOption indexOption = alterTableOption.getIndexOptionList().getElement(0);
TMySQLIndexStorageType indexStorageType = indexOption.getIndexStorageType();
assertTrue(indexStorageType.getTypeToken().toString().equalsIgnoreCase("BTREE"));
}
public void test2(){
TGSqlParser sqlparser = new TGSqlParser(EDbVendor.dbvmysql);
sqlparser.sqltext = "ALTER TABLE jr_story ADD INDEX INK02_jr_story (story_no) using HASH";
assertTrue(sqlparser.parse() == 0);
TAlterTableStatement alterTableStatement = (TAlterTableStatement)sqlparser.sqlstatements.get(0);
TAlterTableOption alterTableOption = alterTableStatement.getAlterTableOptionList().getAlterTableOption(0);
TMySQLIndexOption indexOption = alterTableOption.getIndexOptionList().getElement(0);
TMySQLIndexStorageType indexStorageType = indexOption.getIndexStorageType();
assertTrue(indexStorageType.getTypeToken().toString().equalsIgnoreCase("HASH"));
}
}