cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java esql.xsl
Date Fri, 28 Jun 2002 09:44:20 GMT
On 28.Jun.2002 -- 11:07 AM, Torsten Curdt wrote:
> <snip/>
> 
> >      Multiple results seem not to be supported by some DBMSs (i.e. Oracle
> > and Informix). Therefore this is made optional in ESQL. A new parameter
> > (esql:allow-multiple-results) to esql:connection re-enables it. See
> > EsqlConnection for details.
> 
> Hm, Christian, I haven't yet looked into the changes but I'd be in favor of 
> keeping the old (IMO correct) behaviour and support _disabling_ it for those 
> special cases...
> 
> What do you think?

In general I'm in favour of exposing the "correct" behaviour and
switching to "work around" only on request. In this case

*) multiple results are only useful with stored procedures

*) "correct" behaviour really breaks ESQL at least on Oracle and
   Informix.
   This makes a bad first impression on Cocoon and ESQL.
   (Oracle enters endless loop for updates since it always returns
    the same updateCount; Informix throws an exception on any ESQL
	since it allows getUpdateCount() only be called once per
	execute() whereas JDBC specs it can be called once after every
	getMoreResults())

*) the correct behaviour was introduced only in CVS and hasn't been
   released yet, so this change will break less installations when the
   next release is due.

It would help to decide this if we knew about other DBMSs. In short:
Check if the following snippet works with your favourite DBMS (provide
request parameters "old" and "new"!!!)

 Good:
   HSQLDB 1.63  : OK (no update count, though)
 Bad:
   Oracle 8.1.5 : endless loop on update, select is OK
   Informix 9.23: both result in exception "Method may only be called once"
 Unknown:
   DB2          :
   Sybase       :
   MS SQL       :
   MySQL        :
   PostgreSQL   :
   Firebird     :
   SAPDB        :
   ...          :   

	  <esql:connection>
		<esql:pool>personnel</esql:pool><!-- change this -->
		<esql:allow-multiple-results>yes</esql:allow-multiple-results>

		<xsp:logic>
		  if (<xsp-request:get-parameter name="old" default=""/>!=""){
			<esql:execute-query>
        	  <esql:query>
	   		    UPDATE department SET name=<esql:parameter type="string"><xsp:expr>new</xsp:expr></esql:parameter>
WHERE name=<esql:parameter><xsp:expr>old</xsp:expr></esql:parameter>
        	   </esql:query>
        	   <esql:update-results>
	   		     <p>Modified <esql:get-update-count/> rows</p>
	    	   </esql:update-results>
        	</esql:execute-query>
          }
        </xsp.logic>

     	<esql:execute-query>
     	  <esql:query>select * from department</esql:query>
     	  <esql:results>
     	    <esql:row-results>
     	      <para><esql:get-string column="name"/></para>
     	      <esql:get-columns/>
     	    </esql:row-results>
     	  </esql:results>
     	</esql:execute-query>
      </esql:connection>

Anyway, changing it back is just changing the default in
EsqlConnection.java and adjusting the docs.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message