-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtestAlterTable.java
More file actions
41 lines (29 loc) · 1.62 KB
/
Copy pathtestAlterTable.java
File metadata and controls
41 lines (29 loc) · 1.62 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
41
package netezza;
/*
* Date: 14-7-29
*/
import gudusoft.gsqlparser.EAlterTableOptionType;
import gudusoft.gsqlparser.EDbVendor;
import gudusoft.gsqlparser.TGSqlParser;
import gudusoft.gsqlparser.nodes.TAlterTableOption;
import gudusoft.gsqlparser.stmt.TAlterTableStatement;
import junit.framework.TestCase;
public class testAlterTable extends TestCase {
public void testRenameTable(){
TGSqlParser sqlparser = new TGSqlParser(EDbVendor.dbvnetezza);
sqlparser.sqltext = "ALTER TABLE X RENAME TO Y;";
assertTrue(sqlparser.parse() == 0);
TAlterTableStatement alterTable = (TAlterTableStatement)sqlparser.sqlstatements.get(0);
assertTrue(alterTable.getTableName().toString().equalsIgnoreCase("X"));
TAlterTableOption ato = alterTable.getAlterTableOptionList().getAlterTableOption(0);
assertTrue(ato.getOptionType() == EAlterTableOptionType.RenameTable);
assertTrue(ato.getNewTableName().toString().equalsIgnoreCase("Y"));
sqlparser.sqltext = "ALTER TABLE EVRST_HIST_NK..CLC_D_ACCOUNT_STATUS_HIER RENAME TO EVRST_HIST_NK..CLC_D_ACCOUNT_STATUS_HIER_ARCH";
assertTrue(sqlparser.parse() == 0);
alterTable = (TAlterTableStatement)sqlparser.sqlstatements.get(0);
assertTrue(alterTable.getTableName().toString().equalsIgnoreCase("EVRST_HIST_NK..CLC_D_ACCOUNT_STATUS_HIER"));
ato = alterTable.getAlterTableOptionList().getAlterTableOption(0);
assertTrue(ato.getOptionType() == EAlterTableOptionType.RenameTable);
assertTrue(ato.getNewTableName().toString().equalsIgnoreCase("EVRST_HIST_NK..CLC_D_ACCOUNT_STATUS_HIER_ARCH"));
}
}