cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Non-select queries yielding wrong resultsets
Date Sat, 05 Nov 2005 19:14:32 GMT
Hello Gerard,
First of all, besides the SELECT, also DELETE and UPDATE and INSERT stuff works fine. Indeed,
SHOW tables, DESCRIBE klant seems to return strange field names, though I think the query
is executed just fine. Think you should take a look and debug a little in the SQLtransformer,
I think it is in piece of code below somewhere...

            if (!query_failure) {
                if (this.showNrOfRows) {
                    attr.addAttribute(NAMESPACE, query.nr_of_rows, query.nr_of_rows, "CDATA",
String.valueOf						(query.getNrOfRows()));
                }
                String name = query.getName();
                if (name != null) {
                    attr.addAttribute(NAMESPACE, query.name_attribute, query.name_attribute,
"CDATA", name);
                }
                this.start(query.rowset_name, attr);
                attr = new AttributesImpl();
                if (!query.isStoredProcedure()) {
                    while (query.next()) {
                        this.start(query.row_name, attr);
                        query.serializeRow(this.manager);
                        if (index + 1 < queries.size()) {
                        executeQuery(index + 1);
                        }
                        this.end(query.row_name);
                    }
                } else {
                    query.serializeStoredProcedure(this.manager);
                }
                this.end(query.rowset_name);
            }

AS

> 
> 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
> 
> 

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


Mime
View raw message