Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f48e3cac
提交
f48e3cac
authored
9 年前
作者:
S.Vladykin
浏览文件
操作
浏览文件
下载
差异文件
merge from master
上级
a3c06157
79ea94ee
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
48 行增加
和
7 行删除
+48
-7
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+5
-5
ToChar.java
h2/src/main/org/h2/util/ToChar.java
+22
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+18
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
f48e3cac
...
@@ -27,13 +27,15 @@ Change Log
...
@@ -27,13 +27,15 @@ Change Log
</li>
</li>
<li>
Issue #186: The "script" command did not include sequences of temporary tables.
<li>
Issue #186: The "script" command did not include sequences of temporary tables.
</li>
</li>
<li>
Issue #115: to_char fails with pattern FM0D099
</li>
</ul>
</ul>
<h2>
Version 1.4.190 Beta (2015-10-11)
</h2>
<h2>
Version 1.4.190 Beta (2015-10-11)
</h2>
<ul>
<ul>
<li>
Pull request #183: optimizer hints (so far without special SQL syntax).
<li>
Pull request #183: optimizer hints (so far without special SQL syntax).
</li>
</li>
<li>
Issue #180: In MVCC mode, executing UPDATE and SELECT ... FOR UPDATE
<li>
Issue #180: In MVCC mode, executing UPDATE and SELECT ... FOR UPDATE
simultaneously silently can drop rows.
simultaneously silently can drop rows.
</li>
</li>
<li>
PageStore storage: the cooperative file locking mechanism
<li>
PageStore storage: the cooperative file locking mechanism
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
f48e3cac
...
@@ -69,7 +69,7 @@ public class IndexCursor implements Cursor {
...
@@ -69,7 +69,7 @@ public class IndexCursor implements Cursor {
/**
/**
* Prepare this index cursor to make a lookup in index.
* Prepare this index cursor to make a lookup in index.
*
*
* @param s Session.
* @param s Session.
* @param indexConditions Index conditions.
* @param indexConditions Index conditions.
*/
*/
...
@@ -261,19 +261,19 @@ public class IndexCursor implements Cursor {
...
@@ -261,19 +261,19 @@ public class IndexCursor implements Cursor {
public
boolean
isAlwaysFalse
()
{
public
boolean
isAlwaysFalse
()
{
return
alwaysFalse
;
return
alwaysFalse
;
}
}
/**
/**
* Get start search row.
* Get start search row.
*
*
* @return search row
* @return search row
*/
*/
public
SearchRow
getStart
()
{
public
SearchRow
getStart
()
{
return
start
;
return
start
;
}
}
/**
/**
* Get end search row.
* Get end search row.
*
*
* @return search row
* @return search row
*/
*/
public
SearchRow
getEnd
()
{
public
SearchRow
getEnd
()
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/ToChar.java
浏览文件 @
f48e3cac
...
@@ -11,6 +11,7 @@ import java.sql.Timestamp;
...
@@ -11,6 +11,7 @@ import java.sql.Timestamp;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.text.DecimalFormatSymbols
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Currency
;
import
java.util.Currency
;
import
java.util.GregorianCalendar
;
import
java.util.GregorianCalendar
;
...
@@ -219,7 +220,7 @@ public class ToChar {
...
@@ -219,7 +220,7 @@ public class ToChar {
}
}
StringBuilder
output
=
new
StringBuilder
();
StringBuilder
output
=
new
StringBuilder
();
String
unscaled
=
number
.
unscaledValue
().
abs
().
toString
();
String
unscaled
=
(
number
.
abs
().
compareTo
(
BigDecimal
.
ONE
)
<
0
?
zeroesAfterDecimalSeparator
(
number
)
:
""
)
+
number
.
unscaledValue
().
abs
().
toString
();
// start at the decimal point and fill in the numbers to the left,
// start at the decimal point and fill in the numbers to the left,
// working our way from right to left
// working our way from right to left
...
@@ -328,6 +329,26 @@ public class ToChar {
...
@@ -328,6 +329,26 @@ public class ToChar {
return
output
.
toString
();
return
output
.
toString
();
}
}
private
static
String
zeroesAfterDecimalSeparator
(
BigDecimal
number
)
{
final
String
numberStr
=
number
.
toString
();
final
int
idx
=
numberStr
.
indexOf
(
'.'
);
if
(
idx
>=
0
)
{
int
i
=
idx
+
1
;
boolean
allZeroes
=
true
;
for
(;
i
<
numberStr
.
length
();
i
++)
{
if
(
numberStr
.
charAt
(
i
)
!=
'0'
)
{
allZeroes
=
false
;
break
;
}
}
final
char
[]
zeroes
=
new
char
[
allZeroes
?
numberStr
.
length
()
-
idx
-
1
:
i
-
1
-
idx
];
Arrays
.
fill
(
zeroes
,
'0'
);
return
String
.
valueOf
(
zeroes
);
}
else
{
return
""
;
}
}
private
static
void
addSign
(
StringBuilder
output
,
int
signum
,
private
static
void
addSign
(
StringBuilder
output
,
int
signum
,
boolean
leadingSign
,
boolean
trailingSign
,
boolean
trailingMinus
,
boolean
leadingSign
,
boolean
trailingSign
,
boolean
trailingMinus
,
boolean
angleBrackets
,
boolean
fillMode
)
{
boolean
angleBrackets
,
boolean
fillMode
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
f48e3cac
...
@@ -1699,6 +1699,24 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1699,6 +1699,24 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertThrows
(
ErrorCode
.
INVALID_TO_CHAR_FORMAT
,
stat
,
assertThrows
(
ErrorCode
.
INVALID_TO_CHAR_FORMAT
,
stat
,
"SELECT TO_CHAR(123.45, 'q999.99') FROM DUAL"
);
"SELECT TO_CHAR(123.45, 'q999.99') FROM DUAL"
);
// ISSUE-115
assertResult
(
"0.123"
,
stat
,
"select to_char(0.123, 'FM0.099') from dual;"
);
assertResult
(
"1.123"
,
stat
,
"select to_char(1.1234, 'FM0.099') from dual;"
);
assertResult
(
"1.1234"
,
stat
,
"select to_char(1.1234, 'FM0.0999') from dual;"
);
assertResult
(
"1.023"
,
stat
,
"select to_char(1.023, 'FM0.099') from dual;"
);
assertResult
(
"0.012"
,
stat
,
"select to_char(0.012, 'FM0.099') from dual;"
);
assertResult
(
"0.123"
,
stat
,
"select to_char(0.123, 'FM0.099') from dual;"
);
assertResult
(
"0.001"
,
stat
,
"select to_char(0.001, 'FM0.099') from dual;"
);
assertResult
(
"0.001"
,
stat
,
"select to_char(0.0012, 'FM0.099') from dual;"
);
assertResult
(
"0.002"
,
stat
,
"select to_char(0.0019, 'FM0.099') from dual;"
);
assertResult
(
"0.0"
,
stat
,
"select to_char(0, 'FM0D099') from dual;"
);
assertResult
(
"0.00"
,
stat
,
"select to_char(0., 'FM0D009') from dual;"
);
assertResult
(
"0."
,
stat
,
"select to_char(0, 'FM0D9') from dual;"
);
assertResult
(
"0.0"
,
stat
,
"select to_char(0.0, 'FM0D099') from dual;"
);
assertResult
(
"0.00"
,
stat
,
"select to_char(0.00, 'FM0D009') from dual;"
);
assertResult
(
"0.00"
,
stat
,
"select to_char(0, 'FM0D009') from dual;"
);
assertResult
(
"0.0"
,
stat
,
"select to_char(0, 'FM0D09') from dual;"
);
assertResult
(
"0.0"
,
stat
,
"select to_char(0, 'FM0D0') from dual;"
);
conn
.
close
();
conn
.
close
();
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论