jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hor...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql QueryTagSupport.java UpdateTagSupport.java
Date Thu, 10 Oct 2002 18:20:57 GMT
horwat      2002/10/10 11:20:57

  Modified:    standard/src/org/apache/taglibs/standard/tag/common/sql
                        QueryTagSupport.java UpdateTagSupport.java
  Log:
  In order for setNull to be used properly it would need to have the right column type.
  
  According to JDBC 3.0 section 13.2.2.3, a null can be passed to the PreparedStatement.setObject()
and the parameter will be set to JDBC NULL properly so the PreparedStatment.setNull() call
can be removed.
  
  Bugzilla #13405
  
  Revision  Changes    Path
  1.34      +6 -6      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java
  
  Index: QueryTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- QueryTagSupport.java	21 Jun 2002 20:19:33 -0000	1.33
  +++ QueryTagSupport.java	10 Oct 2002 18:20:57 -0000	1.34
  @@ -319,12 +319,12 @@
       {
   	if (parameters != null) {
   	    for (int i = 0; i < parameters.size(); i++) {
  -		// The first parameter has index 1
  -                if (parameters.get(i) != null) {
  -		    ps.setObject(i + 1, parameters.get(i));
  -                } else {
  -                    ps.setNull(i + 1, java.sql.Types.NULL);
  -                }
  +                /* The first parameter has index 1.  If a null
  +                 * is passed to setObject the parameter will be
  +                 * set to JDBC null so an explicit call to
  +                 * ps.setNull is not required.
  +                 */
  +		ps.setObject(i + 1, parameters.get(i));
   	    }
   	}
       }
  
  
  
  1.24      +6 -7      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java
  
  Index: UpdateTagSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- UpdateTagSupport.java	21 Jun 2002 20:19:33 -0000	1.23
  +++ UpdateTagSupport.java	10 Oct 2002 18:20:57 -0000	1.24
  @@ -281,13 +281,12 @@
       {
   	if (parameters != null) {
   	    for (int i = 0; i < parameters.size(); i++) {
  -		// The first parameter has index 1
  -                if (parameters.get(i) != null) {
  -                    ps.setObject(i + 1, parameters.get(i));
  -                } else {
  -                    ps.setNull(i + 1, java.sql.Types.NULL);
  -                }
  -
  +                /* The first parameter has index 1.  If a null
  +                 * is passed to setObject the parameter will be
  +                 * set to JDBC null so an explicit call to
  +                 * ps.setNull is not required.
  +                 */
  +                ps.setObject(i + 1, parameters.get(i));
   	    }
   	}
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message