Package org.aksw.commons.util.jdbc
Class SqlUtils
- java.lang.Object
-
- org.aksw.commons.util.jdbc.SqlUtils
-
public class SqlUtils extends Object
- Author:
- Claus Stadler Date: 7/26/11 Time: 3:23 PM
-
-
Constructor Summary
Constructors Constructor Description SqlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(ResultSet resultSet)static <T> Texecute(Connection conn, String sql, Class<T> clazz, Object... args)static <T> Texecute(PreparedStatement stmt, Class<T> clazz, Object... args)static ResultSetexecute(PreparedStatement stmt, Object... args)static ResultSetexecuteCore(Connection conn, String sql, Object... args)static <T> List<T>executeList(Connection conn, String sql, Class<T> clazz, Object... args)static <T> List<T>executeList(PreparedStatement stmt, Class<T> clazz, Object... args)static <T> voidexecuteSetArgs(PreparedStatement stmt, Object... args)static <T> List<T>list(ResultSet rs, Class<T> clazz)static <T> List<T>list(ResultSet rs, Class<T> clazz, boolean bClose)static <T> Tsingle(ResultSet rs, Class<T> clazz)static <T> Tsingle(ResultSet rs, Class<T> clazz, boolean bClose)Returns the 1st column of the first row or null of there is no row.
-
-
-
Method Detail
-
executeSetArgs
public static <T> void executeSetArgs(PreparedStatement stmt, Object... args) throws SQLException
- Throws:
SQLException
-
execute
public static <T> T execute(Connection conn, String sql, Class<T> clazz, Object... args) throws SQLException
- Throws:
SQLException
-
executeCore
public static ResultSet executeCore(Connection conn, String sql, Object... args) throws SQLException
- Throws:
SQLException
-
execute
public static ResultSet execute(PreparedStatement stmt, Object... args) throws SQLException
- Throws:
SQLException
-
execute
public static <T> T execute(PreparedStatement stmt, Class<T> clazz, Object... args) throws SQLException
- Throws:
SQLException
-
executeList
public static <T> List<T> executeList(Connection conn, String sql, Class<T> clazz, Object... args) throws SQLException
- Throws:
SQLException
-
executeList
public static <T> List<T> executeList(PreparedStatement stmt, Class<T> clazz, Object... args) throws SQLException
- Throws:
SQLException
-
close
public static void close(ResultSet resultSet)
-
single
public static <T> T single(ResultSet rs, Class<T> clazz) throws SQLException
- Throws:
SQLException
-
single
public static <T> T single(ResultSet rs, Class<T> clazz, boolean bClose) throws SQLException
Returns the 1st column of the first row or null of there is no row. Also throws exception if there is more than 1 row and 1 column.- Returns:
- Throws:
SQLException
-
list
public static <T> List<T> list(ResultSet rs, Class<T> clazz) throws SQLException
- Throws:
SQLException
-
list
public static <T> List<T> list(ResultSet rs, Class<T> clazz, boolean bClose) throws SQLException
- Throws:
SQLException
-
-