You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2014/02/08 13:43:19 UTC

[jira] [Commented] (CAY-1470) Oracle: Problem with bind CHAR in select

    [ https://issues.apache.org/jira/browse/CAY-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13895545#comment-13895545 ] 

Andrus Adamchik commented on CAY-1470:
--------------------------------------

I will remove a unit test that we happened to have in the code and that was testing this issue. Until the issue is fixed, we shouldn't keep a failing test.

-    public void testBindCHARInWHERE() {
-        // add 2 Artists
-        DataMap testDataMap = context.getEntityResolver().getDataMap("testmap");
-        SQLTemplate q1 = new SQLTemplate(
-                testDataMap,
-                "INSERT INTO ARTIST VALUES (1, 'Surikov', null)",
-                true);
-        SQLTemplate q2 = new SQLTemplate(
-                testDataMap,
-                "INSERT INTO ARTIST VALUES (2, 'Shishkin', null)",
-                true);
-        QueryChain chain = new QueryChain();
-        chain.addQuery(q1);
-        chain.addQuery(q2);
-        context.performNonSelectingQuery(chain);
-        // now select one Artist by Name, It's matter that ARTIST_NAME is CHAR not VARCHAR
-        SQLTemplate s1 = new SQLTemplate(
-                testDataMap,
-                "SELECT * FROM ARTIST WHERE ARTIST_NAME = #bind($ARTIST_NAME)",
-                true);
-        // whitespace after name is for reason
-        s1.setParameters(Collections.singletonMap("ARTIST_NAME", "Surikov "));
-        List<DataRow> result = context.performQuery(s1);
-        assertEquals(1, result.size());
-    }


> Oracle: Problem with bind CHAR in select
> ----------------------------------------
>
>                 Key: CAY-1470
>                 URL: https://issues.apache.org/jira/browse/CAY-1470
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 2.0 branch, 3.0
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>            Priority: Critical
>              Labels: 3.1-review
>             Fix For: 2.0.5, 3.1 (final)
>
>         Attachments: CAY-1470-Test.patch, CAY-1470.patch, CAY-1470.patch, CAY-1470.patch
>
>
> I have Table tUser
> desc tUser
> Name                           Null                Type                                                                                                                                                                                          
> ------------------------------ -------- 
> USERID                         NOT NULL NUMBER(15)                                                                                                                                                                                    
> BRIEF                             NOT NULL CHAR(30)   
> And wish to find user with BRIEF 'credit' :
> INFO  QueryLogger: Detected and installed adapter: org.apache.cayenne.dba.oracle.OracleAdapter
> INFO  QueryLogger: SELECT * FROM tUser WHERE Brief = ? [bind: 'credit']
> INFO  QueryLogger: === returned 0 rows. - took 125 ms.
> But if I try whitespaces at the end I would get:
> INFO  QueryLogger: SELECT * FROM tUser WHERE Brief = ? [bind: 'credit                        ']
> INFO  QueryLogger: === returned 1 row. - took 109 ms.
> It's absolutely not CROSS DB behavior!



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)