public class SqlJetEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ISqlJetBtree |
btree |
protected ISqlJetDbHandle |
dbHandle |
protected java.io.File |
file |
protected static ISqlJetFileSystemsManager |
FILE_SYSTEM_MANAGER |
protected ISqlJetFileSystem |
fileSystem |
protected boolean |
open |
protected boolean |
writable |
Constructor and Description |
---|
SqlJetEngine(java.io.File file,
boolean writable) |
SqlJetEngine(java.io.File file,
boolean writable,
ISqlJetFileSystem fs) |
SqlJetEngine(java.io.File file,
boolean writable,
java.lang.String fsName) |
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction(SqlJetTransactionMode mode)
Begin transaction.
|
protected void |
checkOpen() |
void |
close()
Close connection to database.
|
protected void |
closeResources() |
void |
commit()
Commits transaction.
|
protected void |
finalize() |
ISqlJetBusyHandler |
getBusyHandler()
Get busy handler.
|
int |
getCacheSize()
Get cache size (in count of pages).
|
java.io.File |
getFile() |
ISqlJetFileSystem |
getFileSystem() |
SqlJetPagerJournalMode |
getJournalMode()
Get jounrnal mode
|
ISqlJetMutex |
getMutex()
Retruns threading synchronization mutex.
|
ISqlJetOptions |
getOptions()
Returns database options.
|
SqlJetSafetyLevel |
getSafetyLevel()
Get safety level
|
protected SqlJetSchema |
getSchemaInternal() |
SqlJetTransactionMode |
getTransactionMode() |
boolean |
isInTransaction()
Returns true if a transaction is active.
|
boolean |
isOpen()
Checks is database open.
|
boolean |
isWritable()
Check write access to data base.
|
void |
open()
Opens connection to database.
|
protected void |
readSchema()
Reads database schema and options.
|
void |
refreshSchema()
Refreshes database schema.
|
void |
registerFileSystem(ISqlJetFileSystem fs,
boolean isDefault) |
void |
rollback()
Rolls back transaction.
|
protected java.lang.Object |
runEngineTransaction(ISqlJetEngineTransaction op,
SqlJetTransactionMode mode)
Runs transaction.
|
java.lang.Object |
runSynchronized(ISqlJetEngineSynchronized op) |
void |
setBusyHandler(ISqlJetBusyHandler busyHandler)
Set busy handler.
|
void |
setCacheSize(int cacheSize)
Set cache size (in count of pages).
|
void |
setJournalMode(SqlJetPagerJournalMode journalMode)
Set journal mode
|
void |
setSafetyLevel(SqlJetSafetyLevel safetyLevel)
Set safety level
|
void |
unregisterFileSystem(ISqlJetFileSystem fs) |
protected static final ISqlJetFileSystemsManager FILE_SYSTEM_MANAGER
protected ISqlJetFileSystem fileSystem
protected boolean writable
protected ISqlJetDbHandle dbHandle
protected ISqlJetBtree btree
protected boolean open
protected java.io.File file
public SqlJetEngine(java.io.File file, boolean writable)
public SqlJetEngine(java.io.File file, boolean writable, ISqlJetFileSystem fs)
file
- writable
- fs
- public SqlJetEngine(java.io.File file, boolean writable, java.lang.String fsName) throws SqlJetException
file
- writable
- fsName
- SqlJetException
public void registerFileSystem(ISqlJetFileSystem fs, boolean isDefault) throws SqlJetException
fs
- isDefault
- SqlJetException
public void unregisterFileSystem(ISqlJetFileSystem fs) throws SqlJetException
fs
- SqlJetException
public java.io.File getFile()
public boolean isWritable() throws SqlJetException
SqlJetException
public ISqlJetFileSystem getFileSystem()
public boolean isOpen()
protected void checkOpen() throws SqlJetException
SqlJetException
public void open() throws SqlJetException
Opens connection to database. It does not create any locking on database. First lock will be created when be called any method which requires real access to options or schema.
SqlJetException
- if any trouble with access to file or database format.public java.lang.Object runSynchronized(ISqlJetEngineSynchronized op) throws SqlJetException
SqlJetException
public void close() throws SqlJetException
SqlJetException
- it is possible to get exception if there is actvie
transaction and rollback did not success.protected void closeResources() throws SqlJetException
SqlJetException
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected void readSchema() throws SqlJetException
SqlJetException
public ISqlJetOptions getOptions() throws SqlJetException
SqlJetException
public void refreshSchema() throws SqlJetException
SqlJetException
protected SqlJetSchema getSchemaInternal() throws SqlJetException
SqlJetException
public ISqlJetBusyHandler getBusyHandler()
public void setBusyHandler(ISqlJetBusyHandler busyHandler)
busyHandler
- the busy handler.public ISqlJetMutex getMutex()
public void setCacheSize(int cacheSize) throws SqlJetException
cacheSize
- the count of pages which can hold cache.SqlJetException
public int getCacheSize() throws SqlJetException
SqlJetException
public void setSafetyLevel(SqlJetSafetyLevel safetyLevel) throws SqlJetException
safetyLevel
- SqlJetException
public void setJournalMode(SqlJetPagerJournalMode journalMode) throws SqlJetException
journalMode
- SqlJetException
public SqlJetSafetyLevel getSafetyLevel() throws SqlJetException
SqlJetException
public SqlJetPagerJournalMode getJournalMode() throws SqlJetException
SqlJetException
public boolean isInTransaction()
public SqlJetTransactionMode getTransactionMode()
public void beginTransaction(SqlJetTransactionMode mode) throws SqlJetException
mode
- transaction's mode.SqlJetException
public void commit() throws SqlJetException
SqlJetException
public void rollback() throws SqlJetException
SqlJetException
protected java.lang.Object runEngineTransaction(ISqlJetEngineTransaction op, SqlJetTransactionMode mode) throws SqlJetException
op
- transaction's body (closure).mode
- transaction's mode.ISqlJetTransaction.run(org.tmatesoft.sqljet.core.table.SqlJetDb)
call.SqlJetException
Copyright © 2009-2010 TMate Software Ltd. All Rights Reserved.