|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.healthmarketscience.jackcess.Database
public class Database
An Access database.
There is now experimental, optional support for large indexes (disabled by default). This optional support can be enabled via a few different means:
"true" will enable "large" index support accross the jvmsetUseBigIndex(boolean) with true on a Database
instance will enable "large" index support for all tables subsequently
created from that instancegetTable(String,boolean) can selectively
enable/disable "large" index support on a per-table basis (overriding
any Database or system property setting)
| Field Summary | |
|---|---|
static boolean |
DEFAULT_AUTO_SYNC
default value for the auto-sync value ( true). |
static String |
USE_BIG_INDEX_PROPERTY
system property which can be used to make big index support the default. |
| Method Summary | |
|---|---|
void |
close()
Close the database file |
void |
copyTable(String name,
ResultSet source)
Copy an existing JDBC ResultSet into a new table in this database |
void |
copyTable(String name,
ResultSet source,
ImportFilter filter)
Copy an existing JDBC ResultSet into a new table in this database |
static Database |
create(File mdbFile)
Create a new Database |
static Database |
create(File mdbFile,
boolean autoSync)
Create a new Database |
void |
createTable(String name,
List<Column> columns)
Create a new table in this database |
boolean |
defaultUseBigIndex()
Returns true if "big index support" has been enabled explicity on
the this Database or via a system property, false otherwise. |
boolean |
doUseBigIndex()
Whether or not big index support is enabled for tables. |
void |
flush()
Flushes any current changes to the database file to disk. |
Table |
getAccessControlEntries()
|
JetFormat |
getFormat()
|
PageChannel |
getPageChannel()
|
List<Relationship> |
getRelationships(Table table1,
Table table2)
Finds all the relationships in the database between the given tables. |
Table |
getSystemCatalog()
|
Table |
getTable(String name)
|
Table |
getTable(String name,
boolean useBigIndex)
|
Set<String> |
getTableNames()
|
void |
importFile(String name,
File f,
String delim)
Copy a delimited text file into a new table in this database |
void |
importFile(String name,
File f,
String delim,
ImportFilter filter)
Copy a delimited text file into a new table in this database |
void |
importReader(String name,
BufferedReader in,
String delim)
Copy a delimited text file into a new table in this database |
void |
importReader(String name,
BufferedReader in,
String delim,
ImportFilter filter)
Copy a delimited text file into a new table in this database |
static boolean |
isReservedWord(String s)
|
Iterator<Table> |
iterator()
|
static Database |
open(File mdbFile)
Open an existing Database. |
static Database |
open(File mdbFile,
boolean readOnly)
Open an existing Database. |
static Database |
open(File mdbFile,
boolean readOnly,
boolean autoSync)
Open an existing Database. |
void |
setUseBigIndex(boolean useBigIndex)
Set whether or not big index support is enabled for tables. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean DEFAULT_AUTO_SYNC
true). this is slower,
but leaves more chance of a useable database in the face of failures.
public static final String USE_BIG_INDEX_PROPERTY
| Method Detail |
|---|
public static Database open(File mdbFile)
throws IOException
mdbFile - File containing the database
IOException
public static Database open(File mdbFile,
boolean readOnly)
throws IOException
true, the file will be opened read-only.
Auto-syncing is enabled for the returned Database.
mdbFile - File containing the databasereadOnly - iff true, force opening file in read-only
mode
IOException
public static Database open(File mdbFile,
boolean readOnly,
boolean autoSync)
throws IOException
true, the file will be opened read-only.
mdbFile - File containing the databasereadOnly - iff true, force opening file in read-only
modeautoSync - 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.
IOException
public static Database create(File mdbFile)
throws IOException
mdbFile - Location to write the new database to. If this file
already exists, it will be overwritten.
IOException
public static Database create(File mdbFile,
boolean autoSync)
throws IOException
mdbFile - Location to write the new database to. If this file
already exists, it will be overwritten.autoSync - 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.
IOExceptionpublic PageChannel getPageChannel()
public JetFormat getFormat()
public Table getSystemCatalog()
public Table getAccessControlEntries()
public boolean doUseBigIndex()
public void setUseBigIndex(boolean useBigIndex)
public Set<String> getTableNames()
public Iterator<Table> iterator()
iterator in interface Iterable<Table>IllegalStateException - if an IOException is thrown by one of the
operations, the actual exception will be contained within
ConcurrentModificationException - if a table is added to the
database while an Iterator is in use.
public Table getTable(String name)
throws IOException
name - Table name
IOException
public Table getTable(String name,
boolean useBigIndex)
throws IOException
name - Table nameuseBigIndex - whether or not "big index support" should be enabled
for the table (this value will override any other
settings)
IOException
public void createTable(String name,
List<Column> columns)
throws IOException
name - Name of the table to createcolumns - List of Columns in the table
IOException
public List<Relationship> getRelationships(Table table1,
Table table2)
throws IOException
IOException
public void copyTable(String name,
ResultSet source)
throws SQLException,
IOException
name - Name of the new table to createsource - ResultSet to copy from
SQLException
IOException
public void copyTable(String name,
ResultSet source,
ImportFilter filter)
throws SQLException,
IOException
name - Name of the new table to createsource - ResultSet to copy fromfilter - valid import filter
SQLException
IOException
public void importFile(String name,
File f,
String delim)
throws IOException
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.
IOException
public void importFile(String name,
File f,
String delim,
ImportFilter filter)
throws IOException
name - Name of the new table to createf - Source file to importdelim - Regular expression representing the delimiter string.filter - valid import filter
IOException
public void importReader(String name,
BufferedReader in,
String delim)
throws IOException
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.
IOException
public void importReader(String name,
BufferedReader in,
String delim,
ImportFilter filter)
throws IOException
name - Name of the new table to createin - Source reader to importdelim - Regular expression representing the delimiter string.filter - valid import filter
IOException
public void flush()
throws IOException
flush in interface FlushableIOException
public void close()
throws IOException
close in interface CloseableIOExceptionpublic static boolean isReservedWord(String s)
true if the given string is a reserved word,
false otherwisepublic String toString()
toString in class Objectpublic boolean defaultUseBigIndex()
true if "big index support" has been enabled explicity on
the this Database or via a system property, false otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||