You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Thorbjoern Ravn Andersen <st...@unixsnedkeren.dk> on 2000/02/16 02:13:54 UTC

How can I use brackets in SQLProcessor?

I have the following code:

 
 <query connection="foo_connection" tag-case="lower" row-element="tr"
doc-element="table">
<!-- select id, owner, filename, size, MIME from items -->
  select count(*) from items
 </query>


(with an appropriate call to jdbc on top - this works)

This returns 

[cactus@asserballe src]$ lynx -dump localhost/~cactus/d2.xml
<?xml version="1.0" encoding="UTF-8"?>
<page>

  
 
 <sqlerror message="INVALID_CHARACTER_ERR"/>
 
</page>



where I get the documented behaviour if I specify some comma-seperated
fields.  "select * from items" fails with 

<?xml version="1.0" encoding="UTF-8"?>
<page>

  
 
 <sqlerror message="Error during query: Unexpected Exception:
java.lang.ArrayIndexOutOfBoundsException message given: 150664"/>
 
</page>

(which might be due to a large blob in there).

The question for me is now.  I would like to have parentesis in my query
(to get the length of the blobs), but I am not so familiar with XML,
Cocoon,  JDBC and SQLProcessor, so I would appreciate a hint for how to
do it roperly.  Should they be escaped?  Is this an XML issue?   

Could a kind sole please tell me how to do this right with this exciting
technology?

Best regards

-- 
  Thorbjørn Ravn Andersen               "...plus...Tubular Bells!"
  http://www.mip.sdu.dk/~ravn

Re: How can I use brackets in SQLProcessor?

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 16 Feb 2000, Thorbjoern Ravn Andersen wrote:

> I have the following code:
> 
>  
>  <query connection="foo_connection" tag-case="lower" row-element="tr"
> doc-element="table">
> <!-- select id, owner, filename, size, MIME from items -->
>   select count(*) from items
>  </query>

Try using "select count(*) as item_count from items" instead. It may help.
Otherwise turn on stacktrace error reporting and send me a copy of the
stacktrace.

> where I get the documented behaviour if I specify some comma-seperated
> fields.  "select * from items" fails with 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <page>
> 
>   
>  
>  <sqlerror message="Error during query: Unexpected Exception:
> java.lang.ArrayIndexOutOfBoundsException message given: 150664"/>
>  
> </page>
> 
> (which might be due to a large blob in there).

Probably due to the blob. SQLProcessor tries to spit out Strings for
just about everything it encounters, and blobs may not play nicely there.

> The question for me is now.  I would like to have parentesis in my query
> (to get the length of the blobs), but I am not so familiar with XML,
> Cocoon,  JDBC and SQLProcessor, so I would appreciate a hint for how to
> do it roperly.  Should they be escaped?  Is this an XML issue?   

It should be unnecessary to escape your parentheses. Generally, you only
must escape <>'"&.

- donald