Tobias,

I tested the solution on Oracle, but not with NVARCHAR columns.
Personally, I am not aware of the fact that Oracle treats escape characters differently in nvarchar columns than in other columns. If you think that the issue is not resolved, please reopen it (or open a new one) and describe how one can reproduce the erroneous behaviour.

   Thanks,

      Thomas

On Wed, 29 Nov 2006, Tobias Hilka wrote:

Hello everyone,

We are having some problems with your solution. We are using Oracle 9 and
our columns are of type NVACHAR2 and with this type the escape character
should be

N'\'

instead of the excape character in your solution

'\'

Did you test your solution for NVARCHAR2 columns and is there a
fix/workaround for us?

Best regards,

Tobias.

-----Urspr?ngliche Nachricht-----
Von: Thomas Vandahl (JIRA) [mailto:[EMAIL PROTECTED]
Gesendet: Sonntag, 26. November 2006 19:26
An: [email protected]
Betreff: [jira] Closed: (TORQUE-57) escapeText() method in DBOracle returns
false but escape characters are required in Oracle in certain cases

    [ http://issues.apache.org/jira/browse/TORQUE-57?page=all ]

Thomas Vandahl closed TORQUE-57.
--------------------------------


escapeText() method in DBOracle returns false but escape characters
are required in Oracle in certain cases
----------------------------------------------------------------------
-------------------------------------

                Key: TORQUE-57
                URL: http://issues.apache.org/jira/browse/TORQUE-57
            Project: Torque
         Issue Type: Bug
         Components: Runtime
   Affects Versions: 3.2
        Environment: All OS, All hardware, Oracle Data base
           Reporter: parthasarathy
        Assigned To: Thomas Fischer
           Priority: Minor
            Fix For: 3.3


Oracle uses escape characters for interpreting certain special
characters like "_" literally. However the escapeText() method in
org.apache.torque.adapter.DBOracle class returns false. The value returned
by this method is used by the SqlExpression.quoteAndEscape method. As the
escapeText method returns false a where clause condition: like 'abc\_%' will
get translated to: like 'abc\%' (note the missing "_") in the
SQLExpression.buildLike method. Sybase and SQL Server also has the same
Escape behavior but the escapeText() method in DBSybase and DBMSSQL returns
true.
Below is a copy of the source code in DBOracle.
    /**
     * This method is for the SqlExpression.quoteAndEscape rules.  The
rule is,
     * any string in a SqlExpression with a BACKSLASH will either be
changed to
     * "\\" or left as "\".  SapDB does not need the escape character.
     *
     * @return false.
     */
    public boolean escapeText()
    {
        return false;
    }
The usecase I am trying out is one where a column in the table queried has
values 'abc' and    'a_c'. I need to query the record that has the column
value as 'a_c'. If I issue a query without escapecharacters (where <column>
like 'a_%' ) both the rows are returned. I need to  provide a where clause
with the condition as <column> like 'a\_%' to get the correct record (also
need to add ESCAPE keyword to the query). However, because escapeText
returns false, the criteria value gets built wrongly in the buildLike method
of SQLExpression class.. (the method returns 'a\%'). If escapeText returns
true this problem will be solved (ESCAPE keyword addition needs to be
tackled separately also).
information regarding escape characters in Oracle
http://www.dba-oracle.com/tips_oracle_escape_characters.htm

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to