org.rhq.plugins.database
Class DatabaseQueryUtility

java.lang.Object
  extended by org.rhq.plugins.database.DatabaseQueryUtility

public class DatabaseQueryUtility
extends java.lang.Object

Author:
Greg Hinkle

Nested Class Summary
static class DatabaseQueryUtility.StatementParameter
           
 
Constructor Summary
DatabaseQueryUtility()
           
 
Method Summary
static void close(java.sql.Statement statement, java.sql.ResultSet resultSet)
           
static int executeUpdate(DatabaseComponent databaseComponent, java.lang.String query, java.lang.Object... parameters)
           
static java.lang.String[] getColumns(java.sql.ResultSetMetaData rsmd)
           
static java.util.Map<java.lang.String,java.lang.Double> getNumericQueryValueMap(DatabaseComponent databaseComponent, java.lang.String query, java.lang.Object... parameters)
          Used to access a set of rows as key, value pairs where the key is the first column and is a string and the second is a value and is numeric
static java.util.Map<java.lang.String,java.lang.Double> getNumericQueryValues(DatabaseComponent databaseComponent, java.lang.String query, java.lang.Object... parameters)
          Used to read a single row of columns into a map
static java.lang.Double getSingleNumericQueryValue(DatabaseComponent databaseComponent, java.lang.String query, java.lang.Object... parameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseQueryUtility

public DatabaseQueryUtility()
Method Detail

executeUpdate

public static int executeUpdate(DatabaseComponent databaseComponent,
                                java.lang.String query,
                                java.lang.Object... parameters)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getSingleNumericQueryValue

public static java.lang.Double getSingleNumericQueryValue(DatabaseComponent databaseComponent,
                                                          java.lang.String query,
                                                          java.lang.Object... parameters)

getNumericQueryValues

public static java.util.Map<java.lang.String,java.lang.Double> getNumericQueryValues(DatabaseComponent databaseComponent,
                                                                                     java.lang.String query,
                                                                                     java.lang.Object... parameters)
Used to read a single row of columns into a map

Parameters:
databaseComponent -
query -
parameters -
Returns:

getNumericQueryValueMap

public static java.util.Map<java.lang.String,java.lang.Double> getNumericQueryValueMap(DatabaseComponent databaseComponent,
                                                                                       java.lang.String query,
                                                                                       java.lang.Object... parameters)
Used to access a set of rows as key, value pairs where the key is the first column and is a string and the second is a value and is numeric

Parameters:
databaseComponent - the component to execute on
query - the sql query to run
parameters - any parameters to bind first
Returns:
a Map of the keys against the value

getColumns

public static java.lang.String[] getColumns(java.sql.ResultSetMetaData rsmd)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

close

public static void close(java.sql.Statement statement,
                         java.sql.ResultSet resultSet)


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.