[jira] [Closed] (DERBY-6920) Add input support for new date and time classes

2024-05-24 Thread Philippe Marschall (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-6920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philippe Marschall closed DERBY-6920.
-
Resolution: Abandoned

I will submit a full input-output patch in DERBY-6445

> Add input support for new date and time classes
> ---
>
> Key: DERBY-6920
> URL: https://issues.apache.org/jira/browse/DERBY-6920
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Reporter: Philippe Marschall
>Priority: Major
> Attachments: jsr-310-input.diff
>
>
> This is the first half of DERBY-6445. The patch adds support for the new date 
> and time classes for input only. I may add output support later but for now 
> splitting it up makes for a smaller, easier to review and implement patch.
> A couple of notes about the implementation:
> * as the project now requires Java 1.8 I added the code directly to the 
> classes
> * the existing tests are expanded
> * I avoided calling the provided #valueOf conversion methods for several 
> reasons:
> ** LocalTime has nanosecond resolution but java.sql.Time only has millisecond 
> resolution
> ** LocalDateTime can represent timestamps that can not be represented by 
> java.sql.Timestamp because they fall into a daylight saving time transition
> ** Performance should be much better since creating a DateTimeValue instance 
> is a simple matter of calling a few getters. No calculation or object 
> creation is involved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Philippe Marschall (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philippe Marschall updated DERBY-6445:
--
Attachment: DERBY-6445.patch

> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Philippe Marschall (Jira)


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

Philippe Marschall commented on DERBY-6445:
---

I attached a patch.

It contains:

- Support for both embedded and client mode.
- Support for both {{ResultSet}} and {{CallableStatement}}.
- Support for {{#getObject}}, {{#setObject}} and {{#updateObject}}.

The code avoids converting through {{java.sql}} types or {{Calendar}} and 
instead uses {{java.time}} types directly. Care has been taken to not affect 
existing code paths.

Limitations:
- {{#updateObject}} goes through the {{java.sql}} types, meaning to introduces 
the limitations of the {{java.sql}} times. I assume the method is used rarely 
enough so that this is acceptable. If not storing {{DateTimeValue}} instead of 
{{java.sql}} types in {{ClientResultSet.updatedColumns_}} would be an option.
- Java stored procedure implementations do not yet support java.time 
parameters. This would be more involved as method lookup would have to be 
updated and input/output conversion would have to happen.



> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas commented on DERBY-6445:


Thanks, Philippe. I will take a look at this patch.

> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Richard N. Hillegas (Jira)


 [ 
https://issues.apache.org/jira/browse/DERBY-6445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard N. Hillegas updated DERBY-6445:
---
Attachment: derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff

> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html, 
> derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas commented on DERBY-6445:


Attaching derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff. This is 
Philippe's patch plus some fixes for its Javadoc warnings. I will run full 
tests against this patch.

A quick glance at the patch indicates that some methods are missing the 
diagnostic logging which appears in sister methods. At a minimum, the patch 
will need a little more tweaking to bring it into alignment with that 
diagnostic logging pattern.

Touches the following files:

{noformat}
M   
java/org.apache.derby.client/org/apache/derby/client/am/ClientCallableStatement.java
M   
java/org.apache.derby.client/org/apache/derby/client/am/ClientPreparedStatement.java
M   
java/org.apache.derby.client/org/apache/derby/client/am/ClientResultSet.java
M   
java/org.apache.derby.client/org/apache/derby/client/am/CrossConverters.java
M   java/org.apache.derby.client/org/apache/derby/client/am/Cursor.java
M   java/org.apache.derby.client/org/apache/derby/client/am/DateTime.java
M   
java/org.apache.derby.client/org/apache/derby/client/am/DateTimeValue.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/DataType.java
M   
java/org.apache.derby.engine/org/apache/derby/iapi/types/DataValueDescriptor.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLChar.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLClob.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLDate.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLTime.java
M   
java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLTimestamp.java
M   java/org.apache.derby.engine/org/apache/derby/iapi/types/UserType.java
M   
java/org.apache.derby.engine/org/apache/derby/impl/jdbc/EmbedCallableStatement.java
M   
java/org.apache.derby.engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
M   
java/org.apache.derby.engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
M   
java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/CallableStatementTest.java
M   
java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest42.java
M   
java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbc4/Wrapper41Test.java
{noformat}


> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html, 
> derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas commented on DERBY-6445:


Tests passed (with the classpath) on 
derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff.

> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html, 
> derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Philippe Marschall (Jira)


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

Philippe Marschall commented on DERBY-6445:
---

About the diagnostic logging, it is not clear to me how this could best be 
implemented. To give you an example:

{{org.apache.derby.client.am.ClientResultSet#getObject(String, Class)}} logs 
method entry, but does not log method exit. It ends up calling 
{{org.apache.derby.client.am.ClientResultSet#getObject(int, Class)}} which 
also logs method entry and not log method exit as well. This can end up calling 
an existing method like 
{{org.apache.derby.client.am.ClientResultSet#getDate(int, Calendar)}} which 
logs method entry and method exit or a new method like 
{{org.apache.derby.impl.jdbc.EmbedResultSet#getLocalDate(int)}} which, as you 
pointed out correctly, does not do any diagnostic logging. My reasoning here is 
this is a {{private}} utility method that can only be called indirectly while 
{{#getDate}} is a {{public}} API method that can be called directly by client 
code. Diagnostic logging currently only seems be done for {{public}} methods 
and very few {{protected}} methods these being four {{finalize}} methods and 
two methods on {{BasicClientDataSource}}. The situation is similar for 
{{org.apache.derby.client.am.ClientPreparedStatement}} and {{#setObject}}.

I see several options and would welcome your guidance:
- I could add diagnostic logging directly to the new {{private}} methods, they 
would become the first {{private}} methods to have diagnostic logging.
- Inline the new {{private}} methods into {{ClientResultSet}}. Not ideal.
- I could extend the diagnostic logging of {{#getObject}} to also log method 
exit. That would still result in different diagnostic logs depending on whether 
{{#getObject}} is called with {{java.sql.Date}} ({{#getObject}} and 
{{#getDate}} are logged) or with {{java.time.LocalTime}} (only {{#getObject}} 
is logged). To avoid this they would have to be split into a {{public}} method 
which performs diagnostic logging and a {{private}} one which contains the rest 
of the implementation. {{#getObject}} would call the latter to avoid logging 
twice.


> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html, 
> derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (DERBY-6445) JDBC 4.2: Add support for new date and time classes

2024-05-24 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas commented on DERBY-6445:


Thanks for your thoughts about diagnostic logging, Philippe. I am going through 
the patch, making additional tweaks, including adding diagnostic logging calls. 
We can discuss this further when I post that revised patch.

> JDBC 4.2: Add support for new date and time classes
> ---
>
> Key: DERBY-6445
> URL: https://issues.apache.org/jira/browse/DERBY-6445
> Project: Derby
>  Issue Type: Improvement
>  Components: JDBC
>Affects Versions: 10.10.1.1
>Reporter: Knut Anders Hatlen
>Priority: Major
> Attachments: DERBY-6445.patch, Derby-6445.html, Derby-6445.html, 
> derby-6445-01-aa-DERBY-6445.patchPlusJavadocCleanup.diff
>
>
> JDBC 4.2 added type mappings for new date and time classes found in Java 8. 
> Derby should support these new mappings.
> This would at least affect Derby's implementation of the various getObject(), 
> setObject() and setNull() methods in ResultSet, PreparedStatement and 
> CallableStatement.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)