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

User defined functions can be created with source code.

上级 769b2932
...@@ -48,6 +48,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -48,6 +48,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
public void test() throws Exception { public void test() throws Exception {
deleteDb("functions"); deleteDb("functions");
testSource();
testDynamicArgumentAndReturn(); testDynamicArgumentAndReturn();
testUUID(); testUUID();
testDeterministic(); testDeterministic();
...@@ -60,6 +61,18 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -60,6 +61,18 @@ public class TestFunctions extends TestBase implements AggregateFunction {
deleteDb("functions"); deleteDb("functions");
} }
private void testSource() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
ResultSet rs;
stat.execute("create force alias sayHi as 'String test(String name) { return \"Hello \" + name; }'");
rs = stat.executeQuery("call sayHi('Joe')");
rs.next();
assertEquals("Hello Joe", rs.getString(1));
stat.execute("drop alias sayHi");
conn.close();
}
private void testDynamicArgumentAndReturn() throws SQLException { private void testDynamicArgumentAndReturn() throws SQLException {
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论