com.ibatis.sqlmap.client
Interface SqlMapExecutor

All Known Subinterfaces:
ExtendedSqlMapClient, SqlMapClient, SqlMapSession
All Known Implementing Classes:
SqlMapClientImpl, SqlMapSessionImpl

public interface SqlMapExecutor

This interface declares all methods involved with executing statements and batches for an SQL Map.

另请参见:
SqlMapSession, SqlMapClient

方法摘要
 int delete(java.lang.String id)
          Executes a mapped SQL DELETE statement.
 int delete(java.lang.String id, java.lang.Object parameterObject)
          Executes a mapped SQL DELETE statement.
 int executeBatch()
          Executes (flushes) all statements currently batched.
 java.util.List executeBatchDetailed()
          Executes (flushes) all statements currently batched.
 java.lang.Object insert(java.lang.String id)
          Executes a mapped SQL INSERT statement.
 java.lang.Object insert(java.lang.String id, java.lang.Object parameterObject)
          Executes a mapped SQL INSERT statement.
 java.util.List queryForList(java.lang.String id)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.
 java.util.List queryForList(java.lang.String id, int skip, int max)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.
 java.util.List queryForList(java.lang.String id, java.lang.Object parameterObject)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.
 java.util.List queryForList(java.lang.String id, java.lang.Object parameterObject, int skip, int max)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.
 java.util.Map queryForMap(java.lang.String id, java.lang.Object parameterObject, java.lang.String keyProp)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects that will be keyed into a Map.
 java.util.Map queryForMap(java.lang.String id, java.lang.Object parameterObject, java.lang.String keyProp, java.lang.String valueProp)
          Executes a mapped SQL SELECT statement that returns data to populate a number of result objects from which one property will be keyed into a Map.
 java.lang.Object queryForObject(java.lang.String id)
          Executes a mapped SQL SELECT statement that returns data to populate a single object instance.
 java.lang.Object queryForObject(java.lang.String id, java.lang.Object parameterObject)
          Executes a mapped SQL SELECT statement that returns data to populate a single object instance.
 java.lang.Object queryForObject(java.lang.String id, java.lang.Object parameterObject, java.lang.Object resultObject)
          Executes a mapped SQL SELECT statement that returns data to populate the supplied result object.
 PaginatedList queryForPaginatedList(java.lang.String id, int pageSize)
          Deprecated. All paginated list features have been deprecated
 PaginatedList queryForPaginatedList(java.lang.String id, java.lang.Object parameterObject, int pageSize)
          Deprecated. All paginated list features have been deprecated
 void queryWithRowHandler(java.lang.String id, java.lang.Object parameterObject, RowHandler rowHandler)
          Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.
 void queryWithRowHandler(java.lang.String id, RowHandler rowHandler)
          Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.
 void startBatch()
          Starts a batch in which update statements will be cached before being sent to the database all at once.
 int update(java.lang.String id)
          Executes a mapped SQL UPDATE statement.
 int update(java.lang.String id, java.lang.Object parameterObject)
          Executes a mapped SQL UPDATE statement.
 

方法详细信息

insert

java.lang.Object insert(java.lang.String id,
                        java.lang.Object parameterObject)
                        throws java.sql.SQLException
Executes a mapped SQL INSERT statement. Insert is a bit different from other update methods, as it provides facilities for returning the primary key of the newly inserted row (rather than the effected rows). This functionality is of course optional.

The parameter object is generally used to supply the input data for the INSERT values.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
返回:
The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.
抛出异常:
java.sql.SQLException - If an error occurs.

insert

java.lang.Object insert(java.lang.String id)
                        throws java.sql.SQLException
Executes a mapped SQL INSERT statement. Insert is a bit different from other update methods, as it provides facilities for returning the primary key of the newly inserted row (rather than the effected rows). This functionality is of course optional.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
返回:
The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.
抛出异常:
java.sql.SQLException - If an error occurs.

update

int update(java.lang.String id,
           java.lang.Object parameterObject)
           throws java.sql.SQLException
Executes a mapped SQL UPDATE statement. Update can also be used for any other update statement type, such as inserts and deletes. Update returns the number of rows effected.

The parameter object is generally used to supply the input data for the UPDATE values as well as the WHERE clause parameter(s).

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
返回:
The number of rows effected.
抛出异常:
java.sql.SQLException - If an error occurs.

update

int update(java.lang.String id)
           throws java.sql.SQLException
Executes a mapped SQL UPDATE statement. Update can also be used for any other update statement type, such as inserts and deletes. Update returns the number of rows effected.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
返回:
The number of rows effected.
抛出异常:
java.sql.SQLException - If an error occurs.

delete

int delete(java.lang.String id,
           java.lang.Object parameterObject)
           throws java.sql.SQLException
Executes a mapped SQL DELETE statement. Delete returns the number of rows effected.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the DELETE statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
返回:
The number of rows effected.
抛出异常:
java.sql.SQLException - If an error occurs.

delete

int delete(java.lang.String id)
           throws java.sql.SQLException
Executes a mapped SQL DELETE statement. Delete returns the number of rows effected.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
返回:
The number of rows effected.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForObject

java.lang.Object queryForObject(java.lang.String id,
                                java.lang.Object parameterObject)
                                throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a single object instance.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
返回:
The single result object populated with the result set data, or null if no result was found
抛出异常:
java.sql.SQLException - If more than one result was found, or if any other error occurs.

queryForObject

java.lang.Object queryForObject(java.lang.String id)
                                throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a single object instance.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
返回:
The single result object populated with the result set data, or null if no result was found
抛出异常:
java.sql.SQLException - If more than one result was found, or if any other error occurs.

queryForObject

java.lang.Object queryForObject(java.lang.String id,
                                java.lang.Object parameterObject,
                                java.lang.Object resultObject)
                                throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate the supplied result object.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
resultObject - The result object instance that should be populated with result data.
返回:
The single result object as supplied by the resultObject parameter, populated with the result set data, or null if no result was found
抛出异常:
java.sql.SQLException - If more than one result was found, or if any other error occurs.

queryForList

java.util.List queryForList(java.lang.String id,
                            java.lang.Object parameterObject)
                            throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
返回:
A List of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForList

java.util.List queryForList(java.lang.String id)
                            throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
返回:
A List of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForList

java.util.List queryForList(java.lang.String id,
                            java.lang.Object parameterObject,
                            int skip,
                            int max)
                            throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
skip - The number of results to ignore.
max - The maximum number of results to return.
返回:
A List of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForList

java.util.List queryForList(java.lang.String id,
                            int skip,
                            int max)
                            throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
skip - The number of results to ignore.
max - The maximum number of results to return.
返回:
A List of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryWithRowHandler

void queryWithRowHandler(java.lang.String id,
                         java.lang.Object parameterObject,
                         RowHandler rowHandler)
                         throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.

This is generally a good approach to take when dealing with large sets of records (i.e. hundreds, thousands...) that need to be processed without eating up all of the system resources.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
rowHandler - A RowHandler instance
抛出异常:
java.sql.SQLException - If an error occurs.

queryWithRowHandler

void queryWithRowHandler(java.lang.String id,
                         RowHandler rowHandler)
                         throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.

This is generally a good approach to take when dealing with large sets of records (i.e. hundreds, thousands...) that need to be processed without eating up all of the system resources.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
rowHandler - A RowHandler instance
抛出异常:
java.sql.SQLException - If an error occurs.

queryForPaginatedList

PaginatedList queryForPaginatedList(java.lang.String id,
                                    java.lang.Object parameterObject,
                                    int pageSize)
                                    throws java.sql.SQLException
Deprecated. All paginated list features have been deprecated

Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
pageSize - The maximum number of result objects each page can hold.
返回:
A PaginatedList of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForPaginatedList

PaginatedList queryForPaginatedList(java.lang.String id,
                                    int pageSize)
                                    throws java.sql.SQLException
Deprecated. All paginated list features have been deprecated

Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.

This overload assumes no parameter is needed.

参数:
id - The name of the statement to execute.
pageSize - The maximum number of result objects each page can hold.
返回:
A PaginatedList of result objects.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForMap

java.util.Map queryForMap(java.lang.String id,
                          java.lang.Object parameterObject,
                          java.lang.String keyProp)
                          throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects that will be keyed into a Map.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
keyProp - The property to be used as the key in the Map.
返回:
A Map keyed by keyProp with values being the result object instance.
抛出异常:
java.sql.SQLException - If an error occurs.

queryForMap

java.util.Map queryForMap(java.lang.String id,
                          java.lang.Object parameterObject,
                          java.lang.String keyProp,
                          java.lang.String valueProp)
                          throws java.sql.SQLException
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects from which one property will be keyed into a Map.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

参数:
id - The name of the statement to execute.
parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.).
keyProp - The property to be used as the key in the Map.
valueProp - The property to be used as the value in the Map.
返回:
A Map keyed by keyProp with values of valueProp.
抛出异常:
java.sql.SQLException - If an error occurs.

startBatch

void startBatch()
                throws java.sql.SQLException
Starts a batch in which update statements will be cached before being sent to the database all at once. This can improve overall performance of updates update when dealing with numerous updates (e.g. inserting 1:M related data).

抛出异常:
java.sql.SQLException - If the batch could not be started.

executeBatch

int executeBatch()
                 throws java.sql.SQLException
Executes (flushes) all statements currently batched.

返回:
the number of rows updated in the batch
抛出异常:
java.sql.SQLException - If the batch could not be executed or if any of the statements fails.

executeBatchDetailed

java.util.List executeBatchDetailed()
                                    throws java.sql.SQLException,
                                           BatchException
Executes (flushes) all statements currently batched.

返回:
a List of BatchResult objects. There will be one element in the list for each sub-batch executed. A sub-batch is created by adding a statement to the batch that does not equal the prior statement.
抛出异常:
java.sql.SQLException - if a database access error occurs, or the drive does not support batch statements
BatchException - if the driver throws BatchUpdateException
另请参见:
BatchException