commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc JdbcHelper.java
Date Thu, 28 Aug 2003 00:13:37 GMT
dgraham     2003/08/27 17:13:37

  Modified:    mapper/src/share/org/apache/commons/mapper/jdbc
                        JdbcHelper.java
  Log:
  Removed getField() methods because they were too limited to be useful.
  
  Revision  Changes    Path
  1.10      +3 -64     jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc/JdbcHelper.java
  
  Index: JdbcHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/mapper/src/share/org/apache/commons/mapper/jdbc/JdbcHelper.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JdbcHelper.java	28 Aug 2003 00:07:22 -0000	1.9
  +++ JdbcHelper.java	28 Aug 2003 00:13:37 -0000	1.10
  @@ -333,67 +333,6 @@
       }
   
       /**
  -     * Performs just like the other getField method except that this one 
  -     * gets its own Connection.
  -     * @param query
  -     * @param column
  -     * @return The value of the selected field.
  -     * @throws MapperException
  -     */
  -    public String getField(String query, String column) throws MapperException {
  -        Connection conn = null;
  -        String field = null;
  -
  -        try {
  -            conn = this.getConnection();
  -            field = this.getField(query, column, conn);
  -
  -        } catch (SQLException e) {
  -            throw new MapperException(e);
  -        } finally {
  -            this.closeConnection(conn);
  -        }
  -
  -        return field;
  -    }
  -
  -    /**
  -     * Executes the query and returns the column's value from the first 
  -     * returned row.  This is helpful when finding the last generated ID in 
  -     * a table but can be used to return any column value.
  -     * @param query A valid SQL SELECT query.
  -     * @param column The column whose value should be returned.
  -     * @param conn A Connection to run the query on.
  -     * @throws SQLException if a database access error occurs or the given 
  -     * query returned 0 rows.
  -     */
  -    public String getField(String query, String column, Connection conn)
  -        throws SQLException {
  -
  -        PreparedStatement stmt = conn.prepareStatement(query);
  -        ResultSet rs = null;
  -        String field = null;
  -
  -        try {
  -            rs = stmt.executeQuery();
  -            if (!rs.next()) {
  -                throw new SQLException(
  -                    "Query: " + query + " didn't return any records.");
  -            }
  -            field = rs.getString(column);
  -
  -        } finally {
  -            if (rs != null) {
  -                rs.close();
  -            }
  -
  -            stmt.close();
  -        }
  -
  -        return field;
  -    }
  -
  -    /**
        * Rollback any changes made on the given connection.
        * @param conn The database Connection to rollback.  A null value is legal.
        * @throws MapperException if an SQLException occurred during the rollback.
  
  
  

Mime
View raw message