|
||||||||||
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 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,
FieldType[] resultfieldTypes)
Compile and prepare the SQL statement for execution. |
|
int |
delete(String statement,
Object[] args,
FieldType[] argfieldTypes)
Perform a SQL delete with the associated SQL statement, arguments, and types. |
|
boolean |
getAutoCommit()
Return if auto-commit is currently enabled. |
|
int |
insert(String statement,
Object[] args,
FieldType[] argfieldTypes)
Perform a SQL insert with the associated SQL statement, arguments, and types. |
|
int |
insert(String statement,
Object[] args,
FieldType[] argfieldTypes,
GeneratedKeyHolder keyHolder)
Perform a SQL update while returning generated keys with the associated SQL statement, arguments, and types. |
|
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. |
|
|
queryForOne(String statement,
Object[] args,
FieldType[] argfieldTypes,
GenericRowMapper<T> rowMapper)
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)
if more than one result was found by the query
Method Detail |
---|
boolean isAutoCommitSupported() throws SQLException
SQLException
boolean getAutoCommit() 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, FieldType[] resultfieldTypes) throws SQLException
SQLException
int insert(String statement, Object[] args, FieldType[] argfieldTypes) throws SQLException
statement
- SQL statement to use for inserting.args
- Object arguments for the SQL '?'s.argfieldTypes
- Field types of the arguments.
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.
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) 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.
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
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 |