提交 6215e945 authored 作者: Thomas Mueller's avatar Thomas Mueller

BITOR, BITAND, BITXOR, and MOD use BIGINT

上级 2bbf093a
......@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Could not use the same linked table multiple times in the same query.
<ul><li>The functions BITOR, BITAND, BITXOR, and MOD now accept
and return BIGINT instead of INT.
</li><li>Could not use the same linked table multiple times in the same query.
</li><li>A bug in the server-less multi-connection mode has been fixed.
</li><li>Column names could not be named "UNIQUE" (with the quotes).
</li><li>New system function TRANSACTION_ID() to get the current transaction
......
......@@ -408,6 +408,7 @@ Of course, patches are always welcome, but are not always applied as is. Patches
</li><li>RunScript should be able to read from system in (or quite mode for Shell).
</li><li>Natural join: support select x from dual natural join dual.
</li><li>Optimize IN(...) for DELETE and UPDATE.
</li><li>Natural join: somehow support this: select a.x, b.x, x from dual a natural join dual b
</li></ul>
<h2>Not Planned</h2>
......
......@@ -166,9 +166,9 @@ public class Function extends Expression implements FunctionCall {
addFunction("ASIN", ASIN, 1, Value.DOUBLE);
addFunction("ATAN", ATAN, 1, Value.DOUBLE);
addFunction("ATAN2", ATAN2, 2, Value.DOUBLE);
addFunction("BITAND", BITAND, 2, Value.INT);
addFunction("BITOR", BITOR, 2, Value.INT);
addFunction("BITXOR", BITXOR, 2, Value.INT);
addFunction("BITAND", BITAND, 2, Value.LONG);
addFunction("BITOR", BITOR, 2, Value.LONG);
addFunction("BITXOR", BITXOR, 2, Value.LONG);
addFunction("CEILING", CEILING, 1, Value.DOUBLE);
addFunction("COS", COS, 1, Value.DOUBLE);
addFunction("COT", COT, 1, Value.DOUBLE);
......@@ -177,7 +177,7 @@ public class Function extends Expression implements FunctionCall {
addFunction("FLOOR", FLOOR, 1, Value.DOUBLE);
addFunction("LOG", LOG, 1, Value.DOUBLE);
addFunction("LOG10", LOG10, 1, Value.DOUBLE);
addFunction("MOD", MOD, 2, Value.INT);
addFunction("MOD", MOD, 2, Value.LONG);
addFunction("PI", PI, 0, Value.DOUBLE);
addFunction("POWER", POWER, 2, Value.DOUBLE);
addFunction("RADIANS", RADIANS, 1, Value.DOUBLE);
......@@ -869,20 +869,20 @@ public class Function extends Expression implements FunctionCall {
result = ValueDouble.get(Math.atan2(v0.getDouble(), v1.getDouble()));
break;
case BITAND:
result = ValueInt.get(v0.getInt() & v1.getInt());
result = ValueLong.get(v0.getLong() & v1.getLong());
break;
case BITOR:
result = ValueInt.get(v0.getInt() | v1.getInt());
result = ValueLong.get(v0.getLong() | v1.getLong());
break;
case BITXOR:
result = ValueInt.get(v0.getInt() ^ v1.getInt());
result = ValueLong.get(v0.getLong() ^ v1.getLong());
break;
case MOD: {
int x = v1.getInt();
if (x == 0.0) {
long x = v1.getLong();
if (x == 0) {
throw Message.getSQLException(ErrorCode.DIVISION_BY_ZERO_1, getSQL());
}
result = ValueInt.get(v0.getInt() % x);
result = ValueLong.get(v0.getLong() % x);
break;
}
case POWER:
......
......@@ -2056,7 +2056,7 @@ ATAN2(X, Y)
"
"Functions (Numeric)","BITAND","
BITAND(int, int): int
BITAND(long, long): long
","
See also Java operator &.
","
......@@ -2064,7 +2064,7 @@ BITAND(A, B)
"
"Functions (Numeric)","BITOR","
BITOR(int, int): int
BITOR(long, long): long
","
See also Java operator |.
","
......@@ -2072,7 +2072,7 @@ BITOR(A, B)
"
"Functions (Numeric)","BITXOR","
BITXOR(int, int): int
BITXOR(long, long): long
","
See also Java operator ^.
","
......@@ -2080,7 +2080,7 @@ BITXOR(A, B)
"
"Functions (Numeric)","MOD","
MOD(int, int): int
MOD(long, long): long
","
See also Java operator %.
","
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论