提交 cb513063 authored 作者: migaman's avatar migaman

Add Function "LEN" #1196

上级 d20a519e
......@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Issue #1196: Feature request for MS SQL Server Compatibility Mode
</li>
<li>Issue #1177: Resource leak in Recover tool
</li>
<li>PR #1183: Improve concurrency of connection pool with wait-free implement
......
......@@ -239,6 +239,8 @@ public class Function extends Expression implements FunctionCall {
addFunction("LCASE", LCASE, 1, Value.STRING);
addFunction("LEFT", LEFT, 2, Value.STRING);
addFunction("LENGTH", LENGTH, 1, Value.LONG);
// alias for MSSQLServer
addFunction("LEN", LENGTH, 1, Value.LONG);
// 2 or 3 arguments
addFunction("LOCATE", LOCATE, VAR_ARGS, Value.INT);
// alias for MSSQLServer
......
......@@ -127,6 +127,7 @@ public class TestFunctions extends TestDb implements AggregateFunction {
testAnnotationProcessorsOutput();
testRound();
testSignal();
testLength();
deleteDb("functions");
}
......@@ -2080,6 +2081,24 @@ public class TestFunctions extends TestDb implements AggregateFunction {
conn.close();
}
private void testLength() throws SQLException {
deleteDb("functions");
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
final ResultSet rs = stat.executeQuery(
"select LENGTH('This has 17 chars'), LEN('MSSQLServer uses the len keyword') from dual");
rs.next();
assertEquals(17, rs.getInt(1));
assertEquals(32, rs.getInt(2));
rs.close();
conn.close();
}
private void testThatCurrentTimestampIsSane() throws SQLException,
ParseException {
deleteDb("functions");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论