Package org.apache.ibatis.jdbc
Class SqlRunner
java.lang.Object
org.apache.ibatis.jdbc.SqlRunner
- Author:
- Clinton Begin
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Since 3.5.4, this method is deprecated.int
Executes a DELETE statement.int
Executes an INSERT statement.void
Executes any string as a JDBC Statement.Executes a SELECT statement that returns multiple rows.Executes a SELECT statement that returns one row.void
setUseGeneratedKeySupport
(boolean useGeneratedKeySupport) int
Executes an UPDATE statement.
-
Field Details
-
NO_GENERATED_KEY
public static final int NO_GENERATED_KEY- See Also:
-
-
Constructor Details
-
SqlRunner
-
-
Method Details
-
setUseGeneratedKeySupport
public void setUseGeneratedKeySupport(boolean useGeneratedKeySupport) -
selectOne
Executes a SELECT statement that returns one row.- Parameters:
sql
- The SQLargs
- The arguments to be set on the statement.- Returns:
- The row expected.
- Throws:
SQLException
- If less or more than one row is returned
-
selectAll
Executes a SELECT statement that returns multiple rows.- Parameters:
sql
- The SQLargs
- The arguments to be set on the statement.- Returns:
- The list of rows expected.
- Throws:
SQLException
- If statement preparation or execution fails
-
insert
Executes an INSERT statement.- Parameters:
sql
- The SQLargs
- The arguments to be set on the statement.- Returns:
- The number of rows impacted or BATCHED_RESULTS if the statements are being batched.
- Throws:
SQLException
- If statement preparation or execution fails
-
update
Executes an UPDATE statement.- Parameters:
sql
- The SQLargs
- The arguments to be set on the statement.- Returns:
- The number of rows impacted or BATCHED_RESULTS if the statements are being batched.
- Throws:
SQLException
- If statement preparation or execution fails
-
delete
Executes a DELETE statement.- Parameters:
sql
- The SQLargs
- The arguments to be set on the statement.- Returns:
- The number of rows impacted or BATCHED_RESULTS if the statements are being batched.
- Throws:
SQLException
- If statement preparation or execution fails
-
run
Executes any string as a JDBC Statement. Good for DDL- Parameters:
sql
- The SQL- Throws:
SQLException
- If statement preparation or execution fails
-
closeConnection
Deprecated.Since 3.5.4, this method is deprecated. Please close theConnection
outside of this class.
-