Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f98b8066
提交
f98b8066
authored
11月 06, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove custom implementations of Value.getSQL()
上级
e9982ac2
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
17 行增加
和
117 行删除
+17
-117
ValueExpression.java
h2/src/main/org/h2/expression/ValueExpression.java
+0
-8
Column.java
h2/src/main/org/h2/table/Column.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+15
-12
Value.java
h2/src/main/org/h2/value/Value.java
+1
-1
ValueBoolean.java
h2/src/main/org/h2/value/ValueBoolean.java
+0
-5
ValueByte.java
h2/src/main/org/h2/value/ValueByte.java
+0
-5
ValueDecimal.java
h2/src/main/org/h2/value/ValueDecimal.java
+0
-5
ValueDouble.java
h2/src/main/org/h2/value/ValueDouble.java
+0
-12
ValueEnumBase.java
h2/src/main/org/h2/value/ValueEnumBase.java
+0
-5
ValueFloat.java
h2/src/main/org/h2/value/ValueFloat.java
+0
-12
ValueInt.java
h2/src/main/org/h2/value/ValueInt.java
+0
-5
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+0
-8
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+0
-8
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+0
-5
ValueNull.java
h2/src/main/org/h2/value/ValueNull.java
+0
-5
ValueResultSet.java
h2/src/main/org/h2/value/ValueResultSet.java
+0
-5
ValueShort.java
h2/src/main/org/h2/value/ValueShort.java
+0
-5
ValueString.java
h2/src/main/org/h2/value/ValueString.java
+0
-5
TestCustomDataTypesHandler.java
h2/src/test/org/h2/test/jdbc/TestCustomDataTypesHandler.java
+0
-5
没有找到文件。
h2/src/main/org/h2/expression/ValueExpression.java
浏览文件 @
f98b8066
...
...
@@ -134,14 +134,6 @@ public class ValueExpression extends Expression {
return
value
.
getDisplaySize
();
}
@Override
public
String
getSQL
()
{
if
(
this
==
DEFAULT
)
{
return
"DEFAULT"
;
}
return
value
.
getSQL
();
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
if
(
this
==
DEFAULT
)
{
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
f98b8066
...
...
@@ -174,7 +174,7 @@ public class Column {
getCreateSQL
();
throw
DbException
.
get
(
ErrorCode
.
DATA_CONVERSION_ERROR_1
,
e
,
v
.
getSQL
()
+
" ("
+
target
+
")"
);
v
.
get
Trace
SQL
()
+
" ("
+
target
+
")"
);
}
throw
e
;
}
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
f98b8066
...
...
@@ -417,7 +417,7 @@ public class Recover extends Tool implements DataHandler {
}
}
private
String
getSQL
(
String
column
,
Value
v
)
{
private
void
getSQL
(
StringBuilder
builder
,
String
column
,
Value
v
)
{
if
(
v
instanceof
ValueLob
)
{
ValueLob
lob
=
(
ValueLob
)
v
;
byte
[]
small
=
lob
.
getSmall
();
...
...
@@ -428,7 +428,8 @@ public class Recover extends Tool implements DataHandler {
dumpLob
(
file
,
true
);
file
+=
".comp"
;
}
return
"READ_"
+
type
+
"('"
+
file
+
".txt')"
;
builder
.
append
(
"READ_"
).
append
(
type
).
append
(
"('"
).
append
(
file
).
append
(
".txt')"
);
return
;
}
}
else
if
(
v
instanceof
ValueLobDb
)
{
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
...
...
@@ -437,25 +438,25 @@ public class Recover extends Tool implements DataHandler {
int
type
=
lob
.
getType
();
long
id
=
lob
.
getLobId
();
long
precision
=
lob
.
getPrecision
();
String
m
;
String
columnType
;
if
(
type
==
Value
.
BLOB
)
{
columnType
=
"BLOB"
;
m
=
"READ_BLOB"
;
builder
.
append
(
"READ_BLOB"
)
;
}
else
{
columnType
=
"CLOB"
;
m
=
"READ_CLOB"
;
builder
.
append
(
"READ_CLOB"
)
;
}
if
(
lobMaps
)
{
m
+=
"_MAP"
;
builder
.
append
(
"_MAP"
)
;
}
else
{
m
+=
"_DB"
;
builder
.
append
(
"_DB"
)
;
}
columnTypeMap
.
put
(
column
,
columnType
);
return
m
+
"("
+
id
+
", "
+
precision
+
")"
;
builder
.
append
(
'('
).
append
(
id
).
append
(
", "
).
append
(
precision
).
append
(
')'
);
return
;
}
}
return
v
.
getSQL
(
);
v
.
getSQL
(
builder
);
}
private
void
setDatabaseName
(
String
name
)
{
...
...
@@ -666,9 +667,11 @@ public class Recover extends Tool implements DataHandler {
if
(!
init
)
{
setStorage
(
Integer
.
parseInt
(
tableId
));
// init the column types
StringBuilder
builder
=
new
StringBuilder
();
for
(
valueId
=
0
;
valueId
<
recordLength
;
valueId
++)
{
String
columnName
=
storageName
+
"."
+
valueId
;
getSQL
(
columnName
,
values
[
valueId
]);
builder
.
setLength
(
0
);
getSQL
(
builder
,
columnName
,
values
[
valueId
]);
}
createTemporaryTable
(
writer
);
init
=
true
;
...
...
@@ -681,7 +684,7 @@ public class Recover extends Tool implements DataHandler {
buff
.
append
(
", "
);
}
String
columnName
=
storageName
+
"."
+
valueId
;
buff
.
append
(
getSQL
(
columnName
,
values
[
valueId
])
);
getSQL
(
buff
,
columnName
,
values
[
valueId
]
);
}
buff
.
append
(
");"
);
writer
.
println
(
buff
.
toString
());
...
...
@@ -1497,7 +1500,7 @@ public class Recover extends Tool implements DataHandler {
sb
.
append
(
", "
);
}
String
columnName
=
storageName
+
"."
+
valueId
;
sb
.
append
(
getSQL
(
columnName
,
v
)
);
getSQL
(
sb
,
columnName
,
v
);
}
catch
(
Exception
e
)
{
writeDataError
(
writer
,
"exception "
+
e
,
s
.
getBytes
());
}
catch
(
OutOfMemoryError
e
)
{
...
...
h2/src/main/org/h2/value/Value.java
浏览文件 @
f98b8066
...
...
@@ -1485,7 +1485,7 @@ public abstract class Value {
* @return the SQL expression
*/
public
String
getTraceSQL
()
{
return
getSQL
();
return
getSQL
(
new
StringBuilder
()).
toString
(
);
}
@Override
...
...
h2/src/main/org/h2/value/ValueBoolean.java
浏览文件 @
f98b8066
...
...
@@ -45,11 +45,6 @@ public class ValueBoolean extends Value {
return
Value
.
BOOLEAN
;
}
@Override
public
String
getSQL
()
{
return
getString
();
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
getString
());
...
...
h2/src/main/org/h2/value/ValueByte.java
浏览文件 @
f98b8066
...
...
@@ -87,11 +87,6 @@ public class ValueByte extends Value {
return
ValueByte
.
get
((
byte
)
(
value
%
other
.
value
));
}
@Override
public
String
getSQL
()
{
return
Integer
.
toString
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
value
);
...
...
h2/src/main/org/h2/value/ValueDecimal.java
浏览文件 @
f98b8066
...
...
@@ -116,11 +116,6 @@ public class ValueDecimal extends Value {
return
ValueDecimal
.
get
(
bd
);
}
@Override
public
String
getSQL
()
{
return
getString
();
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
getString
());
...
...
h2/src/main/org/h2/value/ValueDouble.java
浏览文件 @
f98b8066
...
...
@@ -91,18 +91,6 @@ public class ValueDouble extends Value {
return
get
(
value
%
other
.
value
);
}
@Override
public
String
getSQL
()
{
if
(
value
==
Double
.
POSITIVE_INFINITY
)
{
return
"POWER(0, -1)"
;
}
else
if
(
value
==
Double
.
NEGATIVE_INFINITY
)
{
return
"(-POWER(0, -1))"
;
}
else
if
(
Double
.
isNaN
(
value
))
{
return
"SQRT(-1)"
;
}
return
getString
();
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
if
(
value
==
Double
.
POSITIVE_INFINITY
)
{
...
...
h2/src/main/org/h2/value/ValueEnumBase.java
浏览文件 @
f98b8066
...
...
@@ -93,11 +93,6 @@ public class ValueEnumBase extends Value {
return
Integer
.
signum
(
ordinal
);
}
@Override
public
String
getSQL
()
{
return
StringUtils
.
quoteStringSQL
(
label
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
StringUtils
.
quoteStringSQL
(
label
));
...
...
h2/src/main/org/h2/value/ValueFloat.java
浏览文件 @
f98b8066
...
...
@@ -91,18 +91,6 @@ public class ValueFloat extends Value {
return
get
(
value
%
other
.
value
);
}
@Override
public
String
getSQL
()
{
if
(
value
==
Float
.
POSITIVE_INFINITY
)
{
return
"POWER(0, -1)"
;
}
else
if
(
value
==
Float
.
NEGATIVE_INFINITY
)
{
return
"(-POWER(0, -1))"
;
}
else
if
(
Float
.
isNaN
(
value
))
{
return
"SQRT(-1)"
;
}
return
Float
.
toString
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
if
(
value
==
Float
.
POSITIVE_INFINITY
)
{
...
...
h2/src/main/org/h2/value/ValueInt.java
浏览文件 @
f98b8066
...
...
@@ -120,11 +120,6 @@ public class ValueInt extends Value {
return
ValueInt
.
get
(
value
%
other
.
value
);
}
@Override
public
String
getSQL
()
{
return
Integer
.
toString
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
value
);
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
f98b8066
...
...
@@ -569,14 +569,6 @@ public class ValueLob extends Value {
}
}
@Override
public
String
getSQL
()
{
if
(
valueType
==
Value
.
CLOB
)
{
return
StringUtils
.
quoteStringSQL
(
getString
());
}
return
"X'"
+
StringUtils
.
convertBytesToHex
(
getBytes
())
+
'\''
;
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
if
(
valueType
==
Value
.
CLOB
)
{
...
...
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
f98b8066
...
...
@@ -460,14 +460,6 @@ public class ValueLobDb extends Value {
}
}
@Override
public
String
getSQL
()
{
if
(
valueType
==
Value
.
CLOB
)
{
return
StringUtils
.
quoteStringSQL
(
getString
());
}
return
"X'"
+
StringUtils
.
convertBytesToHex
(
getBytes
())
+
'\''
;
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
if
(
valueType
==
Value
.
CLOB
)
{
...
...
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
f98b8066
...
...
@@ -145,11 +145,6 @@ public class ValueLong extends Value {
return
ValueLong
.
get
(
this
.
value
%
other
.
value
);
}
@Override
public
String
getSQL
()
{
return
Long
.
toString
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
value
);
...
...
h2/src/main/org/h2/value/ValueNull.java
浏览文件 @
f98b8066
...
...
@@ -48,11 +48,6 @@ public class ValueNull extends Value {
// don't allow construction
}
@Override
public
String
getSQL
()
{
return
"NULL"
;
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
"NULL"
);
...
...
h2/src/main/org/h2/value/ValueResultSet.java
浏览文件 @
f98b8066
...
...
@@ -165,11 +165,6 @@ public class ValueResultSet extends Value {
throw
getUnsupportedExceptionForOperation
(
"PreparedStatement.set"
);
}
@Override
public
String
getSQL
()
{
return
""
;
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
;
...
...
h2/src/main/org/h2/value/ValueShort.java
浏览文件 @
f98b8066
...
...
@@ -87,11 +87,6 @@ public class ValueShort extends Value {
return
ValueShort
.
get
((
short
)
(
value
%
other
.
value
));
}
@Override
public
String
getSQL
()
{
return
Integer
.
toString
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
value
);
...
...
h2/src/main/org/h2/value/ValueString.java
浏览文件 @
f98b8066
...
...
@@ -33,11 +33,6 @@ public class ValueString extends Value {
this
.
value
=
value
;
}
@Override
public
String
getSQL
()
{
return
StringUtils
.
quoteStringSQL
(
value
);
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
StringUtils
.
quoteStringSQL
(
value
));
...
...
h2/src/test/org/h2/test/jdbc/TestCustomDataTypesHandler.java
浏览文件 @
f98b8066
...
...
@@ -336,11 +336,6 @@ public class TestCustomDataTypesHandler extends TestDb {
return
new
ValueComplex
(
val
);
}
@Override
public
String
getSQL
()
{
return
val
.
toString
();
}
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
return
builder
.
append
(
val
.
toString
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论