public abstract class SQLiteConnection extends Object implements Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
Constructor and Description |
---|
SQLiteConnection(DB db)
Connection constructor for reusing an existing DB handle
|
SQLiteConnection(String url,
String fileName)
Constructor to create a connection to a database at the given location.
|
SQLiteConnection(String url,
String fileName,
Properties prop)
Constructor to create a pre-configured connection to a database at the given location.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(Executor executor) |
void |
addCommitListener(SQLiteCommitListener listener)
Add a listener for DB commit/rollback events, see
https://www.sqlite.org/c3ref/commit_hook.html
|
void |
addUpdateListener(SQLiteUpdateListener listener)
Add a listener for DB update events, see https://www.sqlite.org/c3ref/update_hook.html
|
protected void |
checkCursor(int rst,
int rsc,
int rsh)
Checks whether the type, concurrency, and holdability settings for a
ResultSet are
supported by the SQLite interface. |
protected void |
checkOpen()
Whether an SQLite library interface to the database has been established.
|
void |
close() |
void |
commit() |
protected static String |
extractPragmasFromFilename(String url,
String filename,
Properties prop)
Extracts PRAGMA values from the filename and sets them into the Properties object which will
be used to build the SQLConfig.
|
boolean |
getAutoCommit() |
int |
getBusyTimeout() |
SQLiteConnectionConfig |
getConnectionConfig() |
SQLiteConfig.TransactionMode |
getCurrentTransactionMode() |
DB |
getDatabase() |
void |
getLimit(SQLiteLimits limit) |
DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
String |
getSchema() |
CoreDatabaseMetaData |
getSQLiteDatabaseMetaData() |
int |
getTransactionIsolation() |
String |
getUrl() |
boolean |
isClosed() |
boolean |
isFirstStatementExecuted() |
String |
libversion() |
void |
removeCommitListener(SQLiteCommitListener listener)
Remove a listener registered for DB commit/rollback events.
|
void |
removeUpdateListener(SQLiteUpdateListener listener)
Remove a listener registered for DB update events.
|
void |
rollback() |
void |
setAutoCommit(boolean ac) |
void |
setBusyTimeout(int timeoutMillis)
Sets the timeout value for the connection.
|
void |
setCurrentTransactionMode(SQLiteConfig.TransactionMode currentTransactionMode) |
void |
setFirstStatementExecuted(boolean firstStatementExecuted) |
void |
setLimit(SQLiteLimits limit,
int value) |
void |
setNetworkTimeout(Executor executor,
int milliseconds) |
void |
setSchema(String schema) |
void |
setTransactionIsolation(int level) |
protected void |
setTransactionMode(SQLiteConfig.TransactionMode mode)
Sets the mode that will be used to start transactions on this connection.
|
protected String |
transactionPrefix() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearWarnings, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getCatalog, getClientInfo, getClientInfo, getHoldability, getTypeMap, getWarnings, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, setCatalog, setClientInfo, setClientInfo, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTypeMap
isWrapperFor, unwrap
public SQLiteConnection(DB db)
db
- public SQLiteConnection(String url, String fileName) throws SQLException
url
- The location of the database.fileName
- The database.SQLException
public SQLiteConnection(String url, String fileName, Properties prop) throws SQLException
url
- The location of the database file.fileName
- The database.prop
- The configurations to apply.SQLException
public SQLiteConfig.TransactionMode getCurrentTransactionMode()
public void setCurrentTransactionMode(SQLiteConfig.TransactionMode currentTransactionMode)
public void setFirstStatementExecuted(boolean firstStatementExecuted)
public boolean isFirstStatementExecuted()
public SQLiteConnectionConfig getConnectionConfig()
public CoreDatabaseMetaData getSQLiteDatabaseMetaData() throws SQLException
SQLException
public DatabaseMetaData getMetaData() throws SQLException
getMetaData
in interface Connection
SQLException
public String getUrl()
public void setSchema(String schema) throws SQLException
setSchema
in interface Connection
SQLException
public String getSchema() throws SQLException
getSchema
in interface Connection
SQLException
public void abort(Executor executor) throws SQLException
abort
in interface Connection
SQLException
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
setNetworkTimeout
in interface Connection
SQLException
public int getNetworkTimeout() throws SQLException
getNetworkTimeout
in interface Connection
SQLException
protected void checkCursor(int rst, int rsc, int rsh) throws SQLException
ResultSet
are
supported by the SQLite interface. Supported settings are:
ResultSet.TYPE_FORWARD_ONLY
ResultSet.CONCUR_READ_ONLY
)
ResultSet.CLOSE_CURSORS_AT_COMMIT
rst
- the type setting.rsc
- the concurrency setting.rsh
- the holdability setting.SQLException
protected void setTransactionMode(SQLiteConfig.TransactionMode mode)
mode
- One of SQLiteConfig.TransactionMode
public int getTransactionIsolation()
getTransactionIsolation
in interface Connection
Connection.getTransactionIsolation()
public void setTransactionIsolation(int level) throws SQLException
setTransactionIsolation
in interface Connection
SQLException
Connection.setTransactionIsolation(int)
public DB getDatabase()
public boolean getAutoCommit() throws SQLException
getAutoCommit
in interface Connection
SQLException
Connection.getAutoCommit()
public void setAutoCommit(boolean ac) throws SQLException
setAutoCommit
in interface Connection
SQLException
Connection.setAutoCommit(boolean)
public int getBusyTimeout()
public void setBusyTimeout(int timeoutMillis) throws SQLException
timeoutMillis
- The timeout value in milliseconds.SQLException
public void setLimit(SQLiteLimits limit, int value) throws SQLException
SQLException
public void getLimit(SQLiteLimits limit) throws SQLException
SQLException
public boolean isClosed() throws SQLException
isClosed
in interface Connection
SQLException
public void close() throws SQLException
close
in interface AutoCloseable
close
in interface Connection
SQLException
Connection.close()
protected void checkOpen() throws SQLException
SQLException
public String libversion() throws SQLException
SQLException
public void commit() throws SQLException
commit
in interface Connection
SQLException
Connection.commit()
public void rollback() throws SQLException
rollback
in interface Connection
SQLException
Connection.rollback()
public void addUpdateListener(SQLiteUpdateListener listener)
listener
- The listener to receive update eventspublic void removeUpdateListener(SQLiteUpdateListener listener)
listener
- The listener to no longer receive update eventspublic void addCommitListener(SQLiteCommitListener listener)
listener
- The listener to receive commit eventspublic void removeCommitListener(SQLiteCommitListener listener)
listener
- The listener to no longer receive commit/rollback events.protected static String extractPragmasFromFilename(String url, String filename, Properties prop) throws SQLException
filename
- prop
- SQLException
protected String transactionPrefix()
Copyright © 2022. All rights reserved.