Hi Sven,
your code seems fine and the insert should work. Did you try to look in
the cocoon logs? If not, you could try to set the debug level of the sql
transformer to debug.
Kind regards,
Jeroen Reijn
sven goosen wrote:
Hi Jeroen,
Thanks for the hint.
It seems to work when i got a select query.
But when I do the exact same thing, on a insert query. it doesn't seem
to insert the data into the database.
I don't think I need to handle an insert query different, do I?
Here is the relevant sitemap:
<map:match pattern="savedb.jx">
<map:generate src="scripts/savedb.jx" type="jx"></map:generate>
<map:transform type="sql">
<map:parameter name="use-connection"
value="ledenSysDB"></map:parameter>
</map:transform>
<map:serialize type="xml"></map:serialize>
</map:match>
And here is the relevant sql-part of the savedb.jx file:
<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<sql:query name="test">INSERT INTO testTable (value1, value2) VALUES
('test1', 'test2')</sql:query>
</sql:execute-query>
When I paste the query into the mysql client, it inserts the row, so
query is correct.
Also, when I replase the insert with an select, I get data from the db.
I really don't get why it doesn't work..
Sven
Jeroen Reijn schreef:
Hi Sven,
yes this can be done! You should be able to do this by just adding the
SQL transformer behind the jx generator.
Like this:
<map:match pattern="foo.jx">
<map:generate src="scripts/foo.jx" type="jx"/>
<map:transform type="sql">
<map:parameter name="use-connection" value="ledenSysDB"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
Kind regards,
Jeroen Reijn
sven goosen wrote:
Hi,
Once again on my quest to using Cocoon, i have a question.
Can I use the output of a flowscript, in a page that is using the SQL
transformer?
So, can i put a transformer like:
<map:transform type="sql">
<map:parameter name="use-connection" value="ledenSysDB"/>
</map:transform>
In a match like this:
<map:match pattern="foo.jx">
<map:generate src="scripts/foo.jx" type="jx"/>
<map:serialize type="xml"/>
</map:match>
And, can i then use the sql:query, with some vars that i got from a
jx script like this:
<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<sql:query name="test">SELECT * FROM myTable WHERE id =
${id}</sql:query>
</sql:execute-query>
Can this be done? If so, what should be the correct sitemap in my
situation?
Kind regards,
Sven Goosen
---------------------------------------------------------------------
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]