cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: SQLTransf. How to arrange multiple queries?
Date Mon, 23 Jan 2006 13:01:38 GMT


> My configuration is like this:
> 
> <map:generate type="file" src="sql.xml"/>
>   <map:transform type="sql">
>     <map:parameter name="use-connection" value="oracle-pool"/>
>     <map:parameter name="show-nr-of-rows" value="true"/>
> </map:transform>
> 
> I can't tell the transformer which query to execute. 

it queries both ofcourse!

> 
> Cheers,
> Pete
> 
> 
> Von: Ard Schrijvers [mailto:a.schrijvers@hippo.nl] 
> Gesendet: Montag, 23. Januar 2006 12:13
> An: users@cocoon.apache.org
> Betreff: RE: SQLTransf. How to arrange multiple queries?
> 
> 
> > 
> > 
> > Hi,
> > 
> > this is what I wanted to say  with "at some different time". 
> > The queries are
> > not related to each other. They will be called independently. :o/
> > So there is only the xslt approach? 
> 
> No, you can just do :
> 
> <page>
> 	<sql:execute-query>
> 		<sql:query name="somequery">
> 			......
> 		</sql:query>
> 	</sql:execute-query>
> 	<sql:execute-query>
> 		<sql:query name="someotherquery">
> 			......
> 		</sql:query>
> 	</sql:execute-query>
> </page>
> 
> Now you have two independant queries
> 
> AS
> 
> > 
> > Cheers,
> > 
> > Pete 
> > 
> > -----Urspr√ľngliche Nachricht-----
> > Von: Ard Schrijvers [mailto:a.schrijvers@hippo.nl] 
> > Gesendet: Montag, 23. Januar 2006 10:10
> > An: users@cocoon.apache.org
> > Betreff: RE: SQLTransf. How to arrange multiple queries?
> > 
> > You can do just multipe sql:execute-query. If the second is 
> > depending on the
> > first one, you can use <sql:ancestor-value>
> > 
> > Below an example of 2 main sql:execute-query where the first 
> > one has some
> > child queries depending on the previous one
> > 
> >    <sql:execute-query>
> >      <sql:query name="max_poll">
> >           select MAX(p.id) as id from polls as p where 
> > p.active = 1 group by
> > p.active;
> >      </sql:query>  
> > 	     <sql:execute-query>
> > 	      <sql:query name="poll">
> > 	        select p2.id, p2.question, p2.description, 
> > p2.active from
> > polls as p2  where p2.id = <sql:ancestor-
> > value sql:level="1" sql:name="id"/>;
> > 		  </sql:query> 
> > 		     <sql:execute-query>
> > 		      <sql:query name="choices">
> > 		           select id,answer,votes from pollresult where
> > poll_id = <sql:ancestor-value sql:level="2"
> > sql:name="id"/>;
> > 		      </sql:query>     
> > 		     </sql:execute-query> 
> > 	         
> > 	     </sql:execute-query>
> >      		
> >        
> >     </sql:execute-query>   
> >     <sql:execute-query>
> >     	 <sql:query name="max_poll2">
> >           select MAX(p.id) as id from polls as p where 
> > p.active = 1 group by
> > p.active;
> >     	 </sql:query> 
> >     	 <sql:execute-query>
> > 	      <sql:query name="voted_polls">
> > 	        select voted_polls.id AS idvoted from voted_polls  where
> > voted_polls.poll_id = <sql:ancestor-value
> > sql:level="1" sql:name="id"/> and voted_polls.employee_id =
> > <sql:substitute-value
> > sql:name="currentUserId"/>;
> > 		  </sql:query> 
> > 		  </sql:execute-query>
> >     </sql:execute-query>
> > 
> > AS
> > 
> > > 
> > > 
> > > pete
> > >  
> > > depends what you mean by "at some different time"?
> > > one way would be to pre-process this file via an 
> > > XSLT stylesheet - pass in a parameter corresponding
> > > to the SQL you want to run and extract just the <query>
> > > you need, and then pass the output through to the SQL 
> > > transformer.
> > > 
> > > hth
> > > derek
> > > 
> > > >>> peter.neu@gmx.net 2006/01/23 10:33 AM >>>
> > > Hello,
> > > 
> > > I would like to to put multiple sql queries into the sql.xml 
> > > file like this:
> > > 
> > > 
> > > <execute-query name="users" 
> > xmlns="http://apache.org/cocoon/SQL/2.0" >
> > > 
> > > <!-- Query this in step 1 -->
> > > <query name="users">
> > > SELECT * FROM USERS
> > > </query>
> > > 
> > > <!-- Query this in step n -->
> > > <query name="hobby">
> > > SELECT * FROM Hobby
> > > </query>
> > > </execute-query>
> > > 
> > > These 2 queries are not queried at the same step but each at 
> > > some different
> > > time. 
> > > 
> > > Normally I would have to write them into separate files but I 
> > > want to have
> > > them in the same document so I don't have have say twenty 
> > > sql.xml documents
> > > containing each one sql statement. 
> > > 
> > > How can I do this?
> > > 
> > > Cheers,
> > > Pete
> > > 
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> > > For additional commands, e-mail: users-help@cocoon.apache.org 
> > > 
> > > 
> > > 
> > > 
> > > -- 
> > > This message is subject to the CSIR's copyright, terms and 
> > > conditions and
> > > e-mail legal notice. Views expressed herein do not 
> > > necessarily represent the
> > > views of the CSIR.
> > >  
> > > CSIR E-mail Legal Notice
> > > http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
> > >  
> > > CSIR Copyright, Terms and Conditions
> > > http://mail.csir.co.za/CSIR_Copyright.html 
> > >  
> > > For electronic copies of the CSIR Copyright, Terms and 
> > > Conditions and the CSIR
> > > Legal Notice send a blank message with REQUEST LEGAL in the 
> > > subject line to
> > > HelpDesk@csir.co.za.
> > > 
> > > 
> > > This message has been scanned for viruses and dangerous 
> > > content by MailScanner, 
> > > and is believed to be clean.
> > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > > 
> > > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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


Mime
View raw message