You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2008/08/26 16:22:44 UTC

[jira] Created: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Behaviour of setTypeMap() differs between embedded and client
-------------------------------------------------------------

                 Key: DERBY-3853
                 URL: https://issues.apache.org/jira/browse/DERBY-3853
             Project: Derby
          Issue Type: Improvement
          Components: JDBC, Newcomer
    Affects Versions: 10.5.0.0
            Reporter: Knut Anders Hatlen
            Priority: Minor


On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):

  - if the map argument is null, throw an SQLException with SQLState XJ081

  - if the map is not null and not empty, throw an SQLException with SQLState 0A000

  - if the map is not null and empty, do nothing

The behaviour on the client driver is this:

  - always throw an SQLException with SQLState 0A000

We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Commented: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697807#action_12697807 ] 

Knut Anders Hatlen commented on DERBY-3853:
-------------------------------------------

Hi Yun,

Thanks for the new patch! It looks good to me. I'll run some tests and commit it if I don't find any problems.

The reason why I felt it was safer to make the changes on the client driver, was that the changes there would be that things that failed would start working or that they would fail with another error code. If we had made the change on the embedded driver, things that used to work would stop working, which is worse.

But as you said, there are changes on the client side too, so we may consider writing a release note warning users that the error code has changed. Though I'm not sure if we have bothered release noting changes from "0A000 - not implemented" before.

You're right about the inconsistent coding style. There was a vote once where it was decided that the Java coding conventions[1] (with some amendments that I don't remember right now) was the recommended style for new code. It was not decided that the entire code base should be reformatted, so we still have to live with different styles.

[1] http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Updated: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

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

Yun Lee updated DERBY-3853:
---------------------------

    Attachment: DERBY-3853-2.stat
                DERBY-3853-2.patch

Knut, I have provided a new patch with changes:

1.) make the changes on the client driver instead of on EmbedConnection;
2.) remove sqle.getNextException() when invoking assertSQLState();
3.) add fail() at the end of the try block in many places.

However,  I think it's the same safe to make change on EmbedConneciton with on client driver, as whatever, the test data ----EmptyMapValue, NullMapValue and MapMapValue ---- for testAllDataSource() has changed, :).

Wish for your check!

Also, I'm a bit strange to have found the source code of Derby doesn't follow a uniform style, such as '=' accompanied by space characters, and the indent for curly braces. Aren't they?

Yun

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Updated: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-3853:
--------------------------------------

    Attachment: releaseNote.html

Here's an attempt on a release note for this issue.

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat, releaseNote.html
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Closed: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-3853.
-------------------------------------


> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat, releaseNote.html
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Assigned: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

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

Yun Lee reassigned DERBY-3853:
------------------------------

    Assignee: Yun Lee

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Resolved: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen resolved DERBY-3853.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0
       Derby Info: [Release Note Needed]

Committed revision 764217.
I wasn't planning to backport this fix to the 10.5 branch.

Checking "Release Note Needed" since the fix changes an error code.

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>             Fix For: 10.6.0.0
>
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat, releaseNote.html
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Commented: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694116#action_12694116 ] 

Yun Lee commented on DERBY-3853:
--------------------------------

Knut, thanks for your comments.  I will turn back on weekend to provide new patch adopting your advice,:)

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Updated: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

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

Yun Lee updated DERBY-3853:
---------------------------

    Attachment: DERBY-3853-1.stat
                DERBY-3853-1.patch

I have changed the EmbedConnection.setTypeMap() to act as the same way of Connection. They all throw a "0A000" Exc\eption now. The new change aslo performs in the J2EEDataSourceTest.java.

Please check it. Thanks!

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Commented: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693714#action_12693714 ] 

Knut Anders Hatlen commented on DERBY-3853:
-------------------------------------------

Thanks for the patch. With that solution some of the calls to setTypeMap() that used to succeed on the embedded driver will start throwing exceptions. This may break existing applications, so I think it's probably safer to make the changes on the client driver instead.

Some minor comments about the test changes:

- I don't think the calls to sqle.getNextException() are necessary when invoking assertSQLState(), since assertSQLState() is supposed to follow the exception chain until it finds a match

- Code like the example below should have a call to fail() at the end of the try block in order to detect if the code didn't throw any exception:

+        try {
+            cs.execute();
+        } catch (SQLException sqle) {
+            assertSQLState("0A000", sqle.getNextException());
+        }

> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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


[jira] Commented: (DERBY-3853) Behaviour of setTypeMap() differs between embedded and client

Posted by "Yun Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698056#action_12698056 ] 

Yun Lee commented on DERBY-3853:
--------------------------------

Knut, I'm happy to hear it will be commited soon! Thanks!

By what you explained so clearly, I've got why it's better to make changes on client side now.

I have browsed the coding convention doc, and will follow it in my work on Derby.

Yun





> Behaviour of setTypeMap() differs between embedded and client
> -------------------------------------------------------------
>
>                 Key: DERBY-3853
>                 URL: https://issues.apache.org/jira/browse/DERBY-3853
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC, Newcomer
>    Affects Versions: 10.5.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Yun Lee
>            Priority: Minor
>         Attachments: DERBY-3853-1.patch, DERBY-3853-1.stat, DERBY-3853-2.patch, DERBY-3853-2.stat
>
>
> On the embedded driver, Connection.setTypeMap() behaves like this (when the connection is not closed):
>   - if the map argument is null, throw an SQLException with SQLState XJ081
>   - if the map is not null and not empty, throw an SQLException with SQLState 0A000
>   - if the map is not null and empty, do nothing
> The behaviour on the client driver is this:
>   - always throw an SQLException with SQLState 0A000
> We should try to make the two drivers behave the same way when setTypeMap() is called. (This would also allow us to simplify some of the tests in J2EEDataSourceTest).

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