提交 fbe55d6b authored 作者: Noel Grandin's avatar Noel Grandin

Revert "Merge pull request #523 from stumc/Issue#458"

This reverts commit ae6da320, reversing
changes made to 8b018f2b.
上级 3cb4d24e
......@@ -1887,11 +1887,11 @@ public class Function extends Expression implements FunctionCall {
calendar.setTimeInMillis(t2);
int year2 = calendar.get(Calendar.YEAR);
int month2 = calendar.get(Calendar.MONTH);
int yearResult = year2 - year1;
int result = year2 - year1;
if (field == Calendar.MONTH) {
return 12 * yearResult + (month2 - month1);
return 12 * result + (month2 - month1);
} else if (field == Calendar.YEAR) {
return (12 * yearResult + (month2 - month1))/12;
return result;
} else {
throw DbException.getUnsupportedException("DATEDIFF " + part);
}
......
......@@ -11,7 +11,6 @@ import java.io.LineNumberReader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.h2.test.TestBase;
import org.h2.util.ScriptReader;
......@@ -73,7 +72,6 @@ public class TestScriptSimple extends TestBase {
}
conn.close();
deleteDb("scriptSimple");
}
private void reconnect() throws SQLException {
......
......@@ -9909,29 +9909,15 @@ select dateadd('year', -1, timestamp '2000-02-29 10:20:30.012345678') d1 from te
> 1999-02-28 10:20:30.012345678
> rows: 1
-- Only 2 months difference, not a whole year
select datediff('yy', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d1 from test;
> D1
> --
> 0
> rows: 1
select datediff('yy', timestamp '2003-12-01 10:20:30.0', timestamp '2004-12-01 10:20:30.0') d1 from test;
> D1
> --
> 1
> rows: 1
-- Only 2 months difference, not a whole year
select datediff('year', timestamp '2003-12-01 10:20:30.0', timestamp '2004-01-01 10:00:00.0') d1 from test;
> D1
> --
> 0
> rows: 1
select datediff('year', timestamp '2003-12-01 10:20:30.0', timestamp '2004-12-01 10:20:30.0') d1 from test;
> D1
> --
> 1
> rows: 1
......
......@@ -111,8 +111,7 @@ public final class ImmutableArray<K> implements Iterable<K> {
* @param array the data
* @return the new immutable array
*/
@SafeVarargs
public static <K> ImmutableArray<K> create(K... array) {
public static <K> ImmutableArray<K> create(K... array) {
return new ImmutableArray<K>(array);
}
......
......@@ -151,8 +151,7 @@ public final class ImmutableArray2<K> implements Iterable<K> {
* @param array the data
* @return the new immutable array
*/
@SafeVarargs
public static <K> ImmutableArray2<K> create(K... array) {
public static <K> ImmutableArray2<K> create(K... array) {
return new ImmutableArray2<K>(array, array.length);
}
......
......@@ -84,8 +84,7 @@ public abstract class ImmutableArray3<K> implements Iterable<K> {
* @param array the data
* @return the new immutable array
*/
@SafeVarargs
public static <K> ImmutableArray3<K> create(K... array) {
public static <K> ImmutableArray3<K> create(K... array) {
return new Plain<K>(array);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论