|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DatabaseConnection
A reduction of the SQL Connection so we can implement its functionality outside of JDBC.
Field Summary | |
---|---|
static int |
DEFAULT_RESULT_FLAGS
|
static Object |
MORE_THAN_ONE
returned by queryForOne(java.lang.String, java.lang.Object[], com.j256.ormlite.field.FieldType[], com.j256.ormlite.stmt.GenericRowMapper if more than one result was found by the query |
Method Summary | ||
---|---|---|
void |
close()
Close the connection to the database. |
|
void |
commit(Savepoint savePoint)
Commit all changes since the savepoint was created. |
|
CompiledStatement |
compileStatement(String statement,
StatementBuilder.StatementType type,
FieldType[] argFieldTypes)
Compile and prepare the SQL statement for execution. |
|
CompiledStatement |
compileStatement(String statement,
StatementBuilder.StatementType type,
FieldType[] argFieldTypes,
int resultFlags)
Like compileStatement(String, StatementType, FieldType[]) except the caller can specify the result flags. |
|
int |
delete(String statement,
Object[] args,
FieldType[] argfieldTypes)
Perform a SQL delete with the associated SQL statement, arguments, and types. |
|
int |
insert(String statement,
Object[] args,
FieldType[] argfieldTypes,
GeneratedKeyHolder keyHolder)
Perform a SQL update while with the associated SQL statement, arguments, and types. |
|
boolean |
isAutoCommit()
Return if auto-commit is currently enabled. |
|
boolean |
isAutoCommitSupported()
Return if auto-commit is supported. |
|
boolean |
isClosed()
Return if the connection has been closed either through a call to close() or because of a fatal error. |
|
boolean |
isTableExists(String tableName)
Return true if the table exists in the database. |
|
long |
queryForLong(String statement)
Perform a query whose result should be a single long-integer value. |
|
long |
queryForLong(String statement,
Object[] args,
FieldType[] argFieldTypes)
Perform a query whose result should be a single long-integer value. |
|
|
queryForOne(String statement,
Object[] args,
FieldType[] argfieldTypes,
GenericRowMapper<T> rowMapper,
ObjectCache objectCache)
Perform a SQL query with the associated SQL statement, arguments, and types and returns a single result. |
|
void |
rollback(Savepoint savePoint)
Roll back all changes since the savepoint was created. |
|
void |
setAutoCommit(boolean autoCommit)
Set the auto-commit to be on (true) or off (false). |
|
Savepoint |
setSavePoint(String name)
Start a save point with a certain name. |
|
int |
update(String statement,
Object[] args,
FieldType[] argfieldTypes)
Perform a SQL update with the associated SQL statement, arguments, and types. |
Field Detail |
---|
static final Object MORE_THAN_ONE
queryForOne(java.lang.String, java.lang.Object[], com.j256.ormlite.field.FieldType[], com.j256.ormlite.stmt.GenericRowMapper, com.j256.ormlite.dao.ObjectCache)
if more than one result was found by the query
static final int DEFAULT_RESULT_FLAGS
Method Detail |
---|
boolean isAutoCommitSupported() throws SQLException
SQLException
boolean isAutoCommit() throws SQLException
SQLException
void setAutoCommit(boolean autoCommit) throws SQLException
SQLException
Savepoint setSavePoint(String name) throws SQLException
name
- to use for the Savepoint although it can be ignored.
SQLException
void commit(Savepoint savePoint) throws SQLException
savePoint
- That was returned by setSavePoint or null if none.
SQLException
void rollback(Savepoint savePoint) throws SQLException
savePoint
- That was returned by setSavePoint previously or null if none.
SQLException
CompiledStatement compileStatement(String statement, StatementBuilder.StatementType type, FieldType[] argFieldTypes) throws SQLException
SQLException
CompiledStatement compileStatement(String statement, StatementBuilder.StatementType type, FieldType[] argFieldTypes, int resultFlags) throws SQLException
resultFlags
- Allows specification of some result flags. This is dependent on the backend and database type. Set to
DEFAULT_RESULT_FLAGS
for the internal default.
SQLException
int insert(String statement, Object[] args, FieldType[] argfieldTypes, GeneratedKeyHolder keyHolder) throws SQLException
statement
- SQL statement to use for inserting.args
- Object arguments for the SQL '?'s.argfieldTypes
- Field types of the arguments.keyHolder
- The holder that gets set with the generated key value which may be null.
SQLException
int update(String statement, Object[] args, FieldType[] argfieldTypes) throws SQLException
statement
- SQL statement to use for updating.args
- Object arguments for the SQL '?'s.argfieldTypes
- Field types of the arguments.
SQLException
int delete(String statement, Object[] args, FieldType[] argfieldTypes) throws SQLException
statement
- SQL statement to use for deleting.args
- Object arguments for the SQL '?'s.argfieldTypes
- Field types of the arguments.
SQLException
<T> Object queryForOne(String statement, Object[] args, FieldType[] argfieldTypes, GenericRowMapper<T> rowMapper, ObjectCache objectCache) throws SQLException
statement
- SQL statement to use for deleting.args
- Object arguments for the SQL '?'s.argfieldTypes
- Field types of the arguments.rowMapper
- The mapper to use to convert the row into the returned object.objectCache
- Any object cache associated with the query or null if none.
MORE_THAN_ONE
if more than one result was found.
SQLException
long queryForLong(String statement) throws SQLException
statement
- SQL statement to use for the query.
SQLException
long queryForLong(String statement, Object[] args, FieldType[] argFieldTypes) throws SQLException
statement
- SQL statement to use for the query.args
- Arguments to pass into the query.argFieldTypes
- Field types that correspond to the args.
SQLException
void close() throws SQLException
SQLException
boolean isClosed() throws SQLException
close()
or because of a fatal error.
SQLException
boolean isTableExists(String tableName) throws SQLException
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |