Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
9b26ff1d
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9b26ff1d
编写于
3月 02, 2019
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#5370 Composite (struct) values string representation
上级
cb987a89
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
8 deletion
+32
-8
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreStructValueHandler.java
.../ext/postgresql/model/data/PostgreStructValueHandler.java
+2
-2
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCStructImpl.java
...src/org/jkiss/dbeaver/model/impl/jdbc/JDBCStructImpl.java
+9
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCComposite.java
...org/jkiss/dbeaver/model/impl/jdbc/data/JDBCComposite.java
+17
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCompositeDynamic.java
...ss/dbeaver/model/impl/jdbc/data/JDBCCompositeDynamic.java
+2
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCompositeStatic.java
...iss/dbeaver/model/impl/jdbc/data/JDBCCompositeStatic.java
+1
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/handlers/JDBCStructValueHandler.java
...model/impl/jdbc/data/handlers/JDBCStructValueHandler.java
+1
-1
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreStructValueHandler.java
浏览文件 @
9b26ff1d
...
...
@@ -81,7 +81,7 @@ public class PostgreStructValueHandler extends JDBCStructValueHandler {
}
try
{
if
(
object
==
null
)
{
return
new
JDBCCompositeStatic
(
session
,
structType
,
new
JDBCStructImpl
(
structType
.
getTypeName
(),
null
));
return
new
JDBCCompositeStatic
(
session
,
structType
,
new
JDBCStructImpl
(
structType
.
getTypeName
(),
null
,
""
));
}
else
if
(
object
instanceof
JDBCCompositeStatic
)
{
return
copy
?
((
JDBCCompositeStatic
)
object
).
cloneValue
(
session
.
getProgressMonitor
())
:
object
;
}
else
{
...
...
@@ -118,7 +118,7 @@ public class PostgreStructValueHandler extends JDBCStructValueHandler {
attrValues
[
i
]
=
PostgreUtils
.
convertStringToValue
(
session
,
itemAttr
,
parsedValues
[
i
],
true
);
}
Struct
contents
=
new
JDBCStructImpl
(
compType
.
getTypeName
(),
attrValues
);
Struct
contents
=
new
JDBCStructImpl
(
compType
.
getTypeName
(),
attrValues
,
value
);
return
new
JDBCCompositeStatic
(
session
,
compType
,
contents
);
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCStructImpl.java
浏览文件 @
9b26ff1d
...
...
@@ -29,10 +29,12 @@ public class JDBCStructImpl implements Struct {
private
final
String
typeName
;
private
final
Object
[]
attributes
;
private
final
String
stringValue
;
public
JDBCStructImpl
(
String
typeName
,
Object
[]
attributes
)
{
public
JDBCStructImpl
(
String
typeName
,
Object
[]
attributes
,
String
stringValue
)
{
this
.
typeName
=
typeName
;
this
.
attributes
=
attributes
;
this
.
stringValue
=
stringValue
;
}
@Override
...
...
@@ -49,4 +51,10 @@ public class JDBCStructImpl implements Struct {
public
Object
[]
getAttributes
(
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
throw
new
SQLFeatureNotSupportedException
();
}
@Override
public
String
toString
()
{
return
stringValue
;
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCComposite.java
浏览文件 @
9b26ff1d
...
...
@@ -48,6 +48,9 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
private
static
final
Log
log
=
Log
.
getLog
(
JDBCComposite
.
class
);
@Nullable
private
Struct
rawStruct
;
@NotNull
protected
DBSDataType
type
;
@NotNull
...
...
@@ -59,6 +62,10 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
protected
JDBCComposite
()
{
}
public
JDBCComposite
(
Struct
rawStruct
)
{
this
.
rawStruct
=
rawStruct
;
}
protected
JDBCComposite
(
@NotNull
JDBCComposite
struct
,
@NotNull
DBRProgressMonitor
monitor
)
throws
DBCException
{
this
.
type
=
struct
.
type
;
this
.
attributes
=
Arrays
.
copyOf
(
struct
.
attributes
,
struct
.
attributes
.
length
);
...
...
@@ -102,7 +109,7 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
public
String
getStringRepresentation
()
{
return
getTypeName
(
);
return
CommonUtils
.
toString
(
getRawValue
()
);
}
@NotNull
...
...
@@ -111,6 +118,9 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
}
public
Struct
getStructValue
()
throws
DBCException
{
if
(
rawStruct
!=
null
)
{
return
rawStruct
;
}
Object
[]
attrs
=
new
Object
[
values
.
length
];
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
Object
attr
=
values
[
i
];
...
...
@@ -124,7 +134,7 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
if
(
session
instanceof
Connection
)
{
return
((
Connection
)
session
).
createStruct
(
dataType
.
getTypeName
(),
attrs
);
}
else
{
return
new
JDBCStructImpl
(
dataType
.
getTypeName
(),
attrs
);
return
new
JDBCStructImpl
(
dataType
.
getTypeName
(),
attrs
,
getStringRepresentation
()
);
}
}
catch
(
Throwable
e
)
{
throw
new
DBCException
(
"Error creating struct"
,
e
);
...
...
@@ -139,6 +149,9 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
@Override
public
Struct
getRawValue
()
{
if
(
rawStruct
!=
null
)
{
return
rawStruct
;
}
try
{
return
getStructValue
();
}
catch
(
Throwable
e
)
{
...
...
@@ -269,8 +282,8 @@ public abstract class JDBCComposite implements DBDComposite, DBDValueCloneable {
return
CommonUtils
.
equalObjects
(
name
,
attr
.
name
)
&&
valueType
==
attr
.
valueType
&&
maxLength
==
attr
.
maxLength
&&
scale
==
attr
.
scale
&&
precision
==
attr
.
precision
&&
CommonUtils
.
equalObjects
(
scale
,
attr
.
scale
)
&&
CommonUtils
.
equalObjects
(
precision
,
attr
.
precision
)
&&
CommonUtils
.
equalObjects
(
typeName
,
attr
.
typeName
)
&&
ordinalPosition
==
attr
.
ordinalPosition
;
}
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCompositeDynamic.java
浏览文件 @
9b26ff1d
...
...
@@ -46,6 +46,8 @@ public class JDBCCompositeDynamic extends JDBCComposite {
public
JDBCCompositeDynamic
(
@NotNull
DBCSession
session
,
@Nullable
Struct
contents
,
@Nullable
ResultSetMetaData
metaData
)
throws
DBCException
{
super
(
contents
);
this
.
type
=
new
StructType
(
session
.
getDataSource
());
// Extract structure data
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/JDBCCompositeStatic.java
浏览文件 @
9b26ff1d
...
...
@@ -48,6 +48,7 @@ public class JDBCCompositeStatic extends JDBCComposite {
public
JDBCCompositeStatic
(
DBCSession
session
,
@NotNull
DBSDataType
type
,
@Nullable
Struct
contents
)
throws
DBCException
{
super
(
contents
);
this
.
type
=
type
;
// Extract structure data
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/data/handlers/JDBCStructValueHandler.java
浏览文件 @
9b26ff1d
...
...
@@ -127,7 +127,7 @@ public class JDBCStructValueHandler extends JDBCComplexValueHandler implements D
}
}
if
(
object
==
null
)
{
return
new
JDBCCompositeStatic
(
session
,
dataType
,
new
JDBCStructImpl
(
dataType
.
getTypeName
(),
null
));
return
new
JDBCCompositeStatic
(
session
,
dataType
,
new
JDBCStructImpl
(
dataType
.
getTypeName
(),
null
,
""
));
}
else
if
(
object
instanceof
JDBCCompositeStatic
)
{
return
copy
?
((
JDBCCompositeStatic
)
object
).
cloneValue
(
session
.
getProgressMonitor
())
:
object
;
}
else
if
(
object
instanceof
Struct
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录