com.j256.ormlite.android
Class AndroidDatabaseConnection

java.lang.Object
  extended by com.j256.ormlite.android.AndroidDatabaseConnection
All Implemented Interfaces:
com.j256.ormlite.support.DatabaseConnection

public class AndroidDatabaseConnection
extends Object
implements com.j256.ormlite.support.DatabaseConnection

Database connection for Android.

Author:
kevingalligan, graywatson

Field Summary
 
Fields inherited from interface com.j256.ormlite.support.DatabaseConnection
MORE_THAN_ONE
 
Constructor Summary
AndroidDatabaseConnection(android.database.sqlite.SQLiteDatabase db, boolean readWrite)
           
 
Method Summary
 void close()
           
 void commit(Savepoint savepoint)
           
 com.j256.ormlite.support.CompiledStatement compileStatement(String statement, com.j256.ormlite.stmt.StatementBuilder.StatementType type, com.j256.ormlite.field.FieldType[] argFieldTypes)
           
 int delete(String statement, Object[] args, com.j256.ormlite.field.FieldType[] argFieldTypes)
           
 boolean getAutoCommit()
           
 int insert(String statement, Object[] args, com.j256.ormlite.field.FieldType[] argFieldTypes, com.j256.ormlite.support.GeneratedKeyHolder keyHolder)
           
 boolean isAutoCommitSupported()
           
 boolean isClosed()
           
 boolean isReadWrite()
          Return whether this connection is read-write or not (real-only).
 boolean isTableExists(String tableName)
           
 long queryForLong(String statement)
           
<T> Object
queryForOne(String statement, Object[] args, com.j256.ormlite.field.FieldType[] argFieldTypes, com.j256.ormlite.stmt.GenericRowMapper<T> rowMapper)
           
<T> Object
queryForOne(String statement, Object[] args, com.j256.ormlite.field.FieldType[] argFieldTypes, com.j256.ormlite.stmt.GenericRowMapper<T> rowMapper, com.j256.ormlite.dao.ObjectCache objectCache)
           
 void rollback(Savepoint savepoint)
           
 void setAutoCommit(boolean autoCommit)
           
 Savepoint setSavePoint(String name)
           
 int update(String statement, Object[] args, com.j256.ormlite.field.FieldType[] argFieldTypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidDatabaseConnection

public AndroidDatabaseConnection(android.database.sqlite.SQLiteDatabase db,
                                 boolean readWrite)
Method Detail

isAutoCommitSupported

public boolean isAutoCommitSupported()
Specified by:
isAutoCommitSupported in interface com.j256.ormlite.support.DatabaseConnection

getAutoCommit

public boolean getAutoCommit()
                      throws SQLException
Specified by:
getAutoCommit in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
Specified by:
setAutoCommit in interface com.j256.ormlite.support.DatabaseConnection

setSavePoint

public Savepoint setSavePoint(String name)
                       throws SQLException
Specified by:
setSavePoint in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

isReadWrite

public boolean isReadWrite()
Return whether this connection is read-write or not (real-only).


commit

public void commit(Savepoint savepoint)
            throws SQLException
Specified by:
commit in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

rollback

public void rollback(Savepoint savepoint)
              throws SQLException
Specified by:
rollback in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

compileStatement

public com.j256.ormlite.support.CompiledStatement compileStatement(String statement,
                                                                   com.j256.ormlite.stmt.StatementBuilder.StatementType type,
                                                                   com.j256.ormlite.field.FieldType[] argFieldTypes)
Specified by:
compileStatement in interface com.j256.ormlite.support.DatabaseConnection

insert

public int insert(String statement,
                  Object[] args,
                  com.j256.ormlite.field.FieldType[] argFieldTypes,
                  com.j256.ormlite.support.GeneratedKeyHolder keyHolder)
           throws SQLException
Specified by:
insert in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

update

public int update(String statement,
                  Object[] args,
                  com.j256.ormlite.field.FieldType[] argFieldTypes)
           throws SQLException
Specified by:
update in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

delete

public int delete(String statement,
                  Object[] args,
                  com.j256.ormlite.field.FieldType[] argFieldTypes)
           throws SQLException
Specified by:
delete in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

queryForOne

public <T> Object queryForOne(String statement,
                              Object[] args,
                              com.j256.ormlite.field.FieldType[] argFieldTypes,
                              com.j256.ormlite.stmt.GenericRowMapper<T> rowMapper)
                   throws SQLException
Specified by:
queryForOne in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

queryForOne

public <T> Object queryForOne(String statement,
                              Object[] args,
                              com.j256.ormlite.field.FieldType[] argFieldTypes,
                              com.j256.ormlite.stmt.GenericRowMapper<T> rowMapper,
                              com.j256.ormlite.dao.ObjectCache objectCache)
                   throws SQLException
Specified by:
queryForOne in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

queryForLong

public long queryForLong(String statement)
                  throws SQLException
Specified by:
queryForLong in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

close

public void close()
           throws SQLException
Specified by:
close in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
Specified by:
isClosed in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException

isTableExists

public boolean isTableExists(String tableName)
                      throws SQLException
Specified by:
isTableExists in interface com.j256.ormlite.support.DatabaseConnection
Throws:
SQLException


This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.