|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.j256.ormlite.stmt.StatementExecutor<T,ID>
public class StatementExecutor<T,ID>
Executes SQL statements for a particular table in a particular database. Basically a call through to various mapped statement methods.
| Constructor Summary | |
|---|---|
StatementExecutor(DatabaseType databaseType,
TableInfo<T,ID> tableInfo,
Dao<T,ID> dao)
Provides statements for various SQL operations. |
|
| Method Summary | ||
|---|---|---|
SelectIterator<T,ID> |
buildIterator(BaseDaoImpl<T,ID> classDao,
ConnectionSource connectionSource,
ObjectCache objectCache)
Create and return a SelectIterator for the class using the default mapped query for all statement. |
|
SelectIterator<T,ID> |
buildIterator(BaseDaoImpl<T,ID> classDao,
ConnectionSource connectionSource,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
Create and return an SelectIterator for the class using a prepared statement. |
|
|
callBatchTasks(DatabaseConnection connection,
boolean saved,
Callable<CT> callable)
Call batch tasks insude of a connection which may, or may not, have been "saved". |
|
int |
create(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
Create a new entry in the database from an object. |
|
int |
delete(DatabaseConnection databaseConnection,
PreparedDelete<T> preparedDelete)
Delete rows that match the prepared statement. |
|
int |
delete(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
Delete an object from the database. |
|
int |
deleteById(DatabaseConnection databaseConnection,
ID id,
ObjectCache objectCache)
Delete an object from the database by id. |
|
int |
deleteIds(DatabaseConnection databaseConnection,
Collection<ID> ids,
ObjectCache objectCache)
Delete a collection of objects from the database. |
|
int |
deleteObjects(DatabaseConnection databaseConnection,
Collection<T> datas,
ObjectCache objectCache)
Delete a collection of objects from the database. |
|
int |
executeRaw(DatabaseConnection connection,
String statement,
String[] arguments)
Return true if it worked else false. |
|
GenericRowMapper<T> |
getSelectStarRowMapper()
Return a row mapper suitable for mapping 'select *' queries. |
|
boolean |
ifExists(DatabaseConnection connection,
ID id)
|
|
String[] |
mapRow(DatabaseResults results)
Used to convert a results row to an object. |
|
List<T> |
query(ConnectionSource connectionSource,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
Return a list of all of the data in the table that matches the PreparedStmt. |
|
List<T> |
queryForAll(ConnectionSource connectionSource,
ObjectCache objectCache)
Return a list of all of the data in the table. |
|
long |
queryForCountStar(DatabaseConnection databaseConnection)
Return a long value which is the number of rows in the table. |
|
long |
queryForCountStar(DatabaseConnection databaseConnection,
PreparedStmt<T> preparedStmt)
Return a long value which is the number of rows in the table. |
|
T |
queryForFirst(DatabaseConnection databaseConnection,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
Return the first object that matches the PreparedStmt or null if none. |
|
T |
queryForId(DatabaseConnection databaseConnection,
ID id,
ObjectCache objectCache)
Return the object associated with the id or null if none. |
|
GenericRawResults<Object[]> |
queryRaw(ConnectionSource connectionSource,
String query,
DataType[] columnTypes,
String[] arguments,
ObjectCache objectCache)
Return a results object associated with an internal iterator that returns Object[] results. |
|
|
queryRaw(ConnectionSource connectionSource,
String query,
RawRowMapper<UO> rowMapper,
String[] arguments,
ObjectCache objectCache)
Return a results object associated with an internal iterator is mapped by the user's rowMapper. |
|
GenericRawResults<String[]> |
queryRaw(ConnectionSource connectionSource,
String query,
String[] arguments,
ObjectCache objectCache)
Return a results object associated with an internal iterator that returns String[] results. |
|
int |
refresh(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
Does a query for the object's Id and copies in each of the field values from the database to refresh the data parameter. |
|
int |
update(DatabaseConnection databaseConnection,
PreparedUpdate<T> preparedUpdate)
Update rows in the database. |
|
int |
update(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
Update an object in the database. |
|
int |
updateId(DatabaseConnection databaseConnection,
T data,
ID newId,
ObjectCache objectCache)
Update an object in the database to change its id to the newId parameter. |
|
int |
updateRaw(DatabaseConnection connection,
String statement,
String[] arguments)
Return the number of rows affected. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StatementExecutor(DatabaseType databaseType,
TableInfo<T,ID> tableInfo,
Dao<T,ID> dao)
| Method Detail |
|---|
public T queryForId(DatabaseConnection databaseConnection,
ID id,
ObjectCache objectCache)
throws SQLException
SQLException
public T queryForFirst(DatabaseConnection databaseConnection,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
throws SQLException
PreparedStmt or null if none.
SQLException
public List<T> queryForAll(ConnectionSource connectionSource,
ObjectCache objectCache)
throws SQLException
Dao.iterator() if this is the case.
SQLException
public long queryForCountStar(DatabaseConnection databaseConnection)
throws SQLException
SQLException
public long queryForCountStar(DatabaseConnection databaseConnection,
PreparedStmt<T> preparedStmt)
throws SQLException
SQLException
public List<T> query(ConnectionSource connectionSource,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
throws SQLException
PreparedStmt. Should be used carefully if
the table is large. Consider using the Dao.iterator() if this is the case.
SQLException
public SelectIterator<T,ID> buildIterator(BaseDaoImpl<T,ID> classDao,
ConnectionSource connectionSource,
ObjectCache objectCache)
throws SQLException
SQLException
public GenericRowMapper<T> getSelectStarRowMapper()
throws SQLException
SQLException
public SelectIterator<T,ID> buildIterator(BaseDaoImpl<T,ID> classDao,
ConnectionSource connectionSource,
PreparedStmt<T> preparedStmt,
ObjectCache objectCache)
throws SQLException
SelectIterator for the class using a prepared statement.
SQLException
public GenericRawResults<String[]> queryRaw(ConnectionSource connectionSource,
String query,
String[] arguments,
ObjectCache objectCache)
throws SQLException
SQLException
public <UO> GenericRawResults<UO> queryRaw(ConnectionSource connectionSource,
String query,
RawRowMapper<UO> rowMapper,
String[] arguments,
ObjectCache objectCache)
throws SQLException
SQLException
public GenericRawResults<Object[]> queryRaw(ConnectionSource connectionSource,
String query,
DataType[] columnTypes,
String[] arguments,
ObjectCache objectCache)
throws SQLException
SQLException
public int updateRaw(DatabaseConnection connection,
String statement,
String[] arguments)
throws SQLException
SQLException
public int executeRaw(DatabaseConnection connection,
String statement,
String[] arguments)
throws SQLException
SQLException
public int create(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
throws SQLException
SQLException
public int update(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
throws SQLException
SQLException
public int updateId(DatabaseConnection databaseConnection,
T data,
ID newId,
ObjectCache objectCache)
throws SQLException
SQLException
public int update(DatabaseConnection databaseConnection,
PreparedUpdate<T> preparedUpdate)
throws SQLException
SQLException
public int refresh(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
throws SQLException
SQLException
public int delete(DatabaseConnection databaseConnection,
T data,
ObjectCache objectCache)
throws SQLException
SQLException
public int deleteById(DatabaseConnection databaseConnection,
ID id,
ObjectCache objectCache)
throws SQLException
SQLException
public int deleteObjects(DatabaseConnection databaseConnection,
Collection<T> datas,
ObjectCache objectCache)
throws SQLException
SQLException
public int deleteIds(DatabaseConnection databaseConnection,
Collection<ID> ids,
ObjectCache objectCache)
throws SQLException
SQLException
public int delete(DatabaseConnection databaseConnection,
PreparedDelete<T> preparedDelete)
throws SQLException
SQLException
public <CT> CT callBatchTasks(DatabaseConnection connection,
boolean saved,
Callable<CT> callable)
throws Exception
Exception
public String[] mapRow(DatabaseResults results)
throws SQLException
GenericRowMapper
mapRow in interface GenericRowMapper<String[]>results - Results object we are mapping.
SQLException - If we could not get the SQL results or instantiate the object.
public boolean ifExists(DatabaseConnection connection,
ID id)
throws SQLException
SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||