| Modifier and Type | Class and Description |
|---|---|
static class |
DatabaseImpl.FileFormatDetails
Internal details for each FileForrmat
|
Database.FileFormat| Modifier and Type | Field and Description |
|---|---|
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 OpenOption[] |
RO_CHANNEL_OPTS
read-only channel access mode
|
static OpenOption[] |
RW_CHANNEL_OPTS
read/write channel access mode for existing files
|
static OpenOption[] |
RWC_CHANNEL_OPTS
read/write/create channel access mode for new files
|
ALLOW_AUTONUM_INSERT_PROPERTY, BROKEN_NIO_PROPERTY, CHARSET_PROPERTY_PREFIX, COLUMN_ORDER_PROPERTY, DATE_TIME_TYPE_PROPERTY, DEFAULT_AUTO_SYNC, DEFAULT_COLUMN_ORDER, ENABLE_EXPRESSION_EVALUATION_PROPERTY, FK_ENFORCE_PROPERTY, RESOURCE_PATH_PROPERTY, TIMEZONE_PROPERTY| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the database file (and any linked databases).
|
static DatabaseImpl |
create(Database.FileFormat fileFormat,
Path mdbFile,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone)
Create a new Database for the given fileFormat
|
SimpleDateFormat |
createDateFormat(String formatStr)
Returns a SimpleDateFormat for the given format string which is
configured with a compatible Calendar instance (see
DatabaseBuilder.toCompatibleCalendar(java.util.Calendar)) and this database's
TimeZone. |
void |
createLinkedTable(String name,
String linkedDbName,
String linkedTableName)
Create a new table in this database
|
void |
createTable(String name,
List<ColumnBuilder> columns)
Deprecated.
use
TableBuilder instead |
void |
createTable(String name,
List<ColumnBuilder> columns,
List<IndexBuilder> indexes)
Deprecated.
use
TableBuilder instead |
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). |
ColumnValidatorFactory |
getColumnValidatorFactory()
Gets currently configured ColumnValidatorFactory (always non-
null). |
String |
getDatabasePassword() |
PropertyMap |
getDatabaseProperties() |
com.healthmarketscience.jackcess.impl.ColumnImpl.DateTimeFactory |
getDateTimeFactory() |
DateTimeType |
getDateTimeType()
Gets the currently configured DateTimeType.
|
static boolean |
getDefaultAllowAutoNumberInsert()
Returns the default allow auto number insert policy.
|
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 DateTimeType |
getDefaultDateTimeType()
Returns the default DateTimeType.
|
static boolean |
getDefaultEnforceForeignKeys()
Returns the default enforce foreign-keys policy.
|
static boolean |
getDefaultEvaluateExpressions()
Returns the default enable expression evaluation policy.
|
ColumnImpl.SortOrder |
getDefaultSortOrder() |
static TimeZone |
getDefaultTimeZone()
Returns the default TimeZone.
|
ErrorHandler |
getErrorHandler()
Gets the currently configured ErrorHandler (always non-
null). |
EvalConfig |
getEvalConfig()
Returns the EvalConfig for configuring expression evaluation.
|
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). |
String |
getName() |
PageChannel |
getPageChannel() |
static byte[] |
getPasswordMask(ByteBuffer buffer,
JetFormat format)
Returns the password mask retrieved from the given header page and
format, or
null if this format does not use a password mask. |
Path |
getPath()
Returns the File underlying this Database
|
PropertyMaps |
getPropertiesForObject(int objectId,
com.healthmarketscience.jackcess.impl.PropertyMaps.Owner owner) |
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) |
TableMetaData |
getTableMetaData(String name) |
Set<String> |
getTableNames() |
TimeZone |
getTimeZone()
Gets currently configured TimeZone (always non-
null and aligned
with the ZoneId). |
PropertyMap |
getUserDefinedProperties() |
ZoneId |
getZoneId()
Gets currently configured ZoneId (always non-
null and aligned
with the TimeZone). |
boolean |
isAllowAutoNumberInsert()
Gets current allow auto number insert policy.
|
static boolean |
isBlank(String name)
Returns
true if the given string is null or all blank
space, false otherwise. |
boolean |
isEnforceForeignKeys()
Gets current foreign-key enforcement policy.
|
boolean |
isEvaluateExpressions()
Gets the current expression evaluation policy.
|
boolean |
isLinkedTable(Table table)
Returns
true if this Database links to the given Table, false otherwise. |
boolean |
isReadOnly() |
Iterator<Table> |
iterator() |
Iterator<Table> |
iterator(TableIterableBuilder builder) |
TableIterableBuilder |
newIterable()
Convenience method for constructing a new TableIterableBuilder for this
cursor.
|
Iterable<TableMetaData> |
newTableMetaDataIterable() |
static DatabaseImpl |
open(Path mdbFile,
boolean readOnly,
FileChannel channel,
boolean autoSync,
Charset charset,
TimeZone timeZone,
CodecProvider provider,
boolean ignoreSystemCatalogIndex)
Open an existing Database.
|
PropertyMaps |
readProperties(byte[] propsBytes,
int objectId,
RowIdImpl rowId) |
void |
setAllowAutoNumberInsert(Boolean allowAutoNumInsert)
Sets the new auto number insert policy for the database (unless
overridden at the Table level).
|
void |
setCharset(Charset newCharset)
Sets a new Charset.
|
void |
setColumnOrder(Table.ColumnOrder newColumnOrder)
Sets a new Table.ColumnOrder.
|
void |
setColumnValidatorFactory(ColumnValidatorFactory newFactory)
Sets a new ColumnValidatorFactory.
|
void |
setDateTimeType(DateTimeType dateTimeType)
Sets the DateTimeType.
|
void |
setEnforceForeignKeys(Boolean newEnforceForeignKeys)
Sets a new foreign-key enforcement policy.
|
void |
setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler.
|
void |
setEvaluateExpressions(Boolean evaluateExpressions)
Sets the current expression evaluation policy.
|
void |
setLinkResolver(LinkResolver newLinkResolver)
Sets a new LinkResolver.
|
void |
setTimeZone(TimeZone newTimeZone)
Sets a new TimeZone.
|
void |
setZoneId(ZoneId newZoneId)
Sets a new ZoneId.
|
static String |
toLookupName(String name) |
String |
toString() |
static String |
trimToNull(String str)
Returns the given string trimmed, or
null if the string is null or empty. |
static void |
validateIdentifierName(String name,
int maxLength,
String identifierType)
Validates an identifier name.
|
void |
validateNewTableName(String name) |
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitnewTableMetaDataStream, streamforEach, spliteratorpublic static final String DEFAULT_RESOURCE_PATH
public static final int HIDDEN_OBJECT_FLAG
public static final OpenOption[] RO_CHANNEL_OPTS
public static final OpenOption[] RW_CHANNEL_OPTS
public static final OpenOption[] RWC_CHANNEL_OPTS
public static DatabaseImpl open(Path mdbFile, boolean readOnly, FileChannel channel, boolean autoSync, Charset charset, TimeZone timeZone, CodecProvider provider, boolean ignoreSystemCatalogIndex) 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 necessaryIOExceptionpublic static DatabaseImpl create(Database.FileFormat fileFormat, Path 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 defaultIOExceptionpublic File getFile()
Databasepublic Path getPath()
Databasepublic String getName()
public boolean isReadOnly()
public PageChannel getPageChannel()
public JetFormat getFormat()
public TableImpl getSystemCatalog()
public TableImpl getAccessControlEntries() throws IOException
IOExceptionpublic 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()
DatabasegetLinkedDatabases in interface Databasepublic boolean isLinkedTable(Table table) throws IOException
Databasetrue if this Database links to the given Table, false otherwise.isLinkedTable in interface DatabaseIOExceptionpublic TimeZone getTimeZone()
Databasenull and aligned
with the ZoneId).getTimeZone in interface Databasepublic void setTimeZone(TimeZone newTimeZone)
Databasenull, resets to the default value. Note
that setting the TimeZone will alter the ZoneId as well.setTimeZone in interface Databasepublic ZoneId getZoneId()
Databasenull and aligned
with the TimeZone).public void setZoneId(ZoneId newZoneId)
Databasenull, resets to the default value. Note
that setting the ZoneId will alter the TimeZone as well.public DateTimeType getDateTimeType()
DatabasegetDateTimeType in interface Databasepublic void setDateTimeType(DateTimeType dateTimeType)
Databasenull, resets to the default value.setDateTimeType in interface Databasepublic com.healthmarketscience.jackcess.impl.ColumnImpl.DateTimeFactory getDateTimeFactory()
public 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()
DatabaseisEnforceForeignKeys in interface Databasepublic void setEnforceForeignKeys(Boolean newEnforceForeignKeys)
Databasenull, resets to
the default value.setEnforceForeignKeys in interface Databasepublic boolean isAllowAutoNumberInsert()
Databasetrue allows the caller to optionally set the value explicitly when
adding or updating rows (if a value is not provided, it will still be
handled internally by the Table). This value can be set database-wide
using Database.setAllowAutoNumberInsert(java.lang.Boolean) and/or on a per-table basis using
Table.setAllowAutoNumberInsert(java.lang.Boolean) (and/or on a jvm-wide using the
Database.ALLOW_AUTONUM_INSERT_PROPERTY system property). Note that
enabling this feature should be done with care to reduce the
chances of screwing up the database.isAllowAutoNumberInsert in interface Databasepublic void setAllowAutoNumberInsert(Boolean allowAutoNumInsert)
Databasenull, resets to the default
value.setAllowAutoNumberInsert in interface Databasepublic boolean isEvaluateExpressions()
DatabaseisEvaluateExpressions in interface Databasepublic void setEvaluateExpressions(Boolean evaluateExpressions)
Databasenull,
resets to the default value.setEvaluateExpressions in interface Databasepublic ColumnValidatorFactory getColumnValidatorFactory()
Databasenull).getColumnValidatorFactory in interface Databasepublic void setColumnValidatorFactory(ColumnValidatorFactory newFactory)
Databasenull, resets to the
default value. The configured ColumnValidatorFactory will be used to
create ColumnValidator instances on any user tables loaded from
this point onward (this will not be used for system tables).setColumnValidatorFactory in interface Databasepublic EvalConfig getEvalConfig()
DatabasegetEvalConfig in interface Databasepublic SimpleDateFormat createDateFormat(String formatStr)
DatabaseBuilder.toCompatibleCalendar(java.util.Calendar)) and this database's
TimeZone.public Database.FileFormat getFileFormat() throws IOException
DatabasegetFileFormat in interface DatabaseIOExceptionpublic ColumnImpl.SortOrder getDefaultSortOrder() throws IOException
IOExceptionpublic short getDefaultCodePage()
throws IOException
IOExceptionpublic PropertyMaps readProperties(byte[] propsBytes, int objectId, RowIdImpl rowId) throws IOException
null result).IOExceptionpublic Set<String> getTableNames() throws IOException
getTableNames in interface DatabaseIOExceptionpublic 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(TableIterableBuilder builder)
public TableIterableBuilder newIterable()
DatabasenewIterable in interface Databasepublic Iterable<TableMetaData> newTableMetaDataIterable()
newTableMetaDataIterable in interface Databasepublic TableImpl getTable(String name) throws IOException
getTable in interface Databasename - User table name (case-insensitive)IOExceptionpublic TableMetaData getTableMetaData(String name) throws IOException
getTableMetaData in interface Databasename - Table name (case-insensitive), may be any table type
(i.e. includes system or linked tables).IOExceptionpublic TableImpl getTable(int tableDefPageNumber) throws IOException
tableDefPageNumber - the page number of a table definitionIOException@Deprecated public void createTable(String name, List<ColumnBuilder> columns) throws IOException
TableBuilder insteadname - Name of the table to createcolumns - List of Columns in the tableIOException@Deprecated public void createTable(String name, List<ColumnBuilder> columns, List<IndexBuilder> indexes) throws IOException
TableBuilder insteadname - Name of the table to createcolumns - List of Columns in the tableindexes - List of IndexBuilders describing indexes for the tableIOExceptionpublic void createLinkedTable(String name, String linkedDbName, String linkedTableName) throws IOException
DatabasecreateLinkedTable in interface Databasename - Name of the table to create in this databaselinkedDbName - path to the linked databaselinkedTableName - name of the table in the linked databaseIOExceptionpublic List<Relationship> getRelationships(Table table1, Table table2) throws IOException
DatabasegetRelationships in interface DatabaseIOExceptionpublic List<Relationship> getRelationships(TableImpl table1, TableImpl table2) throws IOException
IOExceptionpublic List<Relationship> getRelationships(Table table) throws IOException
DatabasegetRelationships in interface DatabaseIOExceptionpublic List<Relationship> getRelationships() throws IOException
DatabaseWarning, this may load all the Tables (metadata, not data) in the database which could cause memory issues.
getRelationships in interface DatabaseIOExceptionpublic List<Relationship> getSystemRelationships() throws IOException
DatabaseWarning, this may load all the Tables (metadata, not data) in the database which could cause memory issues.
getSystemRelationships in interface DatabaseIOExceptionpublic List<Query> getQueries() throws IOException
DatabasegetQueries in interface DatabaseIOExceptionpublic 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 tablenull if it doesn't existIOExceptionpublic PropertyMap getDatabaseProperties() throws IOException
getDatabaseProperties in interface DatabaseIOExceptionpublic PropertyMap getSummaryProperties() throws IOException
getSummaryProperties in interface DatabaseIOExceptionpublic PropertyMap getUserDefinedProperties() throws IOException
getUserDefinedProperties in interface DatabaseIOExceptionpublic PropertyMaps getPropertiesForObject(int objectId, com.healthmarketscience.jackcess.impl.PropertyMaps.Owner owner) throws IOException
IOExceptionpublic String getDatabasePassword() throws IOException
getDatabasePassword in interface Databasenull if none set.IOExceptionpublic void flush()
throws IOException
Databaseflush in interface Databaseflush in interface FlushableIOExceptionpublic void close()
throws IOException
Databaseclose in interface Databaseclose in interface Closeableclose in interface AutoCloseableIOExceptionpublic void validateNewTableName(String name) throws IOException
IOExceptionpublic static void validateIdentifierName(String name, int maxLength, String identifierType)
public static boolean isBlank(String name)
true if the given string is null or all blank
space, false otherwise.public static String trimToNull(String str)
null if the string is null or empty.public 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 boolean getDefaultAllowAutoNumberInsert()
false, but can be overridden using the system
property "com.healthmarketscience.jackcess.allowAutoNumberInsert".public static boolean getDefaultEvaluateExpressions()
true, but can be overridden using the system
property "com.healthmarketscience.jackcess.enableExpressionEvaluation".public static DateTimeType getDefaultDateTimeType()
DateTimeType.LOCAL_DATE_TIME, but can be overridden using the system
property "com.healthmarketscience.jackcess.dateTimeType".public static byte[] getPasswordMask(ByteBuffer buffer, JetFormat format)
null if this format does not use a password mask.public static DatabaseImpl.FileFormatDetails getFileFormatDetails(Database.FileFormat fileFormat)
Copyright © 2005–2025 OpenHMS. All rights reserved.