cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ba...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql XSPSQLLibrary.java
Date Mon, 24 Apr 2000 20:39:25 GMT
balld       00/04/24 13:39:25

  Modified:    src/org/apache/cocoon/processor/xsp/library/sql
                        XSPSQLLibrary.java
  Log:
  Added automatic choosing of execute update v.s. execute query
  Submitted by:	kevin@webslingerZ.com
  
  Revision  Changes    Path
  1.2       +6 -4      xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java
  
  Index: XSPSQLLibrary.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/library/sql/XSPSQLLibrary.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSPSQLLibrary.java	2000/03/15 01:02:47	1.1
  +++ XSPSQLLibrary.java	2000/04/24 20:39:25	1.2
  @@ -60,7 +60,7 @@
    * A processor that performs SQL database queries.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version $Revision: 1.1 $ $Date: 2000/03/15 01:02:47 $
  + * @version $Revision: 1.2 $ $Date: 2000/04/24 20:39:25 $
    */
   
   public class XSPSQLLibrary {
  @@ -150,13 +150,15 @@
           if (!max_rows_attribute.equals("")) {
               results_element.setAttribute(max_rows_attribute,""+max_rows);
           }
  -        if (!update_rows_attribute.equals("")) {
  -            int update_rows = st.executeUpdate(query);
  +        if (!st.execute(query)) {
  +	    	/** this returns the number of rows we updated, or -1 on error **/
  +            int update_rows = st.getUpdateCount();
               if (results_element != null) {
                   results_element.setAttribute(update_rows_attribute,""+update_rows);
               }
           } else {
  -            rs = st.executeQuery(query);
  +	    	/** and this is where we return the rowset instead. **/
  +            rs = st.getResultSet();
               ResultSetMetaData md = rs.getMetaData();
   			if (tag_case.equals("")) {
   				tag_case = "preserve";
  
  
  

Mime
View raw message