public class SQLiteConfig
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SQLiteConfig.DateClass |
static class |
SQLiteConfig.DateFormat |
static class |
SQLiteConfig.DatePrecision |
static class |
SQLiteConfig.Encoding |
static class |
SQLiteConfig.JournalMode |
static class |
SQLiteConfig.LockingMode |
static class |
SQLiteConfig.SynchronousMode |
static class |
SQLiteConfig.TempStore |
static class |
SQLiteConfig.TransactionMode |
Modifier and Type | Field and Description |
---|---|
protected int |
busyTimeout |
protected SQLiteConfig.DateClass |
dateClass |
protected long |
dateMultiplier |
protected SQLiteConfig.DatePrecision |
datePrecision |
protected java.lang.String |
dateStringFormat |
static java.lang.String |
DEFAULT_DATE_STRING_FORMAT |
Constructor and Description |
---|
SQLiteConfig()
Default constructor.
|
SQLiteConfig(Hashtable 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(java.lang.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)
Enables or disables the count-changes flag.
|
void |
enableEmptyResultCallBacks(boolean enable)
Enables or disables the empty_result_callbacks flag.
|
void |
enableFullColumnNames(boolean enable)
Enables or disables the full_column_name flag.
|
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 |
setBusyTimeout(java.lang.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(java.lang.String dateClass) |
void |
setDatePrecision(java.lang.String datePrecision) |
void |
setDateStringFormat(java.lang.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 |
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(totalcross.db.sqlite.SQLiteConfig.Pragma pragma,
java.lang.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(java.lang.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(java.lang.String transactionMode)
Sets the mode that will be used to start transactions.
|
void |
setUserVersion(int version)
Set the value of the user-version.
|
Hashtable |
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.
|
protected int busyTimeout
public static final java.lang.String DEFAULT_DATE_STRING_FORMAT
protected final SQLiteConfig.DateClass dateClass
protected final SQLiteConfig.DatePrecision datePrecision
protected final long dateMultiplier
protected final java.lang.String dateStringFormat
public SQLiteConfig()
public SQLiteConfig(Hashtable prop)
prop
- The properties to apply to the configuration.public Connection createConnection(java.lang.String url) throws java.sql.SQLException
java.sql.SQLException
public void apply(Connection conn) throws java.sql.SQLException
conn
- The connection to configure.java.sql.SQLException
public boolean isEnabledSharedCache()
public boolean isEnabledLoadExtension()
public int getOpenModeFlags()
public void setPragma(totalcross.db.sqlite.SQLiteConfig.Pragma pragma, java.lang.String value)
pragma
- The pragma to change.value
- The value to set it to.public Hashtable 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 setTempStore(SQLiteConfig.TempStore storeType)
storeType
- One of SQLiteConfig.TempStore
:public void setTempStoreDirectory(java.lang.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 setTransactionMode(SQLiteConfig.TransactionMode transactionMode)
transactionMode
- One of SQLiteConfig.TransactionMode
.public void setTransactionMode(java.lang.String transactionMode)
transactionMode
- One of DEFFERED, IMMEDIATE or EXCLUSIVE.public SQLiteConfig.TransactionMode getTransactionMode()
public void setDatePrecision(java.lang.String datePrecision) throws java.sql.SQLException
datePrecision
- One of SECONDS or MILLISECONDSjava.sql.SQLException
public void setDateClass(java.lang.String dateClass)
dateClass
- One of INTEGER, TEXT or REALpublic void setDateStringFormat(java.lang.String dateStringFormat)
dateStringFormat
- Format of date stringpublic void setBusyTimeout(java.lang.String milliseconds)
milliseconds
- Connect to DB timeout in milliseconds