You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gerard <g....@inter.nl.net> on 2005/11/05 16:04:49 UTC

Non-select queries yielding wrong resultsets

Hello all,

I've been struggling with this problem for 2 days now, searched half the web
and couldn't find any solution, so I pose my question here.

I have the following entry in my sitemap;

====
<map:match pattern="content/data-entry">
  <map:generate src="data-entry.xml" />

  <map:transform type="sql">
    <map:parameter name="use-connection" value="swa02datasource" />
  </map:transform>

  <map:serialize type="xml" content-type="text/xml" />
</map:match>
====

data-entry.xml looks like this;

====
<?xml version="1.0"?>
<document>
  <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
    <sql:query>DESCRIBE klant</sql:query>
  </sql:execute-query>
</document>
====

The query DESCRIBE klant, when executed in MySQL directly, gives me a
description of the table that looks like this;

====
+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| KLANT_ID   | int(10) unsigned |      | PRI | NULL    | auto_increment |
| KLANT_NAAM | varchar(50)      |      | UNI |         |                |
+------------+------------------+------+-----+---------+----------------+
====

When executed in Cocoon, however, it generates the following XML:

====
<?xml version="1.0" encoding="ISO-8859-1" ?>
<document>
  <rowset xmlns:sql="http://apache.org/cocoon/SQL/2.0"
xmlns="http://apache.org/cocoon/SQL/2.0">
    <row>
      <returncode>-1</returncode>
    </row>
    <row>
      <returncode>-1</returncode>
    </row>
  </rowset>
</document>
====

The NUMBER of rows is correct, but where are the fields? It seems that only
queries that
start with SELECT are actually processed as queries that return fields. I
encountered
similar problems with SHOW TABLES and SHOW DATABASES; the number of rows is
correct, but
they all say nothing more than <returncode>-1</returncode>.
Is this a Cocoon limitation or a Java limitation? And how can I solve it? I
would like
to have the proper fields in non-Select queries as well...

Thanks,
- Gerard


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org