cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: MS-Access and ColumnFormatter issues
Date Thu, 03 Feb 2000 07:31:25 GMT
On Wed, 2 Feb 2000, Interesse Michelangelo wrote:

> I've just joined this list, so I'm sorry if some of tthe following issues
> have already been taken into account.

They've been brought up but not dealt with yet :(.

> I'm running Cocoon 1.6 on Tomcat 1.6 and against MS-Access (JDBC-ODBC
> bridge) on a Windows computer.
> 
> 1) I ran the SQL example on my DB
> 	<page>
> 	 <connectiondefs>
> 	  <connection name="foo_connection">
> 	   <driver>sun.jdbc.odbc.JdbcOdbcDriver</driver>
> 	   <dburl>jdbc:odbc:Pres2000</dburl>
> 	   <username></username>
> 	   <password></password>
> 	  </connection>
> 	 </connectiondefs> 
> 	 
> 	 <query connection="foo_connection">
> 	  <!-- select Cognome,Nome from QARisorse order by Cognome -->
> 		select * from QARisorse ;
> 	 </query>
>  	</page>
> 
>    and I was astonished to get the resul message NO DATA FOUND (the table
> QARisorse was full).
> 
>    So I walked through the Cocoon code and I found the key of the mistery in
> the "ColumnFormatter" class.
>    In the method "addColumnNode", in fact, the resutset object "rs" is
> queried a second time for the element at the same position (the first time
> it is queried in the SQLProcessor class). May be
> sun.jdbc.odbc.JdbcOdbcDriver doesn't like this. I wrote a dirthy workaround
> (for immediate use), overloading the "addColumnNode" method with one more
> parameter: the value of the column, already queried through the
> rs.getString() in the  calling class. This work fine for my needs, but is
> there someone that would take care of the issue for the final fix?
>
>   The overloaded method I wrote is:
> 	protected void addColumnNode(Document document, Element parent,
> Column column, ResultSet rs, int i, String v) throws SQLException {
> 		String format = getFormat(column);
> 		String value = v;
> 		if (format != null) {
> 		... same handling ... or perhaps better ....
> 		}
> 		parent.appendChild(document.createTextNode(value));
> 	}

Send me a context diff patch and I'll go ahead and include it in the
processor. I've rewritten SQLProcessor as an XSP taglib and am reworking
the syntax; I have some issues left to resolve with the way cocoon
associates XSP namespaces with XSP logicsheets, but I'm working on that.

I'm very likely going to drop column formatting stuff from SQL's taglib.
It has been argued, and I believe I concur, that that functionality is
best left to XSLT extension functions. The transformations typically
desired (from one datetime format to another, from one string to another
with simple search and replace) are fairly general and shouldn't be
confined to a database access library.

One question I've got for you - I was also under the impression that
calling rs.getString(i) on a numeric column could cause problems when
using Access via the JDBC-ODBC bridge. Is that in fact the case? If so, do
you see a simple patch to clean up that behavior?

>   2) about the SQLProcessor class, did somebody  polanned to extend its
> output DOM tree, in order to get an XML document with information like
> metadata out of the result query? Don't you thing this could be helpful when
> processing the XML output document through an XSL document in order to make
> some other processing or style transformation?

If you can come up with some good syntax for configuring this behavior,
I'll very likely add it to the XSP taglib. If you're interested in coding
this behavior, so much the better. Sure, most all of the metadata
information could come in handy at some point or another.

>   3) what's the framework, in Cocoon, to chain more processing starting from
> an XML document and getting, at the other end, an HTML document ?

Simply, just put these PIs in your document:

<?cocoon-process type="xslt"?>
<?xml-stylesheet test="text/xsl" href="foo.xsl"?>

for more complex scenarios, consult the web pages, and/or search through
the mailing list archives for 'sitemap'. better yet, i should repost the
last firm syntax/thoughts proposed for said endeavor.

- donald


Mime
View raw message