提交 7165c79b authored 作者: Noel Grandin's avatar Noel Grandin

documentation and changelog

上级 d616c00d
...@@ -2325,12 +2325,26 @@ DATE ...@@ -2325,12 +2325,26 @@ DATE
{ TIMESTAMP | DATETIME | SMALLDATETIME } { TIMESTAMP | DATETIME | SMALLDATETIME }
"," ","
The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]. The timestamp data type. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
Stored internally as a BCD-encoded date, and nano-seconds since midnight.
Mapped to ""java.sql.Timestamp"" (""java.util.Date"" is also supported). Mapped to ""java.sql.Timestamp"" (""java.util.Date"" is also supported).
"," ","
TIMESTAMP TIMESTAMP
" "
"Data Types","TIMESTAMP WITH TIMEZONE Type","
TIMESTAMP WITH TIMEZONE
","
VERY MUCH STILL IN TESTING.
The timestamp with timezone data type.
Stored internally as a BCD-encoded date, nano-seconds since midnight, and timezone offset in minutes.
Note that range queries on this datatype may do some weird stuff close to DST boundaries.
Mapped to ""org.h2.api.TimestampWithTimeZone""
","
TIMESTAMP WITH TIMEZONE
"
"Data Types","BINARY Type"," "Data Types","BINARY Type","
{ BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ] { BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ]
"," ","
......
...@@ -21,6 +21,30 @@ Change Log ...@@ -21,6 +21,30 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>WARNING: THE MERGE BELOW WILL AFFECT ANY 'TIMESTAMP WITH TIMEZONE' INDEXES. You will need to drop and recreate any such indexes.
</li>
<li>PR #364: fix compare TIMESTAMP WITH TIMEZONE
</li>
<li>PR #363: Added support to define last IDENTIFIER on a Trigger.
</li>
<li>PR #366: Tests for timestamps
</li>
<li>PR #361: Improve TimestampWithTimeZone javadoc
</li>
<li>PR #360: Change getters in TimestampWithTimeZone to int
</li>
<li>PR #359: Added missing source encoding. Assuming UTF-8.
</li>
<li>PR #353: Add support for converting JAVA_OBJECT to UUID
</li>
<li>PR #358: Add support for getObject(int|String, Class)
</li>
<li>PR #357: Server: use xdg-open to open the WebConsole in the user's preferred browser on Linux
</li>
<li>PR #356: Support for BEFORE and AFTER clauses when using multiple columns in ALTER TABLE ADD
</li>
<li>PR #351: Respect format codes from Bind message when sending results
</li>
<li>ignore summary line when compiling stored procedure <li>ignore summary line when compiling stored procedure
</li> </li>
<li>PR #348: pg: send RowDescription in response to Describe (statement variant), patch by kostya-sh <li>PR #348: pg: send RowDescription in response to Describe (statement variant), patch by kostya-sh
......
...@@ -314,7 +314,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -314,7 +314,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes. </li><li>Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes.
</li><li>Issue 50: Oracle compatibility: support calling 0-parameters functions without parenthesis. Make constants obsolete. </li><li>Issue 50: Oracle compatibility: support calling 0-parameters functions without parenthesis. Make constants obsolete.
</li><li>MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL) </li><li>MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL)
</li><li>Support a data type "timestamp with timezone" using java.util.Calendar.
</li><li>Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62 </li><li>Finer granularity for SLF4J trace - See http://code.google.com/p/h2database/issues/detail?id=62
</li><li>Add database creation date and time to the database. </li><li>Add database creation date and time to the database.
</li><li>Support ASSERTION. </li><li>Support ASSERTION.
......
...@@ -788,6 +788,10 @@ The date data type." ...@@ -788,6 +788,10 @@ The date data type."
{ TIMESTAMP | DATETIME | SMALLDATETIME } { TIMESTAMP | DATETIME | SMALLDATETIME }
"," ","
The timestamp data type." The timestamp data type."
"Data Types","TIMESTAMP WITH TIMEZONE Type","
TIMESTAMP WITH TIMEZONE
","
VERY MUCH STILL IN TESTING."
"Data Types","BINARY Type"," "Data Types","BINARY Type","
{ BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ] { BINARY | VARBINARY | LONGVARBINARY | RAW | BYTEA } [ ( precisionInt ) ]
"," ","
......
...@@ -290,18 +290,27 @@ public class ValueTimestampTimeZone extends Value { ...@@ -290,18 +290,27 @@ public class ValueTimestampTimeZone extends Value {
@Override @Override
protected int compareSecure(Value o, CompareMode mode) { protected int compareSecure(Value o, CompareMode mode) {
ValueTimestampTimeZone t = (ValueTimestampTimeZone) o; ValueTimestampTimeZone t = (ValueTimestampTimeZone) o;
// We are pretending that the dateValue is in UTC because that gives us a stable sort
// even if the DST database changes.
// convert to minutes and add timezone offset
long a = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), dateValue) / ( 1000L * 60L ); long a = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), dateValue) / ( 1000L * 60L );
long ma = timeNanos / ( 1000L * 1000L * 1000L * 60L ); long ma = timeNanos / ( 1000L * 1000L * 1000L * 60L );
a += ma; a += ma;
a -= timeZoneOffsetMins; a -= timeZoneOffsetMins;
// convert to minutes and add timezone offset
long b = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), t.dateValue) / ( 1000L * 60L ); long b = DateTimeUtils.convertDateValueToMillis(TimeZone.getTimeZone("UTC"), t.dateValue) / ( 1000L * 60L );
long mb = t.timeNanos / ( 1000L * 1000L * 1000L * 60L ); long mb = t.timeNanos / ( 1000L * 1000L * 1000L * 60L );
b += mb; b += mb;
b -= t.timeZoneOffsetMins; b -= t.timeZoneOffsetMins;
// compare date
int c = MathUtils.compareLong(a, b); int c = MathUtils.compareLong(a, b);
if (c != 0) { if (c != 0) {
return c; return c;
} }
// compare time
long na = timeNanos - ( ma * 1000L * 1000L * 1000L * 60L ); long na = timeNanos - ( ma * 1000L * 1000L * 1000L * 60L );
long nb = t.timeNanos - ( mb * 1000L * 1000L * 1000L * 60L ); long nb = t.timeNanos - ( mb * 1000L * 1000L * 1000L * 60L );
return MathUtils.compareLong(na, nb); return MathUtils.compareLong(na, nb);
......
...@@ -15,7 +15,7 @@ import org.h2.util.MathUtils; ...@@ -15,7 +15,7 @@ import org.h2.util.MathUtils;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
/** /**
* Implementation of the TIMESTAMP data type. * Implementation of the TIMESTAMP UTC data type.
*/ */
public final class ValueTimestampUtc extends Value { public final class ValueTimestampUtc extends Value {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论