Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cb513063
提交
cb513063
authored
6 年前
作者:
migaman
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Function "LEN" #1196
上级
d20a519e
master
version-1.4.198
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
23 行增加
和
0 行删除
+23
-0
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-0
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+19
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
cb513063
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Function.java
浏览文件 @
cb513063
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
cb513063
...
...
@@ -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"
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论