提交 f4a295a0 authored 作者: Thomas Mueller's avatar Thomas Mueller

TIMESTAMPADD is now an alias for DATEADD. Most SQL_TSI_ constants are now…

TIMESTAMPADD is now an alias for DATEADD. Most SQL_TSI_ constants are now supported for for TIMESTAMPADD and TIMESTAMPDIFF (all except SQL_TSI_QUARTER and SQL_TSI_FRAC_SECOND). 
上级 d98ad361
......@@ -17,7 +17,14 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Issue 313: NullPointerException in select query with a subquery or view.
<ul><li>The statement CALL no longer converts an ARRAY return value to a list of values.
Now an ARRAY is returned.
</li><li>VALUES is now supported as a standalone command and as a table source:
SELECT * FROM (VALUES(1, 'Hello'), (2, 'World')) AS V;
</li><li>TIMESTAMPADD is now an alias for DATEADD.
Most SQL_TSI_ constants are now supported for for TIMESTAMPADD and TIMESTAMPDIFF
(all except SQL_TSI_QUARTER and SQL_TSI_FRAC_SECOND).
</li><li>Issue 313: NullPointerException in select query with a subquery or view.
</li><li>Native fulltext search: the characters '<', '>', and '\' are now also whitespace
characters. Also, the list of whitespace characters can be changed using
FullText.setWhitespaceChars(conn, ...)
......
......@@ -115,26 +115,33 @@ public class Function extends Expression implements FunctionCall {
static {
// DATE_PART
DATE_PART.put("SQL_TSI_YEAR", Calendar.YEAR);
DATE_PART.put("YEAR", Calendar.YEAR);
DATE_PART.put("YYYY", Calendar.YEAR);
DATE_PART.put("YY", Calendar.YEAR);
DATE_PART.put("SQL_TSI_MONTH", Calendar.MONTH);
DATE_PART.put("MONTH", Calendar.MONTH);
DATE_PART.put("MM", Calendar.MONTH);
DATE_PART.put("M", Calendar.MONTH);
DATE_PART.put("SQL_TSI_WEEK", Calendar.WEEK_OF_YEAR);
DATE_PART.put("WW", Calendar.WEEK_OF_YEAR);
DATE_PART.put("WK", Calendar.WEEK_OF_YEAR);
DATE_PART.put("DAY", Calendar.DAY_OF_MONTH);
DATE_PART.put("DD", Calendar.DAY_OF_MONTH);
DATE_PART.put("D", Calendar.DAY_OF_MONTH);
DATE_PART.put("SQL_TSI_DAY", Calendar.DAY_OF_MONTH);
DATE_PART.put("DAYOFYEAR", Calendar.DAY_OF_YEAR);
DATE_PART.put("DAY_OF_YEAR", Calendar.DAY_OF_YEAR);
DATE_PART.put("DY", Calendar.DAY_OF_YEAR);
DATE_PART.put("DOY", Calendar.DAY_OF_YEAR);
DATE_PART.put("SQL_TSI_HOUR", Calendar.HOUR_OF_DAY);
DATE_PART.put("HOUR", Calendar.HOUR_OF_DAY);
DATE_PART.put("HH", Calendar.HOUR_OF_DAY);
DATE_PART.put("SQL_TSI_MINUTE", Calendar.MINUTE);
DATE_PART.put("MINUTE", Calendar.MINUTE);
DATE_PART.put("MI", Calendar.MINUTE);
DATE_PART.put("N", Calendar.MINUTE);
DATE_PART.put("SQL_TSI_SECOND", Calendar.SECOND);
DATE_PART.put("SECOND", Calendar.SECOND);
DATE_PART.put("SS", Calendar.SECOND);
DATE_PART.put("S", Calendar.SECOND);
......@@ -258,6 +265,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionNotDeterministic("CURRENT_TIMESTAMP", CURRENT_TIMESTAMP, VAR_ARGS, Value.TIMESTAMP);
addFunctionNotDeterministic("NOW", NOW, VAR_ARGS, Value.TIMESTAMP);
addFunction("DATEADD", DATE_ADD, 3, Value.TIMESTAMP);
addFunction("TIMESTAMPADD", DATE_ADD, 3, Value.LONG);
addFunction("DATEDIFF", DATE_DIFF, 3, Value.LONG);
addFunction("TIMESTAMPDIFF", DATE_DIFF, 3, Value.LONG);
addFunction("DAYNAME", DAY_NAME, 1, Value.STRING);
......
select {fn TIMESTAMPADD(SQL_TSI_DAY, 1, {ts '2011-10-20 20:30:40.001'})};
> 2011-10-21 20:30:40.001;
select {fn TIMESTAMPADD(SQL_TSI_SECOND, 1, cast('2011-10-20 20:30:40.001' as timestamp))};
> 2011-10-20 20:30:41.001;
select cast(128 as binary);
> 00000080;
select cast(65535 as binary);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论