Hi,
I have to run a set of sql queries where the select clause is identical but everything after the from clause are different. The difference is more than just a matter of query parameters values. For example, some times I need to use a sub query, some time with different order by clause, and etc. Is there a way to pass a pre-constructed sql statement into the sql processor? For example, something like the following: <sql:query> <sq:get-query select="/query"> </sql:query> Here the <sql:get-query> will get the sql query string from input data. Thanks, James -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
It's not ideal, but you can use XSLT to dynamically build a query. We
do this kind of things here for example: https://github.com/orbeon/orbeon-forms/blob/master/src/resources/apps/fr/persistence/oracle/crud.xpl -Erik On Sun, May 29, 2011 at 11:45 AM, James Liang <[hidden email]> wrote: > Hi, > > > I have to run a set of sql queries where the select clause is > identical but everything after the from clause are different. > > The difference is more than just a matter of query parameters values. > For example, some times I need to use a sub query, some time with > different order by clause, and etc. > > Is there a way to pass a pre-constructed sql statement into the sql processor? > > For example, something like the following: > > <sql:query> > <sq:get-query select="/query"> > </sql:query> > > Here the <sql:get-query> will get the sql query string from input data. > > > Thanks, > James > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks Erik. The solution worked beautifully.
The solution is really quite clean when I used embedded transformation within input. I must say the xslt transform facility is really powerful. I also used this method to switch between multiple databases within a single mysql database server (with mysql command "use some_db;") Thanks again, James On Mon, May 30, 2011 at 10:19 PM, Erik Bruchez <[hidden email]> wrote: > It's not ideal, but you can use XSLT to dynamically build a query. We > do this kind of things here for example: > > https://github.com/orbeon/orbeon-forms/blob/master/src/resources/apps/fr/persistence/oracle/crud.xpl > > -Erik > > On Sun, May 29, 2011 at 11:45 AM, James Liang <[hidden email]> wrote: >> Hi, >> >> >> I have to run a set of sql queries where the select clause is >> identical but everything after the from clause are different. >> >> The difference is more than just a matter of query parameters values. >> For example, some times I need to use a sub query, some time with >> different order by clause, and etc. >> >> Is there a way to pass a pre-constructed sql statement into the sql processor? >> >> For example, something like the following: >> >> <sql:query> >> <sq:get-query select="/query"> >> </sql:query> >> >> Here the <sql:get-query> will get the sql query string from input data. >> >> >> Thanks, >> James >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |