DB2DB extends BaseDB { @Override public String buildSQL(String template) throws IOException, SQLException { template = replaceTemplate(template); template = reword(template); template = _removeNull(template); template = StringUtil.replace(template, "\\'", "''"); template = StringUtil.replace(template, "\\n", "'||CHR(10)||'"); return template; } DB2DB(int majorVersion, int minorVersion); @Override String buildSQL(String template); @Override String getPopulateSQL(String databaseName, String sqlContent); @Override String getRecreateSQL(String databaseName); @Override boolean isSupportsInlineDistinct(); @Override boolean isSupportsScrollableResults(); @Override void runSQL(Connection con, String[] templates); @Override void runSQL(String template);  }
@Test public void testRewordAlterColumnType() throws Exception { Assert.assertEquals( "alter table DLFolder alter column userName set data type " + "varchar(75);\n", buildSQL("alter_column_type DLFolder userName VARCHAR(75);")); }
@Test public void testRewordAlterColumnTypeNoSemicolon() throws Exception { Assert.assertEquals( "alter table DLFolder alter column userName set data type " + "varchar(75);\n", buildSQL("alter_column_type DLFolder userName VARCHAR(75)")); }
@Test public void testRewordAlterColumnTypeNotNull() throws Exception { Assert.assertEquals( "alter table DLFolder alter column userName set data type " + "varchar(75);\n", buildSQL( "alter_column_type DLFolder userName VARCHAR(75) not null;")); Assert.assertEquals( "alter table DLFolder alter column userName set not null;", _nullableAlter); }
@Test public void testRewordAlterColumnTypeNull() throws Exception { Assert.assertEquals( "alter table DLFolder alter column userName set data type " + "varchar(75);\n", buildSQL("alter_column_type DLFolder userName VARCHAR(75) null;")); Assert.assertEquals( "alter table DLFolder alter column userName drop not null;", _nullableAlter); }
@Test public void testRewordRenameTable() throws Exception { Assert.assertEquals( "alter table a to b;\n", buildSQL(RENAME_TABLE_QUERY)); }