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 esql stored procedure support
Date Wed, 30 Jan 2002 10:10:15 GMT
Peter, Kosh,

I've got a new iteration of the stored procedure support for
esql. (Kosh, I will mail you the necessary files separately because
you indicated that you have problems with CVS).

Bob, I've CC'ed you since you might be interested to try the
<esql:results from-column=""/> feature.


Since the next release is due in a couple of days I don't want to
commit these changes right now unless I hear success stories from
you. The DBMS I use on a regulary basis does not support most of
what's in this patch so I rely on you to send bug reports (and
fixes!). Diff is against today's CVS HEAD as usual.

The attributes to <esql:call/> have been renamed to be a bit more
XMLish (needsQuery -> needs-query, resultsetFromObject ->
resultset-from-object) 

* use <esql:call/> instead of <esql:query/>, for stored procedures,
  use either DBMS specific syntax or JDBC escape syntax "{? = foo(?)}"

* if driver requires to use the "executeQuery()" method instead of
  the "execute()" method (like e.g. INFORMIX does), set
  'needs-query="true"' attribute to <esql:call/>

* if a result set is returned through the (only) return parameter of
  a stored procedure, one can use e.g. 'resultset-from-object="1"' as
  attribute to <esql:call/> to automatically use this result set. For
  a more general alternative see further below.

* <esql:call-results/> (child of <esql:execute-query/>) may contain
  code that will always be executed whether the call returned a
  resultset or not.

* all <esql:get-xxx/> tags accept new attribute 'from-call="yes"' to
  indicate that the value is retrieved from the CallableStatement
  rather than the current ResultSet.

* Retrieve a ResultSet from any column and use it like the result of a
  nested query by e.g. <esql:results from-column="1"/>. Of course the
  column needs to return a result that is castable to ResultSet.


Example:

              <esql:call>{? = foo(<esql:parameter><xsp:expr>1</xsp:expr></esql:parameter>)}</esql:call>
              <esql:call-results>
                 <esql:results from-column="1" from-call="true">
                      <esql:row-results>
                         <esql:get-string column="1"/>
                      </esql:row-results>
                 </esql:results>
              </esql:call-results>

Disclaimer:
I have only tested a fraction of these modifications as the DBMS I use
does not support the other variants. I have, however, tried to ensure
that the resulting code compiles well. Please try this code and report
failures (preferably with fixes :-) and successes to me and cocoon-dev

	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

Mime
View raw message