Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
949f3afc
提交
949f3afc
authored
7 年前
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#537: Include the COLUMN name in message "Numeric value out of range"
上级
75e2714c
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
47 行增加
和
29 行删除
+47
-29
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
_messages_en.prop
h2/src/docsrc/textbase/_messages_en.prop
+1
-1
ErrorCode.java
h2/src/main/org/h2/api/ErrorCode.java
+6
-0
_messages_cs.prop
h2/src/main/org/h2/res/_messages_cs.prop
+1
-0
_messages_de.prop
h2/src/main/org/h2/res/_messages_de.prop
+1
-0
_messages_en.prop
h2/src/main/org/h2/res/_messages_en.prop
+1
-0
_messages_es.prop
h2/src/main/org/h2/res/_messages_es.prop
+1
-0
_messages_ja.prop
h2/src/main/org/h2/res/_messages_ja.prop
+1
-0
_messages_pl.prop
h2/src/main/org/h2/res/_messages_pl.prop
+1
-0
_messages_pt_br.prop
h2/src/main/org/h2/res/_messages_pt_br.prop
+1
-0
_messages_ru.prop
h2/src/main/org/h2/res/_messages_ru.prop
+1
-0
_messages_sk.prop
h2/src/main/org/h2/res/_messages_sk.prop
+1
-0
_messages_zh_cn.prop
h2/src/main/org/h2/res/_messages_zh_cn.prop
+1
-0
Value.java
h2/src/main/org/h2/value/Value.java
+28
-28
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
949f3afc
...
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<ul>
<li>
Issue #537: Include the COLUMN name in message "Numeric value out of range"
</li>
<li>
Issue #600: ROW_NUMBER() behaviour change in H2 1.4.195
</li>
<li>
Fix a bunch of race conditions found by vmlens.com, thank you to vmlens for giving us a license.
...
...
This diff is collapsed.
Click to expand it.
h2/src/docsrc/textbase/_messages_en.prop
浏览文件 @
949f3afc
...
...
@@ -4,7 +4,7 @@
08000=Error opening database: {0}
21S02=Column count does not match
22001=Value too long for column {0}: {1}
22003=Numeric value out of range: {0}
22003=Numeric value out of range: {0}
{1}
22007=Cannot parse {0} constant {1}
22012=Division by zero: {0}
22018=Data conversion error converting {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/api/ErrorCode.java
浏览文件 @
949f3afc
...
...
@@ -106,6 +106,12 @@ public class ErrorCode {
*/
public
static
final
int
NUMERIC_VALUE_OUT_OF_RANGE_1
=
22003
;
/**
* The error with code <code>22004</code> is thrown when a value is out of
* range when converting to another column's data type.
*/
public
static
final
int
NUMERIC_VALUE_OUT_OF_RANGE_2
=
22004
;
/**
* The error with code <code>22007</code> is thrown when
* a text can not be converted to a date, time, or timestamp constant.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_cs.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Počet sloupců nesouhlasí
22001=Příliš dlouhá hodnota pro sloupec {0}: {1}
22003=Číselná hodnota je mimo rozsah: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Nelze zpracovat konstantu {0} {1}
22012=Dělení nulou: {0}
22018=Chyba při převodu dat {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_de.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Anzahl der Felder stimmt nicht überein
22001=Wert zu gross / lang für Feld {0}: {1}
22003=Zahlenwert ausserhalb des Bereichs: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Kann {0} {1} nicht umwandeln
22012=Division durch 0: {0}
22018=Datenumwandlungsfehler beim Umwandeln von {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_en.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Column count does not match
22001=Value too long for column {0}: {1}
22003=Numeric value out of range: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Cannot parse {0} constant {1}
22012=Division by zero: {0}
22018=Data conversion error converting {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_es.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=La cantidad de columnas no coincide
22001=Valor demasiado largo para la columna {0}: {1}
22003=Valor numerico fuera de rango: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Imposible interpretar la constante {0} {1}
22012=División por cero: {0}
22018=Conversión de datos fallida, convirtiendo {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_ja.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=列番号が一致しません
22001=列 {0} の値が長過ぎます: {1}
22003=範囲外の数値です: {0}
22004=Numeric value out of range: {0} in column {1}
22007={0} 定数 {1} を解析できません
22012=ゼロで除算しました: {0}
22018=データ変換中にエラーが発生しました {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_pl.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Niezgodna ilość kolumn
22001=Wartość za długa dla kolumny {0}: {1}
22003=Wartość numeryczna poza zakresem: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Nie można odczytać {0} jako {1}
22012=Dzielenie przez zero: {0}
22018=Błąd konwersji danych {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_pt_br.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=A quantidade de colunas não corresponde
22001=Valor muito longo para a coluna {0}: {1}
22003=Valor númerico não esta dentro do limite: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Não é possível converter {1} para {0}
22012=Divisão por zero: {0}
22018=Erro na conversão de dado, convertendo {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_ru.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Неверное количество столбцов
22001=Значение слишком длинное для поля {0}: {1}
22003=Численное значение вне допустимого диапазона: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Невозможно преобразование строки {1} в тип {0}
22012=Деление на ноль: {0}
22018=Ошибка преобразования данных при конвертации {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_sk.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=Počet stĺpcov sa nezhoduje
22001=Hodnota je príliš dlhá pre stĺpec {0}: {1}
22003=Číselná hodnota mimo rozsah: {0}
22004=Numeric value out of range: {0} in column {1}
22007=Nemožem rozobrať {0} konštantu {1}
22012=Delenie nulou: {0}
22018=Chyba konverzie dát pre {0}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/res/_messages_zh_cn.prop
浏览文件 @
949f3afc
...
...
@@ -5,6 +5,7 @@
21S02=字段数目不匹配
22001=字段 {0}数值太大: {1}
22003=数值超出范围: {0}
22004=Numeric value out of range: {0} in column {1}
22007=不能解析字段 {0} 的数值 :{1}
22012=除数为零: {0}
22018=转换数据{0}期间出现转换错误
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/Value.java
浏览文件 @
949f3afc
...
...
@@ -608,18 +608,18 @@ public abstract class Value {
case
BOOLEAN:
return
ValueByte
.
get
(
getBoolean
().
booleanValue
()
?
(
byte
)
1
:
(
byte
)
0
);
case
SHORT:
return
ValueByte
.
get
(
convertToByte
(
getShort
()));
return
ValueByte
.
get
(
convertToByte
(
getShort
()
,
column
));
case
ENUM:
case
INT:
return
ValueByte
.
get
(
convertToByte
(
getInt
()));
return
ValueByte
.
get
(
convertToByte
(
getInt
()
,
column
));
case
LONG:
return
ValueByte
.
get
(
convertToByte
(
getLong
()));
return
ValueByte
.
get
(
convertToByte
(
getLong
()
,
column
));
case
DECIMAL:
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getBigDecimal
()
)
));
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getBigDecimal
()
,
column
),
column
));
case
DOUBLE:
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getDouble
()
)
));
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getDouble
()
,
column
),
column
));
case
FLOAT:
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getFloat
()
)
));
return
ValueByte
.
get
(
convertToByte
(
convertToLong
(
getFloat
()
,
column
),
column
));
case
BYTES:
return
ValueByte
.
get
((
byte
)
Integer
.
parseInt
(
getString
(),
16
));
case
TIMESTAMP_TZ:
...
...
@@ -636,15 +636,15 @@ public abstract class Value {
return
ValueShort
.
get
(
getByte
());
case
ENUM:
case
INT:
return
ValueShort
.
get
(
convertToShort
(
getInt
()));
return
ValueShort
.
get
(
convertToShort
(
getInt
()
,
column
));
case
LONG:
return
ValueShort
.
get
(
convertToShort
(
getLong
()));
return
ValueShort
.
get
(
convertToShort
(
getLong
()
,
column
));
case
DECIMAL:
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getBigDecimal
()
)
));
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getBigDecimal
()
,
column
),
column
));
case
DOUBLE:
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getDouble
()
)
));
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getDouble
()
,
column
),
column
));
case
FLOAT:
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getFloat
()
)
));
return
ValueShort
.
get
(
convertToShort
(
convertToLong
(
getFloat
()
,
column
),
column
));
case
BYTES:
return
ValueShort
.
get
((
short
)
Integer
.
parseInt
(
getString
(),
16
));
case
TIMESTAMP_TZ:
...
...
@@ -664,13 +664,13 @@ public abstract class Value {
case
SHORT:
return
ValueInt
.
get
(
getShort
());
case
LONG:
return
ValueInt
.
get
(
convertToInt
(
getLong
()));
return
ValueInt
.
get
(
convertToInt
(
getLong
()
,
column
));
case
DECIMAL:
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getBigDecimal
()
)
));
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getBigDecimal
()
,
column
),
column
));
case
DOUBLE:
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getDouble
()
)
));
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getDouble
()
,
column
),
column
));
case
FLOAT:
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getFloat
()
)
));
return
ValueInt
.
get
(
convertToInt
(
convertToLong
(
getFloat
()
,
column
),
column
));
case
BYTES:
return
ValueInt
.
get
((
int
)
Long
.
parseLong
(
getString
(),
16
));
case
TIMESTAMP_TZ:
...
...
@@ -691,11 +691,11 @@ public abstract class Value {
case
INT:
return
ValueLong
.
get
(
getInt
());
case
DECIMAL:
return
ValueLong
.
get
(
convertToLong
(
getBigDecimal
()));
return
ValueLong
.
get
(
convertToLong
(
getBigDecimal
()
,
column
));
case
DOUBLE:
return
ValueLong
.
get
(
convertToLong
(
getDouble
()));
return
ValueLong
.
get
(
convertToLong
(
getDouble
()
,
column
));
case
FLOAT:
return
ValueLong
.
get
(
convertToLong
(
getFloat
()));
return
ValueLong
.
get
(
convertToLong
(
getFloat
()
,
column
));
case
BYTES:
{
// parseLong doesn't work for ffffffffffffffff
byte
[]
d
=
getBytes
();
...
...
@@ -1131,45 +1131,45 @@ public abstract class Value {
return
this
;
}
private
static
byte
convertToByte
(
long
x
)
{
private
static
byte
convertToByte
(
long
x
,
Column
col
)
{
if
(
x
>
Byte
.
MAX_VALUE
||
x
<
Byte
.
MIN_VALUE
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
1
,
Long
.
toString
(
x
));
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
2
,
Long
.
toString
(
x
),
col
.
getName
(
));
}
return
(
byte
)
x
;
}
private
static
short
convertToShort
(
long
x
)
{
private
static
short
convertToShort
(
long
x
,
Column
col
)
{
if
(
x
>
Short
.
MAX_VALUE
||
x
<
Short
.
MIN_VALUE
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
1
,
Long
.
toString
(
x
));
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
2
,
Long
.
toString
(
x
),
col
.
getName
(
));
}
return
(
short
)
x
;
}
private
static
int
convertToInt
(
long
x
)
{
private
static
int
convertToInt
(
long
x
,
Column
col
)
{
if
(
x
>
Integer
.
MAX_VALUE
||
x
<
Integer
.
MIN_VALUE
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
1
,
Long
.
toString
(
x
));
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
2
,
Long
.
toString
(
x
),
col
.
getName
(
));
}
return
(
int
)
x
;
}
private
static
long
convertToLong
(
double
x
)
{
private
static
long
convertToLong
(
double
x
,
Column
col
)
{
if
(
x
>
Long
.
MAX_VALUE
||
x
<
Long
.
MIN_VALUE
)
{
// TODO document that +Infinity, -Infinity throw an exception and
// NaN returns 0
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
1
,
Double
.
toString
(
x
));
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
2
,
Double
.
toString
(
x
),
col
.
getName
(
));
}
return
Math
.
round
(
x
);
}
private
static
long
convertToLong
(
BigDecimal
x
)
{
private
static
long
convertToLong
(
BigDecimal
x
,
Column
col
)
{
if
(
x
.
compareTo
(
MAX_LONG_DECIMAL
)
>
0
||
x
.
compareTo
(
Value
.
MIN_LONG_DECIMAL
)
<
0
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
1
,
x
.
toString
());
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_
2
,
x
.
toString
(),
col
.
getName
());
}
return
x
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论