[threeten-dev] [threeten-develop] Hypothetical Period/Duration change
Stephen Colebourne
scolebourne at joda.org
Wed Jan 30 08:39:07 PST 2013
On 30 January 2013 16:21, Lance Andersen - Oracle
<Lance.Andersen at oracle.com> wrote:
> There is nothing in the JDBC spec which covers Interval specifically today. The SQL99 and above specifications are where we would look for guidance.
>
> We had talked about adding support for Intervals in the past in JDBC but decided to wait until 310 was finalized to revisit this.
OK. So, since JDBC is not handling INTERVALS in JDK1.8, it makes no
difference if we change the Period/Duration class.
> We also would probably want methods on the Period classes, or elsewhere in JDBC which would be something like:
>
> XXXPeriod valueOf(java.lang.String val) throws java.sql.SQLException
>
> Creates a XXXPeriod object from a String which is in JDBC year-month interval escape format
> INTERVAL [ <sign> ] 'value' interval-qualifier
>
> • The string contains a integer value for every field that is implied by the interval-qualifier
> • If the interval-qualifer is YEAR to MONTH, the year and month fields are separated by a '-'.
> • The leading field may specify a precision which is enclosed in parentheses.
> • Only the leading field may be more than two digits long and no longer than the leading field precision
> • If the precision is not specified, it defaults to two digits
> Example:
> INTERVAL '100-11' YEAR(3) TO MONTH
> INTERVAL '50' YEAR(4)
> INTERVAL '250' MONTH(4)
> INTERVAL -'100-11' YEAR(3) TO MONTH
>
> I would need to go back and review the proposed 310 class with the JDBC EG members and gain a bit of consensus before it could be standardized. We are just about out of runway for Java SE 8 and Intervals are something that can wait until Java SE 9 to standardize vs rush it right now.
Thats absolutely fine. It decouples our work on Period/Duration from
yours. Any extra methods to handle intervals could be added in JDK1.9
to a JSR-310 update.
Stephen
More information about the threeten-dev
mailing list