cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henning von Bargen <H.vonBar...@Triestram-Partner.de>
Subject AW: sql tag-library
Date Tue, 09 May 2000 06:59:27 GMT
Good ideas, Donald!
Only the xinclude/xptr syntax looks a bit ugly.

Henning

> -----Urspr√ľngliche Nachricht-----
> Von:	Donald Ball [SMTP:balld@webslingerZ.com]
> Gesendet am:	Montag, 8. Mai 2000 23:49
> An:	cocoon-users@xml.apache.org
> Cc:	Brian P Millett
> Betreff:	Re: sql tag-library
> 
> On Mon, 8 May 2000, Brian P Millett wrote:
> 
> > > I had initially decided that it was silly to provide an inheritance
> > > function specifically for the SQL taglib since a generic XML
inheritance
> > > mechanism would be more comprehensive. Unfortunately, no one has
stepped
> > > up to bat to write an XInclude processor for cocoon, nor does Xerces
> > > support it directly, which I'd hoped would be the case sooner or
later. I
> > > agree, writing database connection information repeatedly is foolish;
but
> > > you don't want to write it once in each file, but have to write it in
each
> > > of your files; you want that information stored in _one_ place and
_one_
> > > place only. XInclude gets you that, but the SQLProcessor's inheritance
> > > methods (and Brian's revisitation of them for the SQL taglib) don't.
> > 
> > Interesting.  You mean with the XInclude to create a new tag processor
that
> > say is called <pool> that handles the pool creation, etc.  Then the sql
tag
> > would then just be modifued to use a connection in the
<sql:execute-query
> > poolname="foo">??  Or do you need to explain better to me.
> 
> Even simpler. A fully qualified SQL, uh, paragraph looks like this:
> 
> <execute-query xmlns="http://www.apache.org/1999/SQL">
>  <driver>org.gjt.mm.mysql.Driver</driver>
>  <dburl>jdbc:mysql://localhost/test</dburl>
>  <query>select * from employee_table</query>
> </execute-query>
> 
> Now, driver and dburl (and probably other things as well) are likely to be
> shared amongst multiple queries, both on the given page and on other
> pages. So what we could do is write them in a master database.xml file:
> 
> <defs>
> <database name="test" xmlns="http://www.apache.org/1999/SQL">
>  <driver>org.gjt.mm.mysql.Driver</driver>
>  <dburl>jdbc:mysql://localhost/test</dburl>
> </database> 
> </defs>
> 
> and include the appropriate section in the SQL queries like so:
> 
> <execute-query xmlns="http://www.apache.org/1999/SQL">
>  <xinclude:include
>   href="/protected/database.xml#xptr(/defs/database[@name='test']/*)"/>
>  <query>select * from employee_table</query>
> </execute-query>
> 
> Note this doesn't address connection pooling. For pooling across multiple
> queries on the same page, we could simply make our taglib more
> intelligent, in that it would reuse existing connections if it came across
> another reference to the same database on the same page. Persisting across
> multiple pages is a little trickier, but we could just add another element
> to the execute-query block:
> 
> <execute-query xmlns="http://www.apache.org/1999/SQL">
>  <driver>org.gjt.mm.mysql.Driver</driver>
>  <dburl>jdbc:mysql://localhost/test</dburl>
>  <persist>true</persist>
>  <query>select * from employee_table</query>
> </execute-query>
> 
> that would indicate to the taglib that the connection should be retrieved
> from a pool if possible, and stored in a pool if it's not already there.
> Note this addition is completely independent of the inclusion mechanism;
> it would be entirely possible to pool connections that aren't included
> from a central data source but are manually written in each of the various
> query tags.
> 
> Comments?
> 
> - donald
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message