From 322d32d4be01471ad9d41fc05e0c5a11c8ec7de0 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 29 Jul 2011 04:07:11 +0000 Subject: add Database.getSystemTableNames to enable retrieving the list of system/hidden tables git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@570 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../com/healthmarketscience/jackcess/Database.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/java/com/healthmarketscience') diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java index a856b02..7326d69 100644 --- a/src/java/com/healthmarketscience/jackcess/Database.java +++ b/src/java/com/healthmarketscience/jackcess/Database.java @@ -980,12 +980,25 @@ public class Database if(_tableNames == null) { Set tableNames = new TreeSet(String.CASE_INSENSITIVE_ORDER); - _tableFinder.getTableNames(tableNames); + _tableFinder.getTableNames(tableNames, false); _tableNames = tableNames; } return _tableNames; } + /** + * @return The names of all of the system tables (String). Note, in order + * to read these tables, you must use {@link #getSystemTable}. + * Extreme care should be taken if modifying these tables + * directly!. + */ + public Set getSystemTableNames() throws IOException { + Set sysTableNames = + new TreeSet(String.CASE_INSENSITIVE_ORDER); + _tableFinder.getTableNames(sysTableNames, true); + return sysTableNames; + } + /** * @return an unmodifiable Iterator of the user Tables in this Database. * @throws IllegalStateException if an IOException is thrown by one of the @@ -2015,8 +2028,10 @@ public class Database return ((cur != null) ? cur.getCurrentRow(columns) : null); } - public void getTableNames(Set tableNames) throws IOException { - + public void getTableNames(Set tableNames, + boolean systemTables) + throws IOException + { for(Map row : getTableNamesCursor().iterable( SYSTEM_CATALOG_TABLE_NAME_COLUMNS)) { @@ -2026,7 +2041,7 @@ public class Database int parentId = (Integer)row.get(CAT_COL_PARENT_ID); if((parentId == _tableParentId) && TYPE_TABLE.equals(type) && - !isSystemObject(flags)) { + (isSystemObject(flags) == systemTables)) { tableNames.add(tableName); } } -- cgit v1.2.3