From e6c3f4ad8e9ed493c90b42f3797bee0bb26f24cb Mon Sep 17 00:00:00 2001 From: Tim McCune Date: Mon, 3 Jul 2006 02:55:30 +0000 Subject: [PATCH] Added getName() to Table git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@63 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../healthmarketscience/jackcess/Database.java | 6 +++--- .../com/healthmarketscience/jackcess/Table.java | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java index d5f12fe..93e8a83 100644 --- a/src/java/com/healthmarketscience/jackcess/Database.java +++ b/src/java/com/healthmarketscience/jackcess/Database.java @@ -238,7 +238,7 @@ public class Database { throw new IOException("Looking for system catalog at page " + PAGE_SYSTEM_CATALOG + ", but page type is " + pageType); } - _systemCatalog = new Table(_buffer, _pageChannel, _format, PAGE_SYSTEM_CATALOG); + _systemCatalog = new Table(_buffer, _pageChannel, _format, PAGE_SYSTEM_CATALOG, "System Catalog"); Map row; while ( (row = _systemCatalog.getNextRow(Arrays.asList( COL_NAME, COL_TYPE, COL_ID))) != null) @@ -271,7 +271,7 @@ public class Database { throw new IOException("Looking for MSysACEs at page " + pageNum + ", but page type is " + pageType); } - _accessControlEntries = new Table(buffer, _pageChannel, _format, pageNum); + _accessControlEntries = new Table(buffer, _pageChannel, _format, pageNum, "Access Control Entries"); } /** @@ -298,7 +298,7 @@ public class Database { return null; } else { _pageChannel.readPage(_buffer, pageNumber.intValue()); - return new Table(_buffer, _pageChannel, _format, pageNumber.intValue()); + return new Table(_buffer, _pageChannel, _format, pageNumber.intValue(), name); } } diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java index c09792e..46bcc63 100644 --- a/src/java/com/healthmarketscience/jackcess/Table.java +++ b/src/java/com/healthmarketscience/jackcess/Table.java @@ -82,6 +82,8 @@ public class Table { private List _indexes = new ArrayList(); /** Used to read in pages */ private PageChannel _pageChannel; + /** Table name as stored in Database */ + private String _name; /** Usage map of pages that this table owns */ private UsageMap _ownedPages; /** Usage map of pages that this table owns with free space on them */ @@ -99,8 +101,9 @@ public class Table { * @param pageChannel Page channel to get database pages from * @param format Format of the database that contains this table * @param pageNumber Page number of the table definition + * @param name Table name */ - protected Table(ByteBuffer buffer, PageChannel pageChannel, JetFormat format, int pageNumber) + protected Table(ByteBuffer buffer, PageChannel pageChannel, JetFormat format, int pageNumber, String name) throws IOException, SQLException { _buffer = buffer; @@ -123,7 +126,15 @@ public class Table { newBuffer.put(nextPageBuffer.array(), 8, format.PAGE_SIZE - 8); _buffer = newBuffer; } - readPage(); + readPage(); + _name = name; + } + + /** + * @return The name of the table + */ + public String getName() { + return _name; } /** -- 2.39.5