Index: src/org/apache/cocoon/transformation/SQLTransformer.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/transformation/SQLTransformer.java,v
retrieving revision 1.5.2.5
diff -u -r1.5.2.5 SQLTransformer.java
--- src/org/apache/cocoon/transformation/SQLTransformer.java	2001/07/10 14:05:00	1.5.2.5
+++ src/org/apache/cocoon/transformation/SQLTransformer.java	2001/08/01 05:39:34
@@ -30,6 +30,9 @@
 import org.apache.avalon.framework.component.ComponentSelector;
 import org.apache.avalon.framework.component.Composable;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.excalibur.datasource.DataSourceComponent;
 import org.apache.avalon.excalibur.pool.Recyclable;
 import org.apache.cocoon.environment.SourceResolver;
@@ -57,7 +60,7 @@
  * @version CVS $Revision: 1.5.2.5 $ $Date: 2001/07/10 14:05:00 $ $Author: dims $
  */
 
-public class SQLTransformer extends AbstractTransformer implements Composable, Recyclable, Disposable {
+public class SQLTransformer extends AbstractTransformer implements Composable, Recyclable, Disposable, Configurable {
 
     /** The SQL namespace **/
     public static final String my_uri = "http://apache.org/cocoon/SQL/2.0";
@@ -122,6 +125,9 @@
     /** Check if nr of rows need to be written out. **/
     protected String showNrOfRows;
 
+    /** Is the old-driver turned on? (default is off) */
+    private boolean oldDriver = false;
+
     protected ComponentSelector dbSelector = null;
     protected ComponentManager manager;
 
@@ -155,7 +161,18 @@
     public void dispose() {
         if(this.dbSelector != null) this.manager.release((Component) this.dbSelector);
     }
-    
+
+    /**
+     * configure
+     */
+    public void configure(Configuration conf)throws ConfigurationException {
+        if (conf != null) {
+            Configuration child = conf.getChild("old-driver");
+            this.oldDriver = child.getValueAsBoolean(false);
+            getLogger().debug("old-driver is " + this.oldDriver + " for " + this);
+        }
+    }
+
     /** BEGIN SitemapComponent methods **/
 
     public void setup(SourceResolver resolver, Map objectModel,
@@ -168,7 +185,7 @@
         this.current_query_index = -1;
         this.default_properties = new Properties();
         this.current_state = SQLTransformer.STATE_OUTSIDE;
-    
+
         this.parameters = parameters;
         this.objectModel = objectModel;
 
@@ -247,7 +264,7 @@
                   if (index + 1 < queries.size()) {
                       executeQuery(index + 1);
                   }
-                  this.end(query.row_name);                             
+                  this.end(query.row_name);
               }
             } else  {
               query.serializeStoredProcedure();
@@ -699,7 +716,7 @@
         protected void setStoredProcedure(boolean flag)  {
             isstoredprocedure = flag;
         }
-        
+
         protected boolean isStoredProcedure()  {
           return isstoredprocedure;
         }
@@ -707,7 +724,7 @@
         protected void setName(String name)  {
           this.name = name;
         }
-        
+
         protected String getName()  {
           return name;
         }
@@ -817,13 +834,21 @@
                     }
                 }
                 if (!isstoredprocedure)  {
-                    pst = conn.prepareStatement(query,
-                                                ResultSet.TYPE_SCROLL_INSENSITIVE, 
-                                                ResultSet.CONCUR_READ_ONLY );
+                    if (oldDriver) {
+                        pst = conn.prepareStatement(query);
+                    } else {
+                        pst = conn.prepareStatement(query,
+                                                    ResultSet.TYPE_SCROLL_INSENSITIVE,
+                                                    ResultSet.CONCUR_READ_ONLY );
+                    }
                 } else  {
-                    cst = conn.prepareCall(query,
-                                           ResultSet.TYPE_SCROLL_INSENSITIVE, 
-                                           ResultSet.CONCUR_READ_ONLY );
+                    if (oldDriver) {
+                        cst = conn.prepareCall(query);
+                    } else {
+                        cst = conn.prepareCall(query,
+                                               ResultSet.TYPE_SCROLL_INSENSITIVE,
+                                               ResultSet.CONCUR_READ_ONLY );
+                    }
                     registerOutParameters(cst);
                     pst = cst;
                 }
@@ -848,9 +873,13 @@
         protected int getNrOfRows() throws SQLException  {
           int nr = 0;
           if (rs!=null) {
-              rs.last();
-              nr = rs.getRow();
-              rs.beforeFirst();
+              if (oldDriver){
+                nr=-1;
+              } else {
+                rs.last();
+                nr = rs.getRow();
+                rs.beforeFirst();
+              }
           } else  {
             if (outParameters!=null)  {
               nr=outParameters.size();
@@ -947,7 +976,7 @@
                         rs.close();
                     }
                     transformer.end((String)outParametersNames.get(counter));
-                }    
+                }
               }catch (SQLException e)  {
                 transformer.getTheLogger().error("Caught a SQLException", e);
                 throw e;
@@ -955,7 +984,7 @@
                 close();
               }
           }
-        
+
         }
     }
 
@@ -968,4 +997,5 @@
             this.name = name;
         }
     }
+
 }

