Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5ed6d648
提交
5ed6d648
authored
12月 04, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes for Issue 528: Add Oracle-compatible TO_CHAR function
上级
7914d55a
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
10 行增加
和
8 行删除
+10
-8
help.csv
h2/src/docsrc/help/help.csv
+1
-1
help.csv
h2/src/main/org/h2/res/help.csv
+1
-1
ToChar.java
h2/src/main/org/h2/util/ToChar.java
+3
-1
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+2
-2
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+3
-3
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
5ed6d648
...
@@ -3351,7 +3351,7 @@ CALL XMLTEXT('test')
...
@@ -3351,7 +3351,7 @@ CALL XMLTEXT('test')
"
"
"Functions (String)","TO_CHAR","
"Functions (String)","TO_CHAR","
TO_CHAR(value [, format
[, nlsParam
]])
TO_CHAR(value [, format
String[, nlsParamString
]])
","
","
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text.
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text.
","
","
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
5ed6d648
...
@@ -1184,7 +1184,7 @@ XMLTEXT(valueString [, escapeNewlineBoolean])
...
@@ -1184,7 +1184,7 @@ XMLTEXT(valueString [, escapeNewlineBoolean])
","
","
Creates an XML text element."
Creates an XML text element."
"Functions (String)","TO_CHAR","
"Functions (String)","TO_CHAR","
TO_CHAR(value [, format
[, nlsParam
]])
TO_CHAR(value [, format
String[, nlsParamString
]])
","
","
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text."
Oracle-compatible TO_CHAR function that can format a timestamp, a number, or text."
"Functions (Time and Date)","CURRENT_DATE","
"Functions (Time and Date)","CURRENT_DATE","
...
...
h2/src/main/org/h2/util/ToChar.java
浏览文件 @
5ed6d648
...
@@ -208,7 +208,9 @@ public class ToChar {
...
@@ -208,7 +208,9 @@ public class ToChar {
output
.
insert
(
0
,
currency
.
getSymbol
());
output
.
insert
(
0
,
currency
.
getSymbol
());
maxLength
+=
9
;
maxLength
+=
9
;
}
else
if
(
c
==
'$'
)
{
}
else
if
(
c
==
'$'
)
{
output
.
insert
(
0
,
c
);
Currency
currency
=
Currency
.
getInstance
(
Locale
.
getDefault
());
String
cs
=
currency
.
getSymbol
();
output
.
insert
(
0
,
cs
);
}
else
{
}
else
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_TO_CHAR_FORMAT
,
originalFormat
);
throw
DbException
.
get
(
ErrorCode
.
INVALID_TO_CHAR_FORMAT
,
originalFormat
);
}
}
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
5ed6d648
...
@@ -981,8 +981,8 @@ public abstract class TestBase {
...
@@ -981,8 +981,8 @@ public abstract class TestBase {
try
{
try
{
stat
.
executeQuery
(
sql
);
stat
.
executeQuery
(
sql
);
fail
(
"Expected error: "
+
expectedErrorMessage
);
fail
(
"Expected error: "
+
expectedErrorMessage
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
x
)
{
assert
True
(
e
.
getMessage
().
startsWith
(
expectedErrorMessage
)
);
assert
StartsWith
(
ex
.
getMessage
(),
expectedErrorMessage
);
}
}
}
}
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
5ed6d648
...
@@ -1215,9 +1215,9 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1215,9 +1215,9 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertResult
(
"1.23456789012345E+14"
,
stat
,
"SELECT TO_CHAR(123456789012345, 'TME') FROM DUAL"
);
assertResult
(
"1.23456789012345E+14"
,
stat
,
"SELECT TO_CHAR(123456789012345, 'TME') FROM DUAL"
);
assertResult
(
"4.5E-01"
,
stat
,
"SELECT TO_CHAR(0.45, 'TME') FROM DUAL"
);
assertResult
(
"4.5E-01"
,
stat
,
"SELECT TO_CHAR(0.45, 'TME') FROM DUAL"
);
assertResult
(
"4.5E-01"
,
stat
,
"SELECT TO_CHAR(0.45, 'tMe') FROM DUAL"
);
assertResult
(
"4.5E-01"
,
stat
,
"SELECT TO_CHAR(0.45, 'tMe') FROM DUAL"
);
assertThrows
(
"Invalid format \"999.99q\""
,
stat
,
"SELECT TO_CHAR(123.45, '999.99q') FROM DUAL"
);
assertThrows
(
"Invalid
TO_CHAR
format \"999.99q\""
,
stat
,
"SELECT TO_CHAR(123.45, '999.99q') FROM DUAL"
);
assertThrows
(
"Invalid format \"fm999.99q\""
,
stat
,
"SELECT TO_CHAR(123.45, 'fm999.99q') FROM DUAL"
);
assertThrows
(
"Invalid
TO_CHAR
format \"fm999.99q\""
,
stat
,
"SELECT TO_CHAR(123.45, 'fm999.99q') FROM DUAL"
);
assertThrows
(
"Invalid format \"q999.99\""
,
stat
,
"SELECT TO_CHAR(123.45, 'q999.99') FROM DUAL"
);
assertThrows
(
"Invalid
TO_CHAR
format \"q999.99\""
,
stat
,
"SELECT TO_CHAR(123.45, 'q999.99') FROM DUAL"
);
conn
.
close
();
conn
.
close
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论