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
[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>