You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kjetil Kjernsmo <kj...@kjernsmo.net> on 2002/11/11 20:41:24 UTC

Problems with substitute-value in SQLTransformer

Hi list!

I have problems with the SQLTransformer in a recent 2.1-dev, more 
specifically, I can't get the substitute-value element to work. 

This is a pipeline from my sitemap:
    <map:pipeline>
      <map:match pattern="artikler/*/*">
	<map:generate src="resources/articlessql.xml"/>
	<map:transform type="sql">
	  <map:parameter name="use-connection" value="posttest"/>
	  <map:parameter name="show-nr-of-rows" value="true"/> 
	  <map:parameter name="filename" value="flatjord1"/>
	</map:transform>
        <map:serialize/>	
      </map:match>
    </map:pipeline>


(I later intend to replace the filename with some other value, this is 
simplified to illustrate)

And this is the query bit:
<?xml version="1.0"?>

<document>
  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> 
    <sql:query>
      SELECT * FROM articles WHERE filename='<substitute-value 
sql:name="filename"/>';
    </sql:query>
  </sql:execute-query>
</document>

Well, so the query to be executed is 
SELECT * FROM articles WHERE filename='flatjord1';
and if I write that instead of the substitute-value-element in the query 
element, it works. With the above code, however, the resulting XML-code 
(my default serializer is xml), is minimal and can be seen here:
http://test.skepsis.no:8080/cocoon/skepsis0.1/artikler/historie/flatjord1

But looking in sitemap.log, I see this:
DEBUG   (2002-11-11) 19:50.51:721   [sitemap.transformer.sql] 
(/cocoon/skepsis0.1/artikler/historie/flatjord1) 
Thread-4/AbstractSAXTransformer: END endRecording fragment=<?xml 
version="1.0" encoding="ISO-8859-1"?>

      SELECT * FROM articles WHERE filename='<substitute-value 
xmlns:sql="http://apache.org/cocoon/SQL/2.0" sql:name="filename"/>';

DEBUG   (2002-11-11) 19:50.51:776   [sitemap.transformer.sql] 
(/cocoon/skepsis0.1/artikler/historie/flatjord1) 
Thread-4/AbstractSAXTransformer: END endSerializedXMLRecording xml=
      SELECT * FROM articles WHERE filename='';

DEBUG   (2002-11-11) 19:50.51:778   [sitemap.transformer.sql] 
(/cocoon/skepsis0.1/artikler/historie/flatjord1) 
Thread-4/SQLTransformer: QUERY IS "
      SELECT * FROM articles WHERE filename='';
    "

So, apparently, the value in "filename" is never substituted. Any idea 
what I'm doing wrong? My database is PostgreSQL 7.2.3, but that can't 
have anything to do with it, can it?

I've been looking in the source, and it seems that I should be seeing 
the string "SUBSTITUTE VALUE" in the logs if substitution is happening. 
I've grepped through all the logs without finding that. I guess that's 
a bad sign.... Some threads in the archives have said something about 
escaping quotes, and I find something about that in the code too, but I 
don't understand what it does or if it could have anything to do with 
it either. 

Best,

Kjetil
-- 
Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
kjetil@kjernsmo.net  webmaster@skepsis.no  editor@learn-orienteering.org
Homepage: http://www.kjetil.kjernsmo.net/


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Problems with substitute-value in SQLTransformer

Posted by Kjetil Kjernsmo <kj...@kjernsmo.net>.
On Tuesday 12 November 2002 12:31, Jeremy Quinn wrote:
> On Monday, Nov 11, 2002, at 19:41 Europe/London, Kjetil Kjernsmo 
wrote:
> > I have problems with the SQLTransformer in a recent 2.1-dev, more
> > specifically, I can't get the substitute-value element to work.
>
> Sorry, but this works fine for me in 2.1dev

FWIW, it is also happening with 2.0.3. I installed it on a completely 
different machine, with a different installation of Tomcat too. Still, 
the substitute-value element inserts no value. Suggestions are very 
much welcome.

Cheers,

Kjetil
-- 
Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
kjetil@kjernsmo.net  webmaster@skepsis.no  editor@learn-orienteering.org
Homepage: http://www.kjetil.kjernsmo.net/


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Problems with substitute-value in SQLTransformer

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Monday, Nov 11, 2002, at 19:41 Europe/London, Kjetil Kjernsmo wrote:

> I have problems with the SQLTransformer in a recent 2.1-dev, more
> specifically, I can't get the substitute-value element to work.
>

Sorry, but this works fine for me in 2.1dev

(I have different problems ;)

regards Jeremy


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>