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 2011/01/18 15:16:45 UTC

[jira] Created: (CAY-1525) CharType: don't trim spaces on the left

CharType: don't trim spaces on the left
---------------------------------------

                 Key: CAY-1525
                 URL: https://issues.apache.org/jira/browse/CAY-1525
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
    Affects Versions: 3.0.1
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 3.1M2


Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 

Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAY-1525) CharType: don't trim spaces on the left

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik updated CAY-1525:
---------------------------------

    Fix Version/s:     (was: 3.1M2)
                   3.1 (final)

> CharType: don't trim spaces on the left
> ---------------------------------------
>
>                 Key: CAY-1525
>                 URL: https://issues.apache.org/jira/browse/CAY-1525
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0.1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1 (final)
>
>
> Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 
> Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAY-1525) CharType: don't trim spaces on the left

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13013552#comment-13013552 ] 

Andrus Adamchik commented on CAY-1525:
--------------------------------------

Hi Dzmitry,

thanks for the patch. It looks correct to me. Still 2 comments:

1. Can we write some unit tests for CharType.rtrim() as well as at a higher level (DataContext) showing that rtrim() is actually a different behavior from the former trim()?
2. Optimization. This is a performance sensitive method as it is called many many times during SELECT. Maybe we can optimize it a bit for the edge conditions (such as no trailing spaces in a String). Check for example sources of String.trim() method. IMO it is the most efficient implementation of trimming.

> CharType: don't trim spaces on the left
> ---------------------------------------
>
>                 Key: CAY-1525
>                 URL: https://issues.apache.org/jira/browse/CAY-1525
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0.1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1 (final)
>
>         Attachments: cay-1525-patch.txt
>
>
> Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 
> Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAY-1525) CharType: don't trim spaces on the left

Posted by "Dzmitry Kazimirchyk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dzmitry Kazimirchyk updated CAY-1525:
-------------------------------------

    Attachment: cay-1525-patch.txt

Now trimming spaces only on the right. Tested it for a number of dbs with such problem (Oracle, MSSQL, Derby).

> CharType: don't trim spaces on the left
> ---------------------------------------
>
>                 Key: CAY-1525
>                 URL: https://issues.apache.org/jira/browse/CAY-1525
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0.1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1 (final)
>
>         Attachments: cay-1525-patch.txt
>
>
> Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 
> Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CAY-1525) CharType: don't trim spaces on the left

Posted by "Dzmitry Kazimirchyk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dzmitry Kazimirchyk updated CAY-1525:
-------------------------------------

    Attachment: cay-1525-patch.txt

Andrus,
thanks for your comment, it was very useful.
In my new patch I added tests for CharType and DataContext and also optimized my rtrim() method.

> CharType: don't trim spaces on the left
> ---------------------------------------
>
>                 Key: CAY-1525
>                 URL: https://issues.apache.org/jira/browse/CAY-1525
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0.1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1 (final)
>
>         Attachments: cay-1525-patch.txt, cay-1525-patch.txt
>
>
> Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 
> Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (CAY-1525) CharType: don't trim spaces on the left

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-1525.
--------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 3.1 (final))
                   3.1M3

Awesome. I committed the last patch. My only change was to add "deleteTestData" to the unit test to ensure it is not affected by other tests writing to the same table

> CharType: don't trim spaces on the left
> ---------------------------------------
>
>                 Key: CAY-1525
>                 URL: https://issues.apache.org/jira/browse/CAY-1525
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.0.1
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>             Fix For: 3.1M3
>
>         Attachments: cay-1525-patch.txt, cay-1525-patch.txt
>
>
> Trimming policy for reading padded CHAR values should be the same as when search for those same values - "rtrim". Spaces on the left of a String can not be padding, those are the spaces that a user saved deliberately. Currently trimming version of CharType trims both left and right spaces, we need to change that. 
> Here is the thread where this discussion started: http://markmail.org/message/oiq6xbtcc7wcuq4l

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira