public class SQLiteConfig extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SQLiteConfig.DateClass |
static class |
SQLiteConfig.DatePrecision |
static class |
SQLiteConfig.Encoding |
static class |
SQLiteConfig.HexKeyMode |
static class |
SQLiteConfig.JournalMode |
static class |
SQLiteConfig.LockingMode |
static class |
SQLiteConfig.Pragma |
static class |
SQLiteConfig.SynchronousMode |
static class |
SQLiteConfig.TempStore |
static class |
SQLiteConfig.TransactionMode |
Modifier and Type | Field and Description |
---|---|
int |
busyTimeout |
SQLiteConfig.DateClass |
dateClass |
long |
dateMultiplier |
SQLiteConfig.DatePrecision |
datePrecision |
String |
dateStringFormat |
static String |
DEFAULT_DATE_STRING_FORMAT |
Constructor and Description |
---|
SQLiteConfig()
Default constructor.
|
SQLiteConfig(Properties prop)
Creates an SQLite configuration object using values from the given
property object.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(Connection conn)
Configures a connection.
|
Connection |
createConnection(String url)
Create a new JDBC connection using the current configuration
|
void |
enableCaseSensitiveLike(boolean enable)
Enables or disables case sensitive for the LIKE operator.
|
void |
enableCountChanges(boolean enable)
Deprecated.
Enables or disables the count-changes flag. When enabled, INSERT, UPDATE
and DELETE statements return the number of rows they modified.
|
void |
enableEmptyResultCallBacks(boolean enable)
Deprecated.
Enables or disables the empty_result_callbacks flag.
|
void |
enableFullColumnNames(boolean enable)
Deprecated.
Enables or disables the full_column_name flag. This flag together with
the short_column_names flag determine the way SQLite assigns names to
result columns of SELECT statements.
|
void |
enableFullSync(boolean enable)
Enables or disables the fullfsync flag.
|
void |
enableLoadExtension(boolean enable)
Enables or disables extension loading.
|
void |
enableRecursiveTriggers(boolean enable)
Enables or disables the recursive trigger capability.
|
void |
enableReverseUnorderedSelects(boolean enable)
Enables or disables the reverse_unordered_selects flag.
|
void |
enableShortColumnNames(boolean enable)
Enables or disables the short_column_names flag.
|
void |
enforceForeignKeys(boolean enforce)
Whether to enforce foreign key constraints.
|
int |
getOpenModeFlags() |
SQLiteConfig.TransactionMode |
getTransactionMode() |
void |
incrementalVacuum(int numberOfPagesToBeRemoved)
Sets the incremental_vacuum value; the number of pages to be removed from
the freelist.
|
boolean |
isEnabledLoadExtension()
Checks if the load extension option is turned on.
|
boolean |
isEnabledSharedCache()
Checks if the shared cache option is turned on.
|
void |
resetOpenMode(SQLiteOpenMode mode)
Re-sets the open mode flags.
|
void |
setApplicationId(int id)
Set the value of the application-id.
|
void |
setBusyTimeout(String milliseconds) |
void |
setCacheSize(int numberOfPages)
Changes the maximum number of database disk pages that SQLite will hold
in memory at once per open database file.
|
void |
setDateClass(String dateClass) |
void |
setDatePrecision(String datePrecision) |
void |
setDateStringFormat(String dateStringFormat) |
void |
setDefaultCacheSize(int numberOfPages)
Sets the suggested maximum number of database disk pages that SQLite will
hold in memory at once per open database file.
|
void |
setEncoding(SQLiteConfig.Encoding encoding)
Sets the text encoding used by the main database.
|
void |
setHexKeyMode(SQLiteConfig.HexKeyMode mode)
Changes the setting of the "hexkey" flag.
|
void |
setJounalSizeLimit(int limit)
Sets the journal_size_limit.
|
void |
setJournalMode(SQLiteConfig.JournalMode mode)
Sets the journal mode for databases associated with the current database
connection.
|
void |
setLockingMode(SQLiteConfig.LockingMode mode)
Sets the database connection locking-mode.
|
void |
setMaxPageCount(int numPages)
Sets the maximum number of pages in the database file.
|
void |
setOpenMode(SQLiteOpenMode mode)
Sets the open mode flags.
|
void |
setPageSize(int numBytes)
Sets the page size of the database.
|
void |
setPragma(SQLiteConfig.Pragma pragma,
String value)
Sets a pragma's value.
|
void |
setReadOnly(boolean readOnly)
Sets the read-write mode for the database.
|
void |
setReadUncommited(boolean useReadUncommitedIsolationMode)
Enables or disables useReadUncommitedIsolationMode.
|
void |
setSharedCache(boolean enable)
Enables or disables the sharing of the database cache and schema data
structures between connections to the same database.
|
void |
setSynchronous(SQLiteConfig.SynchronousMode mode)
Changes the setting of the "synchronous" flag.
|
void |
setTempStore(SQLiteConfig.TempStore storeType)
Changes the setting of the "temp_store" parameter.
|
void |
setTempStoreDirectory(String directoryName)
Changes the value of the sqlite3_temp_directory global variable, which many operating-system
interface backends use to determine where to store temporary tables and indices.
|
void |
setTransactionMode(SQLiteConfig.TransactionMode transactionMode)
Sets the mode that will be used to start transactions.
|
void |
setTransactionMode(String transactionMode)
Sets the mode that will be used to start transactions.
|
void |
setUserVersion(int version)
Set the value of the user-version.
|
Properties |
toProperties()
Convert this configuration into a Properties object, which can be
passed to the
DriverManager.getConnection(String, Properties) . |
void |
useLegacyFileFormat(boolean use)
Sets the value of the legacy_file_format flag.
|
public final int busyTimeout
public static final String DEFAULT_DATE_STRING_FORMAT
public SQLiteConfig.DateClass dateClass
public SQLiteConfig.DatePrecision datePrecision
public long dateMultiplier
public String dateStringFormat
public SQLiteConfig()
public SQLiteConfig(Properties prop)
prop
- The properties to apply to the configuration.public Connection createConnection(String url) throws SQLException
SQLException
public void apply(Connection conn) throws SQLException
conn
- The connection to configure.SQLException
public boolean isEnabledSharedCache()
public boolean isEnabledLoadExtension()
public int getOpenModeFlags()
public void setPragma(SQLiteConfig.Pragma pragma, String value)
pragma
- The pragma to change.value
- The value to set it to.public Properties toProperties()
DriverManager.getConnection(String, Properties)
.public void setOpenMode(SQLiteOpenMode mode)
mode
- The open mode.public void resetOpenMode(SQLiteOpenMode mode)
mode
- The open mode.public void setSharedCache(boolean enable)
enable
- True to enable; false to disable.public void enableLoadExtension(boolean enable)
enable
- True to enable; false to disable.public void setReadOnly(boolean readOnly)
readOnly
- True for read-only; otherwise read-write.public void setCacheSize(int numberOfPages)
numberOfPages
- Cache size in number of pages.public void enableCaseSensitiveLike(boolean enable)
enable
- True to enable; false to disable.public void enableCountChanges(boolean enable)
enable
- True to enable; false to disable.public void setDefaultCacheSize(int numberOfPages)
numberOfPages
- Cache size in number of pages.public void enableEmptyResultCallBacks(boolean enable)
enable
- True to enable; false to disable.
false.public void setEncoding(SQLiteConfig.Encoding encoding)
encoding
- One of SQLiteConfig.Encoding
public void enforceForeignKeys(boolean enforce)
enforce
- True to enable; false to disable.public void enableFullColumnNames(boolean enable)
enable
- True to enable; false to disable.public void enableFullSync(boolean enable)
enable
- True to enable; false to disable.public void incrementalVacuum(int numberOfPagesToBeRemoved)
numberOfPagesToBeRemoved
- The number of pages to be removed.public void setJournalMode(SQLiteConfig.JournalMode mode)
mode
- One of SQLiteConfig.JournalMode
public void setJounalSizeLimit(int limit)
limit
- Limit value in bytes. A negative number implies no limit.public void useLegacyFileFormat(boolean use)
use
- True to turn on legacy file format; false to turn off.public void setLockingMode(SQLiteConfig.LockingMode mode)
mode
- One of SQLiteConfig.LockingMode
public void setPageSize(int numBytes)
numBytes
- A power of two between 512 and 65536 inclusive.public void setMaxPageCount(int numPages)
numPages
- Number of pages.public void setReadUncommited(boolean useReadUncommitedIsolationMode)
useReadUncommitedIsolationMode
- True to turn on; false to disable.
disabled otherwise.public void enableRecursiveTriggers(boolean enable)
enable
- True to enable the recursive trigger capability.public void enableReverseUnorderedSelects(boolean enable)
enable
- True to enable reverse_unordered_selects.public void enableShortColumnNames(boolean enable)
enable
- True to enable short_column_names.public void setSynchronous(SQLiteConfig.SynchronousMode mode)
mode
- One of SQLiteConfig.SynchronousMode
:public void setHexKeyMode(SQLiteConfig.HexKeyMode mode)
mode
- One of SQLiteConfig.HexKeyMode
:public void setTempStore(SQLiteConfig.TempStore storeType)
storeType
- One of SQLiteConfig.TempStore
:public void setTempStoreDirectory(String directoryName)
directoryName
- Directory name for storing temporary tables and indices.public void setUserVersion(int version)
version
- A big-endian 32-bit signed integer.public void setApplicationId(int id)
id
- A big-endian 32-bit unsigned integer.public void setTransactionMode(SQLiteConfig.TransactionMode transactionMode)
transactionMode
- One of SQLiteConfig.TransactionMode
.public void setTransactionMode(String transactionMode)
transactionMode
- One of DEFFERED, IMMEDIATE or EXCLUSIVE.public SQLiteConfig.TransactionMode getTransactionMode()
public void setDatePrecision(String datePrecision) throws SQLException
datePrecision
- One of SECONDS or MILLISECONDSSQLException
public void setDateClass(String dateClass)
dateClass
- One of INTEGER, TEXT or REALpublic void setDateStringFormat(String dateStringFormat)
dateStringFormat
- Format of date stringpublic void setBusyTimeout(String milliseconds)
milliseconds
- Connect to DB timeout in millisecondsCopyright © 2018. All rights reserved.