public class SqlJetDb extends SqlJetEngine
Connection to database. This class currently is main entry point in SQLJet API.
It allows to perform next tasks:
| Modifier and Type | Field and Description |
|---|---|
static java.io.File |
IN_MEMORY
File name for in memory database.
|
btree, dbHandle, file, FILE_SYSTEM_MANAGER, fileSystem, open, writable| Constructor and Description |
|---|
SqlJetDb(java.io.File file,
boolean writable)
Creates connection to database but not open it.
|
SqlJetDb(java.io.File file,
boolean writable,
ISqlJetFileSystem fs) |
SqlJetDb(java.io.File file,
boolean writable,
java.lang.String fsName) |
| Modifier and Type | Method and Description |
|---|---|
ISqlJetTableDef |
alterTable(java.lang.String sql)
Alters table.
|
protected void |
closeResources() |
ISqlJetIndexDef |
createIndex(java.lang.String sql)
Create index from SQL clause.
|
ISqlJetTableDef |
createTable(java.lang.String sql)
Create table from SQL clause.
|
ISqlJetTriggerDef |
createTrigger(java.lang.String sql)
Creates trigger from SQL clause.
|
ISqlJetViewDef |
createView(java.lang.String sql)
Creates view from SQL clause.
|
ISqlJetVirtualTableDef |
createVirtualTable(java.lang.String sql)
Creates virtual table from SQL clause.
|
void |
dropIndex(java.lang.String indexName)
Drop index.
|
void |
dropTable(java.lang.String tableName)
Drop table.
|
void |
dropTrigger(java.lang.String triggerName)
Drop trigger.
|
void |
dropView(java.lang.String viewName)
Drop view.
|
ISqlJetSchema |
getSchema()
Get database schema.
|
ISqlJetTable |
getTable(java.lang.String tableName)
Open table.
|
SqlJetDb |
getTemporaryDatabase() |
SqlJetDb |
getTemporaryDatabase(boolean inMemory)
Opens temporary on-disk database which life span is less or equal to that
of this object.
|
static SqlJetDb |
open(java.io.File file,
boolean write)
Opens connection to data base.
|
static SqlJetDb |
open(java.io.File file,
boolean write,
ISqlJetFileSystem fs) |
static SqlJetDb |
open(java.io.File file,
boolean write,
java.lang.String fsName) |
java.lang.Object |
pragma(java.lang.String sql)
Executes pragma statement.
|
java.lang.Object |
runReadTransaction(ISqlJetTransaction op)
Run read-only transaction.
|
java.lang.Object |
runTransaction(ISqlJetTransaction op,
SqlJetTransactionMode mode)
Run transaction.
|
java.lang.Object |
runWithLock(ISqlJetRunnableWithLock op)
Do some actions with locking database's internal threads synchronization
mutex.
|
java.lang.Object |
runWriteTransaction(ISqlJetTransaction op)
Run modifications in write transaction.
|
beginTransaction, checkOpen, close, commit, finalize, getBusyHandler, getCacheSize, getFile, getFileSystem, getJournalMode, getMutex, getOptions, getSafetyLevel, getSchemaInternal, getTransactionMode, isInTransaction, isOpen, isWritable, open, readSchema, refreshSchema, registerFileSystem, rollback, runEngineTransaction, runSynchronized, setBusyHandler, setCacheSize, setJournalMode, setSafetyLevel, unregisterFileSystempublic SqlJetDb(java.io.File file,
boolean writable)
Creates connection to database but not open it. Doesn't open database
file until not called method SqlJetEngine.open().
File could be null or have special value IN_MEMORY. If file is
null then will be created temporary file which will be deleted at close.
If file is IN_MEMORY then file doesn't created and instead
database will placed in memory. If regular file is specified but doesn't
exist then it will be tried to created.
file - path to data base. Could be null or IN_MEMORY.writable - if true then will allow data modification.public SqlJetDb(java.io.File file,
boolean writable,
ISqlJetFileSystem fs)
public SqlJetDb(java.io.File file,
boolean writable,
java.lang.String fsName)
throws SqlJetException
SqlJetExceptionpublic static SqlJetDb open(java.io.File file, boolean write) throws SqlJetException
Opens connection to data base. 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.
File could be null or have special value IN_MEMORY. If file is
null then will be created temporary file which will be deleted at close.
If file is IN_MEMORY then file doesn't created and instead
database will placed in memory. If regular file is specified but doesn't
exist then it will be tried to created.
file - path to data base. Could be null or IN_MEMORY.write - open for writing if true.SqlJetException - if any trouble with access to file or database format.public static SqlJetDb open(java.io.File file, boolean write, ISqlJetFileSystem fs) throws SqlJetException
file - write - fs - SqlJetExceptionpublic static SqlJetDb open(java.io.File file, boolean write, java.lang.String fsName) throws SqlJetException
file - write - fsName - SqlJetExceptionpublic java.lang.Object runWithLock(ISqlJetRunnableWithLock op) throws SqlJetException
op - operation to runISqlJetRunnableWithLock.runWithLock(SqlJetDb) call.SqlJetException - in case operation fails to run.public ISqlJetSchema getSchema() throws SqlJetException
SqlJetExceptionpublic ISqlJetTable getTable(java.lang.String tableName) throws SqlJetException
tableName - name of the table to open.SqlJetExceptionpublic java.lang.Object runWriteTransaction(ISqlJetTransaction op) throws SqlJetException
op - transaction to run.ISqlJetTransaction.run(SqlJetDb) call.SqlJetExceptionpublic java.lang.Object runReadTransaction(ISqlJetTransaction op) throws SqlJetException
op - transaction to run.ISqlJetTransaction.run(SqlJetDb) call.SqlJetExceptionpublic java.lang.Object runTransaction(ISqlJetTransaction op, SqlJetTransactionMode mode) throws SqlJetException
op - transaction's body (closure).mode - transaction's mode.ISqlJetTransaction.run(SqlJetDb) call.SqlJetExceptionpublic java.lang.Object pragma(java.lang.String sql)
throws SqlJetException
SqlJetExceptionpublic ISqlJetTableDef createTable(java.lang.String sql) throws SqlJetException
sql - CREATE TABLE ... sentence.SqlJetExceptionpublic ISqlJetIndexDef createIndex(java.lang.String sql) throws SqlJetException
sql - CREATE INDEX ... sentence.SqlJetExceptionpublic void dropTable(java.lang.String tableName)
throws SqlJetException
tableName - name of table to drop.SqlJetExceptionpublic void dropIndex(java.lang.String indexName)
throws SqlJetException
indexName - name of the index to drop.SqlJetExceptionpublic void dropView(java.lang.String viewName)
throws SqlJetException
viewName - name of the view to drop.SqlJetExceptionpublic void dropTrigger(java.lang.String triggerName)
throws SqlJetException
triggerName - name of the trigger to drop.SqlJetExceptionpublic ISqlJetTableDef alterTable(java.lang.String sql) throws SqlJetException
sql - ALTER TABLE ... sentence.SqlJetExceptionpublic ISqlJetVirtualTableDef createVirtualTable(java.lang.String sql) throws SqlJetException
sql - CREATE VIRTUAL TABLE ... sentence.SqlJetExceptionpublic ISqlJetViewDef createView(java.lang.String sql) throws SqlJetException
sql - CREATE VIEW X AS SELECT ... sentence.SqlJetExceptionpublic ISqlJetTriggerDef createTrigger(java.lang.String sql) throws SqlJetException
sql - CREATE TRIGGER ... sentence.SqlJetExceptionpublic SqlJetDb getTemporaryDatabase() throws SqlJetException
SqlJetExceptiongetTemporaryDatabase(boolean)public SqlJetDb getTemporaryDatabase(boolean inMemory) throws SqlJetException
inMemory - when true open temporary database in memory.SqlJetExceptionprotected void closeResources()
throws SqlJetException
closeResources in class SqlJetEngineSqlJetExceptionCopyright © 2009-2010 TMate Software Ltd. All Rights Reserved.