You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Mark S. Kent" <ma...@vistyx.com> on 2001/10/15 15:53:15 UTC

C1: ESQL handling single apostrophes

Greetings all.

I sent this message out in late September and received replies from Vadim
and Alfredas, but neither of them solved the problem.

I've revised the message slightly to show my current attempts.  Any help or
suggestions would be greatly appreciated.

Mark

REPLY 2:
-------------------------------------------------> Just guessing:
> Try
> "and some_date &lt; 'today'"
> :)
>
> Vadim

REPLY 1:
-------------------------------------------------
> the single quotes is not (should not be) the problem.
> try putting the statement directly into <esql:query>...</> instead of
> the <xsp:expr>string - see if it works. just quessing but the problem
> might be there...
>
> Alfredas

ORIGINAL MESSAGE:
-------------------------------------------------
I have an XSP created string that I am passing to ESQL to create a dynamic
SQL string.  It worked fine until I added: "and some_date = 'today'" to the
WHERE clause (InterBase 6.0 format for the 'today' value).

I've tried this:
<page>
    <xsp:logic>
        String dynSQL = "select foo from bar where some_date = 'today' ";
    </xsp:logic>

    <esql:connection>
        <esql:pool>default</esql:pool>
        <esql:execute-query>
            <esql:query><xsp:expr>dynSQL</xsp:expr></esql:query>
            <esql:results>
                <esql:row-results>
                    <foodata><esql:get-string column="foo"/></foodata>
                </esql:row-results>
            </esql:results>
            </esql:query>
        </esql:execute-query>
    </esql:connection>
</page>

Other previous postings that others have used had something like this:
        String dynSQL = "select foo from bar where some_date = '" +
todayString + "' ";

but that's not working for me either...

Mark

REVISED MESSAGE (puting text directly in esql:query section):
-------------------------------------------------
I have an XSP created string that I am passing to ESQL to create a dynamic
SQL string.  It worked fine until I added: "and some_date = 'today'" to the
WHERE clause (InterBase 6.0 format for the 'today' value).

I've now tried this:
<page>
    <esql:connection>
        <esql:pool>default</esql:pool>
        <esql:execute-query>
            <esql:query>select foo from bar where some_date =
'today'</esql:query>
            <esql:results>
                <esql:row-results>
                    <foodata><esql:get-string column="foo"/></foodata>
                </esql:row-results>
            </esql:results>
            </esql:query>
        </esql:execute-query>
    </esql:connection>
</page>

I've also tried the esql:query line with:

           <esql:query>select foo from bar where some_date =
&apos;today&apos;</esql:query>

with no luck.

Thanks!


---------------------------------------------------------------------
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: C1: ESQL handling single apostrophes

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 15.Oct.2001 -- 08:53 AM, Mark S. Kent wrote:
>         String dynSQL = "select foo from bar where some_date = 'today' ";

I don't know about your DBMS. However, the one I use has "today" as a
special constant. Thus the SQL would be 

	select foo from bar where some_date = today

Note that no quotes are present.

If you were to enter this statement in an interactive SQL shell, would
you need to enter it with or without quotes around "today" ?

It would be helpful if you could include any error messages that
occurs and describe what happens and what is expected to happen.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


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