org.aksw.commons.sparql.api.cache.extra
Class SqlUtils

java.lang.Object
  extended by org.aksw.commons.sparql.api.cache.extra.SqlUtils

public class SqlUtils
extends Object

Author:
Claus Stadler Date: 7/26/11 Time: 3:23 PM

Constructor Summary
SqlUtils()
           
 
Method Summary
static void close(ResultSet resultSet)
           
static
<T> T
execute(Connection conn, String sql, Class<T> clazz, Object... args)
           
static
<T> T
execute(PreparedStatement stmt, Class<T> clazz, Object... args)
           
static ResultSet execute(PreparedStatement stmt, Object... args)
           
static ResultSet executeCore(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> void
executeSetArgs(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> T
single(ResultSet rs, Class<T> clazz)
           
static
<T> T
single(ResultSet rs, Class<T> clazz, boolean bClose)
          Returns the 1st column of the first row or null of there is no row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlUtils

public SqlUtils()
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


Copyright © 2011. All Rights Reserved.