|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.database.SQLUnitils
public class SQLUnitils
Utilities for executing statements and queries.
Constructor Summary | |
---|---|
SQLUnitils()
|
Method Summary | |
---|---|
static int |
executeUpdate(String sql,
DataSource dataSource)
Executes the given update statement. |
static int |
executeUpdateQuietly(String sql,
DataSource dataSource)
Executes the given statement ignoring all exceptions. |
static long |
getItemAsLong(String sql,
DataSource dataSource)
Returns the long extracted from the result of the given query. |
static String |
getItemAsString(String sql,
DataSource dataSource)
Returns the value extracted from the result of the given query. |
static Set<String> |
getItemsAsStringSet(String sql,
DataSource dataSource)
Returns the items extracted from the result of the given query. |
static boolean |
isEmpty(String tableName,
DataSource dataSource)
Utility method to check whether the given table is empty. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLUnitils()
Method Detail |
---|
public static int executeUpdate(String sql, DataSource dataSource)
sql
- The sql string for retrieving the itemsdataSource
- The data source, not null
public static int executeUpdateQuietly(String sql, DataSource dataSource)
sql
- The sql string for retrieving the itemsdataSource
- The data source, not null
public static long getItemAsLong(String sql, DataSource dataSource)
UnitilsException
is thrown.
sql
- The sql string for retrieving the itemsdataSource
- The data source, not null
public static String getItemAsString(String sql, DataSource dataSource)
UnitilsException
is thrown.
sql
- The sql string for retrieving the itemsdataSource
- The data source, not null
public static Set<String> getItemsAsStringSet(String sql, DataSource dataSource)
sql
- The sql string for retrieving the itemsdataSource
- The data source, not null
public static boolean isEmpty(String tableName, DataSource dataSource)
tableName
- The table, not nulldataSource
- The data source, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |