code: public static <T> T queryScalar(String poolName, String sql, Class<T> scalarType, Object[] params)
        throws SQLStatementNotFoundException, YankSQLException {
  
      T returnObject = null;
  
      try {
        ScalarHandler<T> resultSetHandler;
        if (scalarType.equals(Integer.class)) {
          resultSetHandler = (ScalarHandler<T>) new IntegerScalarHandler();
        } else if (scalarType.equals(Long.class)) {
          resultSetHandler = (ScalarHandler<T>) new LongScalarHandler();
        } else if (scalarType.equals(Float.class)) {
          resultSetHandler = (ScalarHandler<T>) new FloatScalarHandler();
        } else if (scalarType.equals(Double.class)) {
          resultSetHandler = (ScalarHandler<T>) new DoubleScalarHandler();
        } else if (scalarType.equals(BigDecimal.class)) {
          resultSetHandler = (ScalarHandler<T>) new BigDecimalScalarHandler();
        } else {
          resultSetHandler = new ScalarHandler<T>();
        }
  
        returnObject =
            new QueryRunner(YANK_POOL_MANAGER.getConnectionPool(poolName))
                .query(sql, resultSetHandler, params);
  
      } catch (SQLException e) {
        handleSQLException(e, poolName, sql);
      }
  
      return returnObject;
    }
docs: Return just one scalar given a an SQL statement
  
  @param poolName The name of the connection pool to query against
  @param scalarType The Class of the desired return scalar matching the table
  @param params The replacement parameters
  @return The scalar Object
  @throws SQLStatementNotFoundException if an SQL statement could not be found for the given
  sqlKey String