Browse Source

Load linked table info from system table when reading databases with unsupported sort orders. Fixes issue #123

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@935 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-2.1.1
James Ahlborn 9 years ago
parent
commit
09c42b87bb

+ 6
- 0
src/changes/changes.xml View File

<author email="javajedi@users.sf.net">Tim McCune</author> <author email="javajedi@users.sf.net">Tim McCune</author>
</properties> </properties>
<body> <body>
<release version="2.1.1" date="TBD">
<action dev="jahlborn" type="fix" system="SourceForge2" issue="123">
Load linked table info from system table when reading databases with
unsupported sort orders.
</action>
</release>
<release version="2.1.0" date="2015-04-16" <release version="2.1.0" date="2015-04-16"
description="Relicense to Apache License"> description="Relicense to Apache License">
<action dev="jahlborn" type="add"> <action dev="jahlborn" type="add">

+ 9
- 9
src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java View File

/** the columns to read when reading system catalog normally */ /** the columns to read when reading system catalog normally */
private static Collection<String> SYSTEM_CATALOG_COLUMNS = private static Collection<String> SYSTEM_CATALOG_COLUMNS =
new HashSet<String>(Arrays.asList(CAT_COL_NAME, CAT_COL_TYPE, CAT_COL_ID, new HashSet<String>(Arrays.asList(CAT_COL_NAME, CAT_COL_TYPE, CAT_COL_ID,
CAT_COL_FLAGS, CAT_COL_DATABASE,
CAT_COL_FOREIGN_NAME));
/** the columns to read when finding table names */
private static Collection<String> SYSTEM_CATALOG_TABLE_NAME_COLUMNS =
new HashSet<String>(Arrays.asList(CAT_COL_NAME, CAT_COL_TYPE, CAT_COL_ID,
CAT_COL_FLAGS, CAT_COL_PARENT_ID)); CAT_COL_FLAGS, CAT_COL_PARENT_ID));
/** the columns to read when finding table details */
private static Collection<String> SYSTEM_CATALOG_TABLE_DETAIL_COLUMNS =
new HashSet<String>(Arrays.asList(CAT_COL_NAME, CAT_COL_TYPE, CAT_COL_ID,
CAT_COL_FLAGS, CAT_COL_PARENT_ID,
CAT_COL_DATABASE, CAT_COL_FOREIGN_NAME));
/** the columns to read when getting object propertyes */ /** the columns to read when getting object propertyes */
private static Collection<String> SYSTEM_CATALOG_PROPS_COLUMNS = private static Collection<String> SYSTEM_CATALOG_PROPS_COLUMNS =
new HashSet<String>(Arrays.asList(CAT_COL_ID, CAT_COL_PROPS)); new HashSet<String>(Arrays.asList(CAT_COL_ID, CAT_COL_PROPS));
throws IOException throws IOException
{ {
for(Row row : getTableNamesCursor().newIterable().setColumnNames( for(Row row : getTableNamesCursor().newIterable().setColumnNames(
SYSTEM_CATALOG_TABLE_NAME_COLUMNS)) {
SYSTEM_CATALOG_COLUMNS)) {


String tableName = row.getString(CAT_COL_NAME); String tableName = row.getString(CAT_COL_NAME);
int flags = row.getInt(CAT_COL_FLAGS); int flags = row.getInt(CAT_COL_FLAGS);
public boolean isLinkedTable(Table table) throws IOException public boolean isLinkedTable(Table table) throws IOException
{ {
for(Row row : getTableNamesCursor().newIterable().setColumnNames( for(Row row : getTableNamesCursor().newIterable().setColumnNames(
SYSTEM_CATALOG_COLUMNS)) {
SYSTEM_CATALOG_TABLE_DETAIL_COLUMNS)) {
Short type = row.getShort(CAT_COL_TYPE); Short type = row.getShort(CAT_COL_TYPE);
String linkedDbName = row.getString(CAT_COL_DATABASE); String linkedDbName = row.getString(CAT_COL_DATABASE);
String linkedTableName = row.getString(CAT_COL_FOREIGN_NAME); String linkedTableName = row.getString(CAT_COL_FOREIGN_NAME);
} }


Row row = _systemCatalogCursor.getCurrentRow( Row row = _systemCatalogCursor.getCurrentRow(
SYSTEM_CATALOG_COLUMNS);
SYSTEM_CATALOG_TABLE_DETAIL_COLUMNS);
Integer pageNumber = row.getInt(CAT_COL_ID); Integer pageNumber = row.getInt(CAT_COL_ID);
String realName = row.getString(CAT_COL_NAME); String realName = row.getString(CAT_COL_NAME);
int flags = row.getInt(CAT_COL_FLAGS); int flags = row.getInt(CAT_COL_FLAGS);
public TableInfo lookupTable(String tableName) throws IOException { public TableInfo lookupTable(String tableName) throws IOException {


for(Row row : _systemCatalogCursor.newIterable().setColumnNames( for(Row row : _systemCatalogCursor.newIterable().setColumnNames(
SYSTEM_CATALOG_TABLE_NAME_COLUMNS)) {
SYSTEM_CATALOG_TABLE_DETAIL_COLUMNS)) {


Short type = row.getShort(CAT_COL_TYPE); Short type = row.getShort(CAT_COL_TYPE);
if(!isTableType(type)) { if(!isTableType(type)) {

Loading…
Cancel
Save