com.j256.ormlite.jdbc
Class JdbcDatabaseConnection
java.lang.Object
com.j256.ormlite.jdbc.JdbcDatabaseConnection
- All Implemented Interfaces:
- com.j256.ormlite.support.DatabaseConnection
public class JdbcDatabaseConnection
- extends Object
- implements com.j256.ormlite.support.DatabaseConnection
Wrapper around a JDBC Connection
object which we delegate to.
- Author:
- graywatson
Fields inherited from interface com.j256.ormlite.support.DatabaseConnection |
DEFAULT_RESULT_FLAGS, MORE_THAN_ONE |
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)
|
com.j256.ormlite.support.CompiledStatement |
compileStatement(String statement,
com.j256.ormlite.stmt.StatementBuilder.StatementType type,
com.j256.ormlite.field.FieldType[] argFieldTypes,
int resultFlags)
|
int |
delete(String statement,
Object[] args,
com.j256.ormlite.field.FieldType[] argFieldTypes)
|
boolean |
getAutoCommit()
|
Connection |
getInternalConnection()
Return the internal database connection. |
int |
insert(String statement,
Object[] args,
com.j256.ormlite.field.FieldType[] argFieldTypes,
com.j256.ormlite.support.GeneratedKeyHolder keyHolder)
|
boolean |
isAutoCommitSupported()
|
boolean |
isClosed()
Returns whether the connection has already been closed. |
boolean |
isTableExists(String tableName)
|
long |
queryForLong(String statement)
|
long |
queryForLong(String statement,
Object[] args,
com.j256.ormlite.field.FieldType[] argFieldTypes)
|
|
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)
|
void |
setInternalConnection(Connection connection)
Set the internal database connection. |
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 |
JdbcDatabaseConnection
public JdbcDatabaseConnection(Connection connection)
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)
throws SQLException
- Specified by:
setAutoCommit
in interface com.j256.ormlite.support.DatabaseConnection
- Throws:
SQLException
setSavePoint
public Savepoint setSavePoint(String name)
throws SQLException
- Specified by:
setSavePoint
in interface com.j256.ormlite.support.DatabaseConnection
- Throws:
SQLException
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)
throws SQLException
- Specified by:
compileStatement
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,
int resultFlags)
throws SQLException
- Specified by:
compileStatement
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
- Returns whether the connection has already been closed. Used by
JdbcConnectionSource
.
- Specified by:
isClosed
in interface com.j256.ormlite.support.DatabaseConnection
- Throws:
SQLException
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,
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
queryForLong
public long queryForLong(String statement,
Object[] args,
com.j256.ormlite.field.FieldType[] argFieldTypes)
throws SQLException
- Specified by:
queryForLong
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
getInternalConnection
public Connection getInternalConnection()
- Return the internal database connection. Most likely for testing purposes.
setInternalConnection
public void setInternalConnection(Connection connection)
- Set the internal database connection. Most likely for testing purposes.
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.