|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.jackcess.impl.DatabaseImpl
public class DatabaseImpl
| Nested Class Summary | |
|---|---|
static class |
DatabaseImpl.FileFormatDetails
Internal details for each FileForrmat |
| Nested classes/interfaces inherited from interface com.healthmarketscience.jackcess.Database |
|---|
Database.FileFormat |
| Field Summary | |
|---|---|
static String |
DEFAULT_RESOURCE_PATH
the default value for the resource path used to load classpath resources. |
static int |
HIDDEN_OBJECT_FLAG
this object is hidden |
static String |
RO_CHANNEL_MODE
read-only channel access mode |
static String |
RW_CHANNEL_MODE
read/write channel access mode |
| Fields inherited from interface com.healthmarketscience.jackcess.Database |
|---|
BROKEN_NIO_PROPERTY, CHARSET_PROPERTY_PREFIX, COLUMN_ORDER_PROPERTY, DEFAULT_AUTO_SYNC, DEFAULT_COLUMN_ORDER, FK_ENFORCE_PROPERTY, RESOURCE_PATH_PROPERTY, TIMEZONE_PROPERTY |
| Method Summary | |
|---|---|
void |
close()
Close the database file (and any linked databases). |
static DatabaseImpl |
create(Database.FileFormat fileFormat,
File mdbFile,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone)
Create a new Database for the given fileFormat |
void |
createLinkedTable(String name,
String linkedDbName,
String linkedTableName)
Create a new table in this database |
void |
createTable(String name,
List<ColumnBuilder> columns)
Create a new table in this database |
void |
createTable(String name,
List<ColumnBuilder> columns,
List<IndexBuilder> indexes)
Create a new table in this database |
void |
flush()
Flushes any current changes to the database file (and any linked databases) to disk. |
TableImpl |
getAccessControlEntries()
|
Charset |
getCharset()
Gets currently configured Charset (always non- null). |
Table.ColumnOrder |
getColumnOrder()
Gets currently configured Table.ColumnOrder (always non-null). |
String |
getDatabasePassword()
|
PropertyMap |
getDatabaseProperties()
|
static Charset |
getDefaultCharset(JetFormat format)
Returns the default Charset for the given JetFormat. |
short |
getDefaultCodePage()
|
static Table.ColumnOrder |
getDefaultColumnOrder()
Returns the default Table.ColumnOrder. |
static boolean |
getDefaultEnforceForeignKeys()
Returns the default enforce foreign-keys policy. |
ColumnImpl.SortOrder |
getDefaultSortOrder()
|
static TimeZone |
getDefaultTimeZone()
Returns the default TimeZone. |
ErrorHandler |
getErrorHandler()
Gets the currently configured ErrorHandler (always non- null). |
File |
getFile()
Returns the File underlying this Database |
Database.FileFormat |
getFileFormat()
Returns the FileFormat of this database (which may involve inspecting the database itself). |
static DatabaseImpl.FileFormatDetails |
getFileFormatDetails(Database.FileFormat fileFormat)
|
JetFormat |
getFormat()
|
Map<String,Database> |
getLinkedDatabases()
Returns an unmodifiable view of the currently loaded linked databases, mapped from the linked database file name to the linked database. |
LinkResolver |
getLinkResolver()
Gets the currently configured LinkResolver (always non- null). |
PageChannel |
getPageChannel()
|
PropertyMaps |
getPropertiesForObject(int objectId)
|
List<Query> |
getQueries()
Finds all the queries in the database. |
List<Relationship> |
getRelationships()
Finds all the relationships in the database in non-system tables. |
List<Relationship> |
getRelationships(Table table)
Finds all the relationships in the database for the given table. |
List<Relationship> |
getRelationships(TableImpl table1,
TableImpl table2)
|
List<Relationship> |
getRelationships(Table table1,
Table table2)
Finds all the relationships in the database between the given tables. |
PropertyMap |
getSummaryProperties()
|
TableImpl |
getSystemCatalog()
|
TableImpl |
getSystemComplexColumns()
|
List<Relationship> |
getSystemRelationships()
Finds all the relationships in the database, including system tables. |
TableImpl |
getSystemTable(String tableName)
Returns a reference to any available table in this access database, including system tables. |
Set<String> |
getSystemTableNames()
|
TableImpl |
getTable(int tableDefPageNumber)
|
TableImpl |
getTable(String name)
|
Set<String> |
getTableNames()
|
TimeZone |
getTimeZone()
Gets currently configured TimeZone (always non- null). |
PropertyMap |
getUserDefinedProperties()
|
boolean |
isEnforceForeignKeys()
Gets currently foreign-key enforcement policy. |
Iterator<Table> |
iterator()
|
static DatabaseImpl |
open(File mdbFile,
boolean readOnly,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone,
CodecProvider provider)
Open an existing Database. |
PropertyMaps |
readProperties(byte[] propsBytes,
int objectId,
RowIdImpl rowId)
|
void |
setCharset(Charset newCharset)
Sets a new Charset. |
void |
setColumnOrder(Table.ColumnOrder newColumnOrder)
Sets a new Table.ColumnOrder. |
void |
setEnforceForeignKeys(Boolean newEnforceForeignKeys)
Sets a new foreign-key enforcement policy. |
void |
setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler. |
void |
setLinkResolver(LinkResolver newLinkResolver)
Sets a new LinkResolver. |
void |
setTimeZone(TimeZone newTimeZone)
Sets a new TimeZone. |
static String |
toLookupName(String name)
|
String |
toString()
|
static void |
validateIdentifierName(String name,
int maxLength,
String identifierType)
Validates an identifier name. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_RESOURCE_PATH
public static final int HIDDEN_OBJECT_FLAG
public static final String RO_CHANNEL_MODE
public static final String RW_CHANNEL_MODE
| Method Detail |
|---|
public static DatabaseImpl open(File mdbFile,
boolean readOnly,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone,
CodecProvider provider)
throws IOException
true, the file will be opened read-only.
mdbFile - File containing the databasereadOnly - iff true, force opening file in read-only
modechannel - pre-opened FileChannel. if provided explicitly, it will
not be closed by this Database instanceautoSync - whether or not to enable auto-syncing on write. if
true, writes will be immediately flushed to disk.
This leaves the database in a (fairly) consistent state
on each write, but can be very inefficient for many
updates. if false, flushing to disk happens at
the jvm's leisure, which can be much faster, but may
leave the database in an inconsistent state if failures
are encountered during writing. Writes may be flushed at
any time using flush().charset - Charset to use, if null, uses defaulttimeZone - TimeZone to use, if null, uses defaultprovider - CodecProvider for handling page encoding/decoding, may be
null if no special encoding is necessary
IOException
public static DatabaseImpl create(Database.FileFormat fileFormat,
File mdbFile,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone)
throws IOException
fileFormat - version of new database.mdbFile - Location to write the new database to. If this file
already exists, it will be overwritten.channel - pre-opened FileChannel. if provided explicitly, it will
not be closed by this Database instanceautoSync - whether or not to enable auto-syncing on write. if
true, writes will be immediately flushed to disk.
This leaves the database in a (fairly) consistent state
on each write, but can be very inefficient for many
updates. if false, flushing to disk happens at
the jvm's leisure, which can be much faster, but may
leave the database in an inconsistent state if failures
are encountered during writing. Writes may be flushed at
any time using flush().charset - Charset to use, if null, uses defaulttimeZone - TimeZone to use, if null, uses default
IOExceptionpublic File getFile()
Database
getFile in interface Databasepublic PageChannel getPageChannel()
public JetFormat getFormat()
public TableImpl getSystemCatalog()
public TableImpl getAccessControlEntries()
throws IOException
IOException
public TableImpl getSystemComplexColumns()
throws IOException
IOExceptionpublic ErrorHandler getErrorHandler()
Databasenull).
This will be used to handle all errors unless overridden at the Table or
Cursor level.
getErrorHandler in interface Databasepublic void setErrorHandler(ErrorHandler newErrorHandler)
Databasenull, resets to the
ErrorHandler.DEFAULT.
setErrorHandler in interface Databasepublic LinkResolver getLinkResolver()
Databasenull).
This will be used to handle all linked database loading.
getLinkResolver in interface Databasepublic void setLinkResolver(LinkResolver newLinkResolver)
Databasenull, resets to the
LinkResolver.DEFAULT.
setLinkResolver in interface Databasepublic Map<String,Database> getLinkedDatabases()
Database
getLinkedDatabases in interface Databasepublic TimeZone getTimeZone()
Databasenull).
getTimeZone in interface Databasepublic void setTimeZone(TimeZone newTimeZone)
Databasenull, resets to the default value.
setTimeZone in interface Databasepublic Charset getCharset()
Databasenull).
getCharset in interface Databasepublic void setCharset(Charset newCharset)
Databasenull, resets to the default value.
setCharset in interface Databasepublic Table.ColumnOrder getColumnOrder()
DatabaseTable.ColumnOrder (always non-null).
getColumnOrder in interface Databasepublic void setColumnOrder(Table.ColumnOrder newColumnOrder)
Databasenull, resets to the default value.
setColumnOrder in interface Databasepublic boolean isEnforceForeignKeys()
Database
isEnforceForeignKeys in interface Databasepublic void setEnforceForeignKeys(Boolean newEnforceForeignKeys)
Databasenull, resets to
the default value.
setEnforceForeignKeys in interface Database
public Database.FileFormat getFileFormat()
throws IOException
Database
getFileFormat in interface DatabaseIOException
public ColumnImpl.SortOrder getDefaultSortOrder()
throws IOException
IOException
public short getDefaultCodePage()
throws IOException
IOException
public PropertyMaps readProperties(byte[] propsBytes,
int objectId,
RowIdImpl rowId)
throws IOException
null result).
IOException
public Set<String> getTableNames()
throws IOException
getTableNames in interface DatabaseIOException
public Set<String> getSystemTableNames()
throws IOException
getSystemTableNames in interface DatabaseDatabase.getSystemTable(java.lang.String).
Extreme care should be taken if modifying these tables
directly!.
IOExceptionpublic Iterator<Table> iterator()
iterator in interface Databaseiterator in interface Iterable<Table>
public TableImpl getTable(String name)
throws IOException
getTable in interface Databasename - Table name (case-insensitive)
IOException
public TableImpl getTable(int tableDefPageNumber)
throws IOException
tableDefPageNumber - the page number of a table definition
IOException
public void createTable(String name,
List<ColumnBuilder> columns)
throws IOException
name - Name of the table to createcolumns - List of Columns in the table
IOException
public void createTable(String name,
List<ColumnBuilder> columns,
List<IndexBuilder> indexes)
throws IOException
name - Name of the table to createcolumns - List of Columns in the tableindexes - List of IndexBuilders describing indexes for the table
IOException
public void createLinkedTable(String name,
String linkedDbName,
String linkedTableName)
throws IOException
Database
createLinkedTable in interface Databasename - Name of the table to create in this databaselinkedDbName - path to the linked databaselinkedTableName - name of the table in the linked database
IOException
public List<Relationship> getRelationships(Table table1,
Table table2)
throws IOException
Database
getRelationships in interface DatabaseIOException
public List<Relationship> getRelationships(TableImpl table1,
TableImpl table2)
throws IOException
IOException
public List<Relationship> getRelationships(Table table)
throws IOException
Database
getRelationships in interface DatabaseIOException
public List<Relationship> getRelationships()
throws IOException
Database
getRelationships in interface DatabaseIOException
public List<Relationship> getSystemRelationships()
throws IOException
Database
getSystemRelationships in interface DatabaseIOException
public List<Query> getQueries()
throws IOException
Database
getQueries in interface DatabaseIOException
public TableImpl getSystemTable(String tableName)
throws IOException
DatabaseWarning, this method is not designed for common use, only for the occassional time when access to a system table is necessary. Messing with system tables can strip the paint off your house and give your whole family a permanent, orange afro. You have been warned.
getSystemTable in interface DatabasetableName - Table name, may be a system table
null if it doesn't exist
IOException
public PropertyMap getDatabaseProperties()
throws IOException
getDatabaseProperties in interface DatabaseIOException
public PropertyMap getSummaryProperties()
throws IOException
getSummaryProperties in interface DatabaseIOException
public PropertyMap getUserDefinedProperties()
throws IOException
getUserDefinedProperties in interface DatabaseIOException
public PropertyMaps getPropertiesForObject(int objectId)
throws IOException
IOException
public String getDatabasePassword()
throws IOException
getDatabasePassword in interface Databasenull if none set.
IOException
public void flush()
throws IOException
Database
flush in interface Databaseflush in interface FlushableIOException
public void close()
throws IOException
Database
close in interface Databaseclose in interface CloseableIOException
public static void validateIdentifierName(String name,
int maxLength,
String identifierType)
public String toString()
toString in class Objectpublic static String toLookupName(String name)
public static TimeZone getDefaultTimeZone()
TimeZone.getDefault(), but can be
overridden using the system property
"com.healthmarketscience.jackcess.timeZone".
public static Charset getDefaultCharset(JetFormat format)
"com.healthmarketscience.jackcess.charset.VERSION_3".
public static Table.ColumnOrder getDefaultColumnOrder()
Database.DEFAULT_COLUMN_ORDER, but can be overridden using the system
property "com.healthmarketscience.jackcess.columnOrder".
public static boolean getDefaultEnforceForeignKeys()
true, but can be overridden using the system
property "com.healthmarketscience.jackcess.enforceForeignKeys".
public static DatabaseImpl.FileFormatDetails getFileFormatDetails(Database.FileFormat fileFormat)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||