public class DatabaseQueryUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
close(Statement statement,
ResultSet resultSet)
Closes statements and result sets.
|
static int |
executeUpdate(DatabaseComponent databaseComponent,
String query,
Object... parameters)
Executes a database update.
|
static String[] |
getColumns(ResultSetMetaData rsmd)
Returns an array of strings as upper-case column names.
|
static List<Map<String,Object>> |
getGridValues(DatabaseComponent databaseComponent,
String query,
Object... parameters)
Returns a list of values, one per row, containing a map of column names to values of that row.
|
static Map<String,Double> |
getNumericQueryValueMap(DatabaseComponent databaseComponent,
String query,
Object... parameters)
Returns a mapping of rows as key-value pairs where the key is the
first column (a string) and the second column is a value numeric.
|
static Map<String,Double> |
getNumericQueryValues(DatabaseComponent databaseComponent,
String query,
Object... parameters)
Executes a query, returning the results as a map where the keys
are the column names and values are the value of that column.
|
static Double |
getSingleNumericQueryValue(DatabaseComponent databaseComponent,
String query,
Object... parameters)
Returns the result of a query as a single Double value.
|
public static int executeUpdate(DatabaseComponent databaseComponent, String query, Object... parameters) throws SQLException
databaseComponent - query - parameters - SQLExceptionpublic static Double getSingleNumericQueryValue(DatabaseComponent databaseComponent, String query, Object... parameters)
Double.NaN if the query fails.public static Map<String,Double> getNumericQueryValues(DatabaseComponent databaseComponent, String query, Object... parameters)
databaseComponent - query - SQL query stringparameters - optional bind parameterspublic static List<Map<String,Object>> getGridValues(DatabaseComponent databaseComponent, String query, Object... parameters) throws SQLException
databaseComponent - database to queryquery - SQL queryparameters - parameters to bind to the querySQLException - if query failspublic static Map<String,Double> getNumericQueryValueMap(DatabaseComponent databaseComponent, String query, Object... parameters)
databaseComponent - the component to execute onquery - the sql query to runparameters - any parameters to bind firstpublic static String[] getColumns(ResultSetMetaData rsmd) throws SQLException
SQLExceptionCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.