修复AbstractDevotedDBMetaResolver.getColumns(Connection,String)方法的一个BUG,此BUG可能导致数据导入/导出等相关功能出错

This commit is contained in:
interestinglife 2020-07-25 13:38:21 +08:00
parent 9f7d3b2833
commit 0bf44a63c0
2 changed files with 14 additions and 1 deletions

View File

@ -165,7 +165,7 @@ public abstract class AbstractDevotedDBMetaResolver extends JdbcSupport implemen
DatabaseMetaData metaData = getDatabaseMetaData(cn);
String schema = getSchema(cn, metaData);
return getColumns(cn, metaData, schema, catalog, tableName, null);
return getColumns(cn, metaData, catalog, schema, tableName, null);
}
@Override

View File

@ -9,6 +9,7 @@ import static org.hamcrest.collection.ArrayMatching.arrayContaining;
import static org.hamcrest.collection.ArrayMatching.hasItemInArray;
import static org.hamcrest.core.IsIterableContaining.hasItem;
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.sql.Connection;
@ -78,4 +79,16 @@ public class GenericDBMetaResolverTest extends DBTestSupport
hasItemInArray(hasProperty("columnNames", arrayContaining(equalToIgnoringCase("ACCOUNT_ID")))));
}
}
@Test
public void getColumnsTest() throws Exception
{
Column[] columns = this.genericDBMetaResolver.getColumns(this.connection, "T_ACCOUNT");
assertEquals(4, columns.length);
assertThat(columns[0].getName(), equalToIgnoringCase("ID"));
assertThat(columns[1].getName(), equalToIgnoringCase("NAME"));
assertThat(columns[2].getName(), equalToIgnoringCase("HEAD_IMG"));
assertThat(columns[3].getName(), equalToIgnoringCase("INTRODUCTION"));
}
}