You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2012/08/20 11:56:55 UTC

svn commit: r1374960 - in /commons/proper/dbutils/trunk/src: changes/changes.xml main/java/org/apache/commons/dbutils/QueryRunner.java

Author: simonetripodi
Date: Mon Aug 20 09:56:55 2012
New Revision: 1374960

URL: http://svn.apache.org/viewvc?rev=1374960&view=rev
Log:
[DBUTILS-98] Add missing JavaDoc to QueryRunner#insert - patch submitted by Moandji Ezana

Modified:
    commons/proper/dbutils/trunk/src/changes/changes.xml
    commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java

Modified: commons/proper/dbutils/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/changes/changes.xml?rev=1374960&r1=1374959&r2=1374960&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/changes/changes.xml (original)
+++ commons/proper/dbutils/trunk/src/changes/changes.xml Mon Aug 20 09:56:55 2012
@@ -44,6 +44,9 @@ The <action> type attribute can be add,u
   </properties>
   <body>
     <release version="1.6" date="201?-??-??" description="Bugfixes and addition of insert methods">
+      <action dev="simonetripodi" due-to="Moandji Ezana" type="add" issue="DBUTILS-98">
+        Add missing JavaDoc to QueryRunner#insert
+      </action>
       <action dev="wspeirs" due-to="Moandji Ezana" type="add" issue="DBUTILS-87">
         Added insert methods to QueryRunner and AsyncQueryRunner that return the generated key.
       </action>

Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java?rev=1374960&r1=1374959&r2=1374960&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/QueryRunner.java Mon Aug 20 09:56:55 2012
@@ -501,12 +501,15 @@ public class QueryRunner extends Abstrac
     }
 
     /**
-     * TODO fill me!
-     *
-     * @param sql
-     * @param rsh
-     * @return
-     * @throws SQLException
+     * Executes the given INSERT SQL without any replacement parameters.
+     * The <code>Connection</code> is retrieved from the
+     * <code>DataSource</code> set in the constructor.
+     * @param <T> The type of object that the handler returns
+     * @param sql The SQL statement to execute.
+     * @param rsh The handler used to create the result object from
+     * the <code>ResultSet</code> of auto-generated keys.
+     * @return An object generated by the handler.
+     * @throws SQLException if a database access error occurs
      * @since 1.6
      */
     public <T> T insert(String sql, ResultSetHandler<T> rsh) throws SQLException {
@@ -514,13 +517,17 @@ public class QueryRunner extends Abstrac
     }
 
     /**
-     * TODO fill me!
-     *
-     * @param sql
-     * @param rsh
-     * @param params
-     * @return
-     * @throws SQLException
+     * Executes the given INSERT SQL statement. The
+     * <code>Connection</code> is retrieved from the <code>DataSource</code>
+     * set in the constructor.  This <code>Connection</code> must be in
+     * auto-commit mode or the insert will not be saved.
+     * @param <T> The type of object that the handler returns
+     * @param sql The SQL statement to execute.
+     * @param rsh The handler used to create the result object from
+     * the <code>ResultSet</code> of auto-generated keys.
+     * @param params Initializes the PreparedStatement's IN (i.e. '?')
+     * @return An object generated by the handler.
+     * @throws SQLException if a database access error occurs
      * @since 1.6
      */
     public <T> T insert(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
@@ -528,13 +535,14 @@ public class QueryRunner extends Abstrac
     }
 
     /**
-     * TODO fill me!
-     *
-     * @param conn
-     * @param sql
-     * @param rsh
-     * @return
-     * @throws SQLException
+     * Execute an SQL INSERT query without replacement parameters.
+     * @param <T> The type of object that the handler returns
+     * @param conn The connection to use to run the query.
+     * @param sql The SQL to execute.
+     * @param rsh The handler used to create the result object from
+     * the <code>ResultSet</code> of auto-generated keys.
+     * @return An object generated by the handler.
+     * @throws SQLException if a database access error occurs
      * @since 1.6
      */
     public <T> T insert(Connection conn, String sql, ResultSetHandler<T> rsh) throws SQLException {
@@ -542,14 +550,15 @@ public class QueryRunner extends Abstrac
     }
 
     /**
-     * TODO fill me!
-     *
-     * @param conn
-     * @param sql
-     * @param rsh
-     * @param params
-     * @return
-     * @throws SQLException
+     * Execute an SQL INSERT query.
+     * @param <T> The type of object that the handler returns
+     * @param conn The connection to use to run the query.
+     * @param sql The SQL to execute.
+     * @param rsh The handler used to create the result object from
+     * the <code>ResultSet</code> of auto-generated keys.
+     * @param params The query replacement parameters.
+     * @return An object generated by the handler.
+     * @throws SQLException if a database access error occurs
      * @since 1.6
      */
     public <T> T insert(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
@@ -557,15 +566,15 @@ public class QueryRunner extends Abstrac
     }
 
     /**
-     * TODO fill me!
-     *
-     * @param conn
-     * @param closeConn
-     * @param sql
-     * @param rsh
-     * @param params
-     * @return
-     * @throws SQLException
+     * Executes the given INSERT SQL statement.
+     * @param conn The connection to use for the query call.
+     * @param closeConn True if the connection should be closed, false otherwise.
+     * @param sql The SQL statement to execute.
+     * @param rsh The handler used to create the result object from
+     * the <code>ResultSet</code> of auto-generated keys.
+     * @param params The query replacement parameters.
+     * @return An object generated by the handler.
+     * @throws SQLException If there are database or parameter errors.
      * @since 1.6
      */
     private <T> T insert(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {