You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Wuebbelt <Pe...@Wuebbelt.de> on 2001/02/09 14:26:26 UTC

ESQL and missing values

Dear helpers,

I've got a few problems using esql when I retrieve null-values from my Oracle
database.
I would like to use "get-int" but in case of null values in the database the
value "0" is returned.
Any chance to avoid or modify this behaviour ?

Thanks in advance.

 Peter


Re: Values between Taglibs

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 9 Feb 2001, Andreas Neuenschwander wrote:

> Is it possible to transfer values between different taglibs?

yes. that is _key_. that's what makes logicsheets powerful.

> <esql:row-results>
>     <my_xmlns:id>
>         <esql:getString column="id"/>
>     </my_xmlns:id>
>     <my_xmlns:name>
>         <my_taglib:stringConversion>
>             <esql:getString column="firstname"/>
>         </my_taglib:stringConversion>
>     </my_xmlns:name>
>
> </esql:row-results>
> ...
>
> This won't work. Because the 'get-nested-content' template in the logicsheet
> traverses the xml-tree.
> This way I get the value from the <esql:getString column="firstname"/> tag.

i don't think you quite understand. your logicsheet should use the
get-nested-content method when getting its configuration parameters.
something like this:

<xsl:template match="my_xmlns:root">
  <xsl:variable name="id">
    <xsl:call-template name="get-nested-content">
      <xsl:with-param name="content" select="my_xmlns:id"/>
    </xsl:call-template>
  </xsl:variable>
  ...
</xsl:template>

the id variable should now contain a java expression which will resolve to
the value you desire. note that if your configuration parameters are
composed of mixed static strings and string expressions, you'll want to
use get-nested-string instead.

> If I insert a value in the esql:getString tag i.e:
>
> <esql:getString column="firstname">value</esql:getString column="firstname">
>
> I receive the string 'value'.

that's nonsensical. esql:get-string is strictly a singleton element.

- donald


Values between Taglibs

Posted by Andreas Neuenschwander <an...@andi.ch>.
Hi,

Is it possible to transfer values between different taglibs?

...
<esql:row-results>
    <my_xmlns:id>
        <esql:getString column="id"/>
    </my_xmlns:id>
    <my_xmlns:name>
        <my_taglib:stringConversion>
            <esql:getString column="firstname"/>
        </my_taglib:stringConversion>
    </my_xmlns:name>

</esql:row-results>
...

This won't work. Because the 'get-nested-content' template in the logicsheet
traverses the xml-tree.
This way I get the value from the <esql:getString column="firstname"/> tag.

If I insert a value in the esql:getString tag i.e:

<esql:getString column="firstname">value</esql:getString column="firstname">

I receive the string 'value'.

But I'd like to receive the string from ESQL Logicsheet getString method.

Has anyone the same problem? Is there an easy solution for this case?


./andi





Re: ESQL and missing values

Posted by Arnaud Vandyck <ar...@ressource-toi.org>.
----- Original Message ----- 
From: "Peter Wuebbelt" <Pe...@Wuebbelt.de>
To: <co...@xml.apache.org>
Sent: Friday, February 09, 2001 2:26 PM
Subject: ESQL and missing values


> Dear helpers,
> 
> I've got a few problems using esql when I retrieve null-values from
> my Oracle database.
> I would like to use "get-int" but in case of null values in the
> database the value "0" is returned.
> Any chance to avoid or modify this behaviour ?

Maybe a "get-string" and then test the value, if not null, parse to an int?

-- Arnaud Vandyck
<http://www.ressource-toi.org>



Re: SV: ESQL and missing values

Posted by Allan Erskine <a....@cs.ucl.ac.uk>.
> well, as it is now, i just return whatever resultset.getInt returns. i
> like doing that, i don't want to start second guessing the JDBC driver.

the JDBC driver second guesses the database, so you wouldn't be the first -
it would have been nice if there were complementary methods in JDBC that
returned number wrapper objects, since they could be null as required, but
never mind

an <esql:is-null/> would be nice tho!

> On Fri, 9 Feb 2001, Pal Wester wrote:
>
> > What about java.lang.Integer.MIN_VALUE, hardly
> > ever used....
>
> well, as it is now, i just return whatever resultset.getInt returns. i
> like doing that, i don't want to start second guessing the JDBC driver.
>
> > And one other thing... How about adding
> > a <esql:insert-ok/> and <esql:delete-ok/> ??
>
> you've got esql:update-rows/esql:get-update-count, which will return the
> number of rows modified by an updating sql query - at least on conformant
> JDBC drivers. i believe mysql does _not_ do this properly, sadly.
>
> - donald
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


Re: SV: ESQL and missing values

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 9 Feb 2001, Pal Wester wrote:

> What about java.lang.Integer.MIN_VALUE, hardly
> ever used....

well, as it is now, i just return whatever resultset.getInt returns. i
like doing that, i don't want to start second guessing the JDBC driver.

> And one other thing... How about adding
> a <esql:insert-ok/> and <esql:delete-ok/> ??

you've got esql:update-rows/esql:get-update-count, which will return the
number of rows modified by an updating sql query - at least on conformant
JDBC drivers. i believe mysql does _not_ do this properly, sadly.

- donald


SV: ESQL and missing values

Posted by Pal Wester <pa...@florence.never.no>.
> -----Opprinnelig melding-----
> Fra: Donald Ball [mailto:balld@webslingerZ.com]
> Sendt: 9. februar 2001 19:50
> Til: cocoon-users@xml.apache.org
> Emne: Re: ESQL and missing values
>
>
> On Fri, 9 Feb 2001, Peter Wuebbelt wrote:
>
> > I've got a few problems using esql when I retrieve null-values from my
> > Oracle database. I would like to use "get-int" but in case of null
> > values in the database the value "0" is returned. Any chance to avoid
> > or modify this behaviour ?
>
> what would you prefer to happen in this case? i've been considering adding
> an esql:is-null element so you can query a column's nullness before you
> try to access it, but esql:get-int really doesn't have any alternative
> than to return 0 or some other magic number. i guess that number could be
> configurable...?
>
> - donald
>

What about java.lang.Integer.MIN_VALUE, hardly
ever used....

And one other thing... How about adding
a <esql:insert-ok/> and <esql:delete-ok/> ??

mvh:
Pal Wester, programmerer
never.no as, stortingsgt 30, 0161 Oslo
tlf: 22 01 66 20, fax: 22 01 66 21
direkte: 22 01 66 34, 906 900 62
http://never.no - icq:103476059



Re: ESQL and missing values

Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 9 Feb 2001, Peter Wuebbelt wrote:

> I've got a few problems using esql when I retrieve null-values from my
> Oracle database. I would like to use "get-int" but in case of null
> values in the database the value "0" is returned. Any chance to avoid
> or modify this behaviour ?

what would you prefer to happen in this case? i've been considering adding
an esql:is-null element so you can query a column's nullness before you
try to access it, but esql:get-int really doesn't have any alternative
than to return 0 or some other magic number. i guess that number could be
configurable...?

- donald