|
You need to pass a parameter to the match, with the
name of the query you want:
eg.
<map:match pattern="query">
<map:generate src=""/> <map:transform src=""> <map:parameter name="use-request-parameters" value="true"/> </map:transform>
<map:transform type="sql">
<map:parameter name="use-connection" value="oracle-pool"/> <map:parameter name="show-nr-of-rows" value="true"/> </map:transform> ... Then call the pipeline with:
query?name=foo
And, in the "sql-select.xsl" transformation, trap the "name" param
and use an xpath _expression_ to get to the query node you want.
HTH
Derek
>>> [EMAIL PROTECTED] 2006/01/23 02:01 PM >>> Ok, that -----Ursprüngliche Nachricht----- That's exactly what I want to do but how can I express it in my sitemap? My configuration is like this: <map:generate type="file" src=""/> <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. Cheers, Pete Von: Ard Schrijvers [mailto:[EMAIL PROTECTED] Gesendet: Montag, 23. Januar 2006 12:13 An: [email protected] 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:[EMAIL PROTECTED] > Gesendet: Montag, 23. Januar 2006 10:10 > An: [email protected] > 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 > > > > >>> [EMAIL PROTECTED] 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > -- > > 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 > > [EMAIL PROTECTED] . > > > > > > This message has been scanned for viruses and dangerous > > content by MailScanner, > > and is believed to be clean. > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 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 CSIR Copyright, Terms and Conditions 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 CSIR HelpDesk
|
