提交 08131c2c authored 作者: Thomas Mueller's avatar Thomas Mueller

The built-in functions "power" and "radians" now always return a double.

上级 192c1525
...@@ -2269,9 +2269,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -2269,9 +2269,7 @@ public class Function extends Expression implements FunctionCall {
break; break;
case ABS: case ABS:
case FLOOR: case FLOOR:
case RADIANS:
case ROUND: case ROUND:
case POWER:
t = p0.getType(); t = p0.getType();
s = p0.getScale(); s = p0.getScale();
p = p0.getPrecision(); p = p0.getPrecision();
......
...@@ -63,6 +63,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -63,6 +63,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
deleteDb("functions"); deleteDb("functions");
testDataType();
testVersion(); testVersion();
testFunctionTable(); testFunctionTable();
testFunctionTableVarArgs(); testFunctionTableVarArgs();
...@@ -99,6 +100,19 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -99,6 +100,19 @@ public class TestFunctions extends TestBase implements AggregateFunction {
deleteDb("functions"); deleteDb("functions");
FileUtils.deleteRecursive(TEMP_DIR, true); FileUtils.deleteRecursive(TEMP_DIR, true);
} }
private void testDataType() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
assertEquals(Types.DOUBLE, stat.executeQuery(
"select radians(x) from dual").
getMetaData().getColumnType(1));
assertEquals(Types.DOUBLE, stat.executeQuery(
"select power(10, 2*x) from dual").
getMetaData().getColumnType(1));
stat.close();
conn.close();
}
private void testVersion() throws SQLException { private void testVersion() throws SQLException {
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论