Class DatabaseUtil


  • public final class DatabaseUtil
    extends Object
    Static database utility methods.
    • Method Detail

      • executeIntegerQuery

        public static Integer executeIntegerQuery​(DataSource datasource,
                                                  String statement,
                                                  Object[] arguments)
                                           throws SQLException
        Execute a query that returns an integer (for example a select will return the number of records. in the resultset)
        Parameters:
        datasource -
        statement -
        arguments -
        Returns:
        the integer returned by executing the query
        Throws:
        SQLException
      • executeIntegerQuery

        public static Integer executeIntegerQuery​(DataSource datasource,
                                                  String statement,
                                                  Class[] types,
                                                  Object[] arguments)
                                           throws SQLException
        Execute a query that returns an integer (for example a select will return the number of records. in the resultset)
        Parameters:
        datasource -
        statement -
        types -
        arguments -
        Returns:
        the integer returned by executing the query
        Throws:
        SQLException
      • executeIntegersQuery

        public static Integer[] executeIntegersQuery​(DataSource datasource,
                                                     String statement,
                                                     Object[] arguments)
                                              throws SQLException
        Execute a query that returns integers.
        Parameters:
        datasource -
        statement -
        arguments -
        Returns:
        array of integers
        Throws:
        SQLException
      • executeIntegersQuery

        public static Integer[] executeIntegersQuery​(DataSource datasource,
                                                     String statement,
                                                     Class[] types,
                                                     Object[] arguments)
                                              throws SQLException
        Execute a query that returns integers.
        Parameters:
        datasource -
        statement -
        types -
        arguments -
        Returns:
        array of integers
        Throws:
        SQLException