Package totalcross.db.sqlite
Class SQLiteConnection
- java.lang.Object
-
- totalcross.db.sqlite.SQLiteConnection
-
- All Implemented Interfaces:
Connection
public class SQLiteConnection extends java.lang.Object implements Connection
-
-
Field Summary
Fields Modifier and Type Field Description SQLiteConfig.DateClassdateClassSQLiteConfig.DateFormatdateFormatlongdateMultiplierSQLiteConfig.DatePrecisiondatePrecision-
Fields inherited from interface totalcross.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Constructor Description SQLiteConnection(java.lang.String url, java.lang.String fileName)Constructor to create a connection to a database at the given location.SQLiteConnection(java.lang.String url, java.lang.String fileName, Hashtable prop)Constructor to create a pre-configured connection to a database at the given location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearWarnings()voidclose()voidcommit()StatementcreateStatement()StatementcreateStatement(int rsType, int rsConcurr)StatementcreateStatement(int rst, int rsc, int rsh)voidfinalize()booleangetAutoCommit()intgetBusyTimeout()java.lang.StringgetCatalog()intgetHoldability()DatabaseMetaDatagetMetaData()intgetTransactionIsolation()HashtablegetTypeMap()java.sql.SQLWarninggetWarnings()booleanisClosed()booleanisReadOnly()java.lang.StringnativeSQL(java.lang.String sql)PreparedStatementprepareStatement(java.lang.String sql)PreparedStatementprepareStatement(java.lang.String sql, int autoC)PreparedStatementprepareStatement(java.lang.String sql, int[] colInds)PreparedStatementprepareStatement(java.lang.String sql, int rst, int rsc)PreparedStatementprepareStatement(java.lang.String sql, int rst, int rsc, int rsh)PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] colNames)voidrollback()voidsetAutoCommit(boolean ac)voidsetBusyTimeout(int milliseconds)Sets the timeout value for the connection.voidsetCatalog(java.lang.String catalog)voidsetHoldability(int h)voidsetReadOnly(boolean ro)voidsetTransactionIsolation(int level)protected voidsetTransactionMode(SQLiteConfig.TransactionMode mode)Sets the mode that will be used to start transactions on this connection.voidsetTypeMap(Hashtable map)
-
-
-
Field Detail
-
dateClass
public final SQLiteConfig.DateClass dateClass
-
datePrecision
public final SQLiteConfig.DatePrecision datePrecision
-
dateMultiplier
public final long dateMultiplier
-
dateFormat
public final SQLiteConfig.DateFormat dateFormat
-
-
Constructor Detail
-
SQLiteConnection
public SQLiteConnection(java.lang.String url, java.lang.String fileName) throws java.sql.SQLExceptionConstructor to create a connection to a database at the given location.- Parameters:
url- The location of the database.fileName- The database.- Throws:
java.sql.SQLException
-
SQLiteConnection
public SQLiteConnection(java.lang.String url, java.lang.String fileName, Hashtable prop) throws java.sql.SQLExceptionConstructor to create a pre-configured connection to a database at the given location.- Parameters:
url- The location of the database file.fileName- The database.prop- The configurations to apply.- Throws:
java.sql.SQLException
-
-
Method Detail
-
getBusyTimeout
public int getBusyTimeout()
- Returns:
- The busy timeout value for the connection.
- See Also:
- http://www.sqlite.org/c3ref/busy_timeout.html
-
setBusyTimeout
public void setBusyTimeout(int milliseconds) throws java.sql.SQLExceptionSets the timeout value for the connection. A timeout value less than or equal to zero turns off all busy handlers.- Parameters:
milliseconds- The timeout value in milliseconds.- Throws:
java.sql.SQLException- See Also:
- http://www.sqlite.org/c3ref/busy_timeout.html
-
finalize
public void finalize() throws java.sql.SQLException- Overrides:
finalizein classjava.lang.Object- Throws:
java.sql.SQLException- See Also:
Object.finalize()
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.close()
-
isClosed
public boolean isClosed() throws java.sql.SQLException- Specified by:
isClosedin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.isClosed()
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException- Specified by:
getCatalogin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.getCatalog()
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException- Specified by:
setCatalogin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.setCatalog(java.lang.String)
-
getHoldability
public int getHoldability() throws java.sql.SQLException- Throws:
java.sql.SQLException- See Also:
Connection.getHoldability()
-
setHoldability
public void setHoldability(int h) throws java.sql.SQLException- Throws:
java.sql.SQLException- See Also:
Connection.setHoldability(int)
-
getTransactionIsolation
public int getTransactionIsolation()
- Specified by:
getTransactionIsolationin interfaceConnection- See Also:
Connection.getTransactionIsolation()
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLException- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.setTransactionIsolation(int)
-
setTransactionMode
protected void setTransactionMode(SQLiteConfig.TransactionMode mode)
Sets the mode that will be used to start transactions on this connection.- Parameters:
mode- One ofTransactionMode- See Also:
- http://www.sqlite.org/lang_transaction.html
-
getTypeMap
public Hashtable getTypeMap() throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.getTypeMap()
-
setTypeMap
public void setTypeMap(Hashtable map) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.setTypeMap(java.util.Map)
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLException- Specified by:
isReadOnlyin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.isReadOnly()
-
setReadOnly
public void setReadOnly(boolean ro) throws java.sql.SQLException- Specified by:
setReadOnlyin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.setReadOnly(boolean)
-
getMetaData
public DatabaseMetaData getMetaData() throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.getMetaData()
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql)
- Specified by:
nativeSQLin interfaceConnection- See Also:
Connection.nativeSQL(java.lang.String)
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.clearWarnings()
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.getWarnings()
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLException- Specified by:
getAutoCommitin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.getAutoCommit()
-
setAutoCommit
public void setAutoCommit(boolean ac) throws java.sql.SQLException- Specified by:
setAutoCommitin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.setAutoCommit(boolean)
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.commit()
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.rollback()
-
createStatement
public Statement createStatement() throws java.sql.SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.createStatement()
-
createStatement
public Statement createStatement(int rsType, int rsConcurr) throws java.sql.SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.createStatement(int, int)
-
createStatement
public Statement createStatement(int rst, int rsc, int rsh) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.createStatement(int, int, int)
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String)
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql, int autoC) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int)
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql, int[] colInds) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int[])
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] colNames) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, java.lang.String[])
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql, int rst, int rsc) throws java.sql.SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int, int)
-
prepareStatement
public PreparedStatement prepareStatement(java.lang.String sql, int rst, int rsc, int rsh) throws java.sql.SQLException
- Throws:
java.sql.SQLException- See Also:
Connection.prepareStatement(java.lang.String, int, int, int)
-
-