|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.almworks.sqlite4java.SQLite
public final class SQLite
SQLite class has several utility methods that are applicable to the whole instance of SQLite library within the current process. It is not needed for basic operations.
All methods in this class are thread-safe.
Field Summary | |
---|---|
static java.lang.String |
LIBRARY_PATH_PROPERTY
System property that, if set, defines where to look for native sqlite4java libraries. |
Method Summary | |
---|---|
static java.lang.String |
getLibraryVersion()
Gets the version of sqlite4java library. |
static long |
getMemoryHighwater(boolean reset)
Returns the maximum amount of memory that was used by SQLite since the last time the highwater was reset. |
static long |
getMemoryUsed()
Gets the amount of memory currently used by SQLite library. |
static java.lang.String |
getSQLiteCompileOptions()
Gets the compile-time options used to compile the used library. |
static java.lang.String |
getSQLiteVersion()
Gets the version of SQLite database. |
static int |
getSQLiteVersionNumber()
Gets the numeric representation of the SQLite version. |
static boolean |
isComplete(java.lang.String sql)
Checks if the given SQL is complete. |
static boolean |
isDebugBinaryPreferred()
Used to check whether DEBUG binary is preferred over RELEASE binary when SQLite native code is loaded. |
static boolean |
isThreadSafe()
Checks if SQLite has been compiled with the THREADSAFE option. |
static void |
loadLibrary()
Tries to load the native library. |
static void |
main(java.lang.String[] args)
Main method is called when you run java -jar sqlite4java.jar , and it prints out
the version of the library, the version of the SQLite and the compile-time options the binaries were
built with |
static int |
releaseMemory(int bytes)
Requests SQLite to try to release some memory from its heap. |
static void |
setDebugBinaryPreferred(boolean debug)
Native sqlite4java code, including SQLite itself, is compiled in DEBUG and RELEASE
configurations. |
static void |
setLibraryPath(java.lang.String path)
Sets the path where sqlite4java should look for the native library, by modifying sqlite4java.library.path system property. |
static void |
setSharedCache(boolean enabled)
Sets whether shared cache mode will be used for the connections that are opened after this call. |
static void |
setSoftHeapLimit(int limit)
Sets the "soft limit" on the amount of memory allocated before SQLite starts trying to free some memory before allocating more memory. |
static long |
softHeapLimit(long limit)
Sets the "soft limit" on the amount of memory allocated before SQLite starts trying to free some memory before allocating more memory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LIBRARY_PATH_PROPERTY
Method Detail |
---|
public static void setDebugBinaryPreferred(boolean debug)
DEBUG
and RELEASE
configurations. Binaries compiled with debug configurations have -d
suffix, and can be placed in
the same directory with release binaries.
sqlite4java will load any available binary that suits the platform, but in case both RELEASE and DEBUG
binaries are available, it will load RELEASE binary by default.
You can use this method to change the preference and load DEBUG binary by default.
This method must be called before the first call to SQLiteConnection.open(boolean)
or any other methods that
require library loading.
You can also change the default by setting sqlite4java.debug.binary.preferred system property to
true.
debug
- if true, choose DEBUG binary in case both DEBUG and RELEASE binaries are availablepublic static boolean isDebugBinaryPreferred()
setDebugBinaryPreferred(boolean)
public static void loadLibrary() throws SQLiteException
SQLiteException
- if library loading failspublic static java.lang.String getSQLiteVersion() throws SQLiteException
SQLiteException
- if native library cannot be loadedpublic static java.lang.String getSQLiteCompileOptions() throws SQLiteException
SQLiteException
- if native library cannot be loadedpublic static int getSQLiteVersionNumber() throws SQLiteException
SQLiteException
- if native library cannot be loadedpublic static boolean isThreadSafe() throws SQLiteException
SQLiteException
- if native library cannot be loadedpublic static boolean isComplete(java.lang.String sql) throws SQLiteException
sql
- the SQL
SQLiteException
- if native library cannot be loadedpublic static long getMemoryUsed() throws SQLiteException
SQLiteException
- if native library cannot be loadedpublic static long getMemoryHighwater(boolean reset) throws SQLiteException
reset
- if true, the highwatermark is reset after this call
SQLiteException
- if native library cannot be loadedpublic static int releaseMemory(int bytes) throws SQLiteException
bytes
- the number of bytes requested to be released
SQLiteException
- if native library cannot be loadedpublic static void setSoftHeapLimit(int limit) throws SQLiteException
limit
- the number of bytes to set the soft memory limit to
SQLiteException
- if native library cannot be loadedpublic static long softHeapLimit(long limit) throws SQLiteException
limit
- the number of bytes to set the soft memory limit to
SQLiteException
- if native library cannot be loadedpublic static void setSharedCache(boolean enabled) throws SQLiteException
enabled
- if true, the following calls to SQLiteConnection.open(boolean)
will used shared-cache mode
SQLiteException
- if native library cannot be loaded, or if call returns an errorpublic static java.lang.String getLibraryVersion()
public static void setLibraryPath(java.lang.String path)
System.loadLibrary(java.lang.String)
method, which uses java.library.path system
property.
Use this method (or explicitly set sqlite4java.library.path) system property when the native library
is located in the non-default location, and changing java.library.path may not have the desired effect.
When sqlite4java.library.path property is set, the library will be loaded only from that directory.
Default directories will not be tried.
Calling this method when native library has been already loaded has no effect.
This method is thread-safe.
path
- local directory that sqlite4java should use to load native libraries from, or null to disable the settingpublic static void main(java.lang.String[] args)
java -jar sqlite4java.jar
, and it prints out
the version of the library, the version of the SQLite and the compile-time options the binaries were
built with
args
- command line
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |