Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
10705576
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,发现更多精彩内容 >>
提交
10705576
编写于
2月 22, 2019
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/devel' into devel
上级
86dd8af4
6ce24788
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
158 addition
and
44 deletion
+158
-44
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
.../dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
+1
-0
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/data/gis/handlers/GISGeometryTest.java
.../org/jkiss/dbeaver/data/gis/handlers/GISGeometryTest.java
+42
-0
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
...g/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
+1
-0
plugins/org.jkiss.dbeaver.ext.greenplum/plugin.xml
plugins/org.jkiss.dbeaver.ext.greenplum/plugin.xml
+0
-1
plugins/org.jkiss.dbeaver.ext.mssql.ui/src/org/jkiss/dbeaver/ext/mssql/edit/SQLServerTableColumnManager.java
...s/dbeaver/ext/mssql/edit/SQLServerTableColumnManager.java
+1
-1
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
...c/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
+18
-10
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
+0
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/PostgreConstants.java
...rc/org/jkiss/dbeaver/ext/postgresql/PostgreConstants.java
+1
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/PostgreUtils.java
...ql/src/org/jkiss/dbeaver/ext/postgresql/PostgreUtils.java
+39
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreArrayValueHandler.java
...r/ext/postgresql/model/data/PostgreArrayValueHandler.java
+3
-2
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreGeometryValueHandler.java
...xt/postgresql/model/data/PostgreGeometryValueHandler.java
+17
-7
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreStructValueHandler.java
.../ext/postgresql/model/data/PostgreStructValueHandler.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
...el/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
+1
-1
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/plaintext/PlainTextPresentation.java
...i/controls/resultset/plaintext/PlainTextPresentation.java
+10
-9
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
...rc/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
+16
-5
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/FolderEditor.java
...src/org/jkiss/dbeaver/ui/editors/entity/FolderEditor.java
+7
-1
未找到文件。
plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/ui/resources/bookmarks/BookmarksHandlerImpl.java
浏览文件 @
10705576
...
...
@@ -105,6 +105,7 @@ public class BookmarksHandlerImpl extends AbstractResourceHandler {
public
void
openResource
(
@NotNull
final
IResource
resource
)
throws
CoreException
,
DBException
{
if
(!(
resource
instanceof
IFile
))
{
super
.
openResource
(
resource
);
return
;
}
final
DBNProject
projectNode
=
DBWorkbench
.
getPlatform
().
getNavigatorModel
().
getRoot
().
getProject
(
resource
.
getProject
());
...
...
plugins/org.jkiss.dbeaver.data.gis/src/org/jkiss/dbeaver/data/gis/handlers/GISGeometryTest.java
0 → 100644
浏览文件 @
10705576
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2019 Serge Rider (serge@jkiss.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jkiss.dbeaver.data.gis.handlers
;
import
com.vividsolutions.jts.geom.Geometry
;
import
com.vividsolutions.jts.io.WKTReader
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCAbstractValueHandler
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
java.sql.SQLException
;
/**
* GIS geometry handler
*/
public
class
GISGeometryTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
WKTReader
wktReader
=
new
WKTReader
();
Geometry
g
=
wktReader
.
read
(
"MultiPointZ((1 2 3))"
);
System
.
out
.
println
(
g
);
}
}
plugins/org.jkiss.dbeaver.ext.erd/src/org/jkiss/dbeaver/ext/erd/navigator/ERDResourceHandler.java
浏览文件 @
10705576
...
...
@@ -110,6 +110,7 @@ public class ERDResourceHandler extends AbstractResourceHandler {
public
void
openResource
(
@NotNull
final
IResource
resource
)
throws
CoreException
,
DBException
{
if
(!(
resource
instanceof
IFile
))
{
super
.
openResource
(
resource
);
return
;
}
...
...
plugins/org.jkiss.dbeaver.ext.greenplum/plugin.xml
浏览文件 @
10705576
...
...
@@ -61,7 +61,6 @@
<file
type=
"license"
path=
"drivers/postgresql/LICENSE.txt"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgresql/postgresql.jar"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc.jar"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc-jtsparser.jar"
bundle=
"drivers.postgresql"
/>
<parameter
name=
"serverType"
value=
"greenplum"
/>
<property
name=
"loginTimeout"
value=
"20"
/>
<property
name=
"connectTimeout"
value=
"20"
/>
...
...
plugins/org.jkiss.dbeaver.ext.mssql.ui/src/org/jkiss/dbeaver/ext/mssql/edit/SQLServerTableColumnManager.java
浏览文件 @
10705576
...
...
@@ -66,7 +66,7 @@ public class SQLServerTableColumnManager extends SQLTableColumnManager<SQLServer
}
else
{
// Modify existing column
// TODO: implement default constraint create/drop
//String defaultValue = CommonUtils.toString(column.getDefaultValue()
);
DefaultModifier
.
appendModifier
(
monitor
,
column
,
sql
,
command
);
}
};
...
...
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
浏览文件 @
10705576
...
...
@@ -110,16 +110,24 @@ public class SQLServerDialect extends JDBCSQLDialect {
}
}
}
else
if
(
dataKind
==
DBPDataKind
.
STRING
)
{
if
(
SQLServerConstants
.
TYPE_UNIQUEIDENTIFIER
.
equalsIgnoreCase
(
typeName
))
{
return
null
;
}
long
maxLength
=
column
.
getMaxLength
();
if
(
maxLength
==
0
)
{
return
null
;
}
else
if
(
maxLength
==
-
1
)
{
return
"(MAX)"
;
}
else
{
return
"("
+
maxLength
+
")"
;
switch
(
typeName
)
{
case
"char"
:
case
"nchar"
:
case
"varchar"
:
case
"nvarchar"
:
case
"text"
:
case
"ntext"
:
{
long
maxLength
=
column
.
getMaxLength
();
if
(
maxLength
==
0
)
{
return
null
;
}
else
if
(
maxLength
==
-
1
)
{
return
"(MAX)"
;
}
else
{
return
"("
+
maxLength
+
")"
;
}
}
default
:
return
null
;
}
}
return
super
.
getColumnTypeModifiers
(
dataSource
,
column
,
typeName
,
dataKind
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/plugin.xml
浏览文件 @
10705576
...
...
@@ -236,13 +236,11 @@
<replace
provider=
"generic"
driver=
"postgresql"
/>
<file
type=
"jar"
path=
"maven:/org.postgresql:postgresql:RELEASE[42.2.5]"
bundle=
"!drivers.postgresql"
/>
<file
type=
"jar"
path=
"maven:/net.postgis:postgis-jdbc:RELEASE[2.2.1]"
ignore-dependencies=
"true"
optional=
"true"
bundle=
"!drivers.postgresql"
/>
<file
type=
"jar"
path=
"maven:/net.postgis:postgis-jdbc-jtsparser:RELEASE[2.2.1]"
ignore-dependencies=
"true"
optional=
"true"
bundle=
"!drivers.postgresql"
/>
<file
type=
"license"
path=
"drivers/postgresql/LICENSE.txt"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgresql/postgresql.jar"
bundle=
"drivers.postgresql"
/>
<!-- Postgis -->
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc.jar"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc-jtsparser.jar"
bundle=
"drivers.postgresql"
/>
<parameter
name=
"serverType"
value=
"postgresql"
/>
<property
name=
"loginTimeout"
value=
"20"
/>
...
...
@@ -304,7 +302,6 @@
<file
type=
"license"
path=
"drivers/postgresql/LICENSE.txt"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgresql/postgresql.jar"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc.jar"
bundle=
"drivers.postgresql"
/>
<file
type=
"jar"
path=
"drivers/postgis/postgis-jdbc-jtsparser.jar"
bundle=
"drivers.postgresql"
/>
<parameter
name=
"serverType"
value=
"timescale"
/>
<property
name=
"loginTimeout"
value=
"20"
/>
<property
name=
"connectTimeout"
value=
"20"
/>
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/PostgreConstants.java
浏览文件 @
10705576
...
...
@@ -68,6 +68,7 @@ public class PostgreConstants {
public
static
final
String
PG_OBJECT_CLASS
=
"org.postgresql.util.PGobject"
;
public
static
final
String
PG_ARRAY_CLASS
=
"org.postgresql.jdbc.PgArray"
;
public
static
final
String
PG_INTERVAL_CLASS
=
"org.postgresql.util.PGInterval"
;
public
static
final
String
PG_GEOMETRY_CLASS
=
"org.postgis.PGgeometry"
;
public
static
final
DBDPseudoAttribute
PSEUDO_ATTR_OID
=
new
DBDPseudoAttribute
(
DBDPseudoAttributeType
.
ROWID
,
"oid"
,
"oid"
,
"oid"
,
"Row identifier"
,
false
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/PostgreUtils.java
浏览文件 @
10705576
...
...
@@ -34,9 +34,11 @@ import org.jkiss.dbeaver.model.DBPDataKind;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.connection.DBPDriver
;
import
org.jkiss.dbeaver.model.data.DBDValueHandler
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.edit.DBERegistry
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.AbstractObjectCache
;
...
...
@@ -45,8 +47,10 @@ import org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistActionComment;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObjectEx
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
...
...
@@ -415,7 +419,33 @@ public class PostgreUtils {
}
}
public
static
Object
convertStringToValue
(
DBSTypedObject
itemType
,
String
string
,
boolean
unescape
)
{
public
static
Object
convertStringToValue
(
DBCSession
session
,
DBSTypedObject
itemType
,
String
string
,
boolean
unescape
)
throws
DBCException
{
if
(
itemType
.
getDataKind
()
==
DBPDataKind
.
ARRAY
)
{
if
(
CommonUtils
.
isEmpty
(
string
))
{
return
new
Object
[
0
];
}
else
if
(
string
.
startsWith
(
"{"
)
&&
string
.
endsWith
(
"}"
))
{
DBSDataType
arrayDataType
=
itemType
instanceof
DBSDataType
?
(
DBSDataType
)
itemType
:
((
DBSTypedObjectEx
)
itemType
).
getDataType
();
try
{
DBSDataType
componentType
=
arrayDataType
.
getComponentType
(
session
.
getProgressMonitor
());
if
(
componentType
==
null
)
{
log
.
error
(
"Can't get component type from array '"
+
itemType
.
getFullTypeName
()
+
"'"
);
return
null
;
}
else
{
String
[]
itemStrings
=
parseObjectString
(
string
.
substring
(
1
,
string
.
length
()
-
1
));
Object
[]
itemValues
=
new
Object
[
itemStrings
.
length
];
for
(
int
i
=
0
;
i
<
itemStrings
.
length
;
i
++)
{
itemValues
[
i
]
=
convertStringToValue
(
session
,
componentType
,
itemStrings
[
i
],
unescape
);
}
return
itemValues
;
}
}
catch
(
Exception
e
)
{
throw
new
DBCException
(
"Error extracting array '"
+
itemType
.
getFullTypeName
()
+
"' items"
,
e
);
}
}
else
{
log
.
error
(
"Unsupported array string: '"
+
string
+
"'"
);
return
null
;
}
}
switch
(
itemType
.
getTypeID
())
{
case
Types
.
BOOLEAN
:
return
Boolean
.
valueOf
(
string
);
case
Types
.
TINYINT
:
return
Byte
.
parseByte
(
string
);
...
...
@@ -425,8 +455,14 @@ public class PostgreUtils {
case
Types
.
FLOAT
:
return
Float
.
parseFloat
(
string
);
case
Types
.
REAL
:
case
Types
.
DOUBLE
:
return
Double
.
parseDouble
(
string
);
default
:
return
string
;
default
:
{
DBDValueHandler
valueHandler
=
DBUtils
.
findValueHandler
(
session
,
itemType
);
if
(
valueHandler
!=
null
)
{
return
valueHandler
.
getValueFromObject
(
session
,
itemType
,
string
,
false
);
}
else
{
return
string
;
}
}
}
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreArrayValueHandler.java
浏览文件 @
10705576
...
...
@@ -17,6 +17,7 @@
package
org.jkiss.dbeaver.ext.postgresql.model.data
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreConstants
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreUtils
;
import
org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource
;
...
...
@@ -73,7 +74,7 @@ public class PostgreArrayValueHandler extends JDBCArrayValueHandler {
return
super
.
getValueFromObject
(
session
,
type
,
object
,
copy
);
}
private
JDBCCollection
convertStringToArray
(
@NotNull
DBCSession
session
,
@NotNull
PostgreDataType
itemType
,
@NotNull
String
value
)
{
private
JDBCCollection
convertStringToArray
(
@NotNull
DBCSession
session
,
@NotNull
PostgreDataType
itemType
,
@NotNull
String
value
)
throws
DBCException
{
List
<
String
>
strings
=
new
ArrayList
<>(
10
);
StringTokenizer
st
=
new
StringTokenizer
(
value
,
" "
);
while
(
st
.
hasMoreTokens
())
{
...
...
@@ -81,7 +82,7 @@ public class PostgreArrayValueHandler extends JDBCArrayValueHandler {
}
Object
[]
contents
=
new
Object
[
strings
.
size
()];
for
(
int
i
=
0
;
i
<
strings
.
size
();
i
++)
{
contents
[
i
]
=
PostgreUtils
.
convertStringToValue
(
itemType
,
strings
.
get
(
i
),
false
);
contents
[
i
]
=
PostgreUtils
.
convertStringToValue
(
session
,
itemType
,
strings
.
get
(
i
),
false
);
}
return
new
JDBCCollection
(
itemType
,
DBUtils
.
findValueHandler
(
session
,
itemType
),
contents
);
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreGeometryValueHandler.java
浏览文件 @
10705576
...
...
@@ -17,15 +17,13 @@
package
org.jkiss.dbeaver.ext.postgresql.model.data
;
import
com.vividsolutions.jts.geom.Geometry
;
import
org.jkiss.dbeaver.data.gis.handlers.GISGeometryValueHandler
;
import
org.jkiss.dbeaver.data.gis.handlers.GeometryConverter
;
import
org.jkiss.dbeaver.ext.postgresql.PostgreConstants
;
import
org.jkiss.dbeaver.model.DBUtils
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.impl.data.formatters.BinaryFormatterHex
;
import
org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCAbstractValueHandler
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.utils.BeanUtils
;
...
...
@@ -44,7 +42,7 @@ public class PostgreGeometryValueHandler extends JDBCAbstractValueHandler {
@Override
protected
Object
fetchColumnValue
(
DBCSession
session
,
JDBCResultSet
resultSet
,
DBSTypedObject
type
,
int
index
)
throws
DBCException
,
SQLException
{
return
getValueFromObject
(
session
,
type
,
resultSet
.
get
String
(
index
),
resultSet
.
get
Object
(
index
),
false
);
}
...
...
@@ -54,8 +52,10 @@ public class PostgreGeometryValueHandler extends JDBCAbstractValueHandler {
statement
.
setNull
(
paramIndex
,
paramType
.
getTypeID
());
}
else
if
(
value
instanceof
Geometry
)
{
statement
.
setObject
(
paramIndex
,
getStringFromGeometry
(
session
,
(
Geometry
)
value
),
Types
.
OTHER
);
}
else
if
(
value
.
getClass
().
getName
().
equals
(
PostgreConstants
.
PG_GEOMETRY_CLASS
))
{
statement
.
setObject
(
paramIndex
,
value
,
Types
.
OTHER
);
}
else
{
throw
new
DBCException
(
"Invalid geometry object: "
+
value
);
statement
.
setObject
(
paramIndex
,
value
.
toString
(),
Types
.
OTHER
);
}
}
...
...
@@ -72,17 +72,27 @@ public class PostgreGeometryValueHandler extends JDBCAbstractValueHandler {
return
object
;
}
else
if
(
object
instanceof
String
)
{
return
makeGeometryFromString
(
session
,
(
String
)
object
);
}
else
if
(
object
.
getClass
().
getName
().
equals
(
PostgreConstants
.
PG_GEOMETRY_CLASS
))
{
return
makeGeometryFromPGGeometry
(
session
,
object
);
}
else
{
return
makeGeometryFromString
(
session
,
object
.
toString
());
}
}
private
Object
makeGeometryFromPGGeometry
(
DBCSession
session
,
Object
pgGeometry
)
throws
DBCException
{
try
{
return
BeanUtils
.
invokeObjectMethod
(
pgGeometry
,
"getGeometry"
,
null
,
null
);
}
catch
(
Throwable
e
)
{
throw
new
DBCException
(
e
,
session
.
getDataSource
());
}
}
private
Object
makeGeometryFromString
(
DBCSession
session
,
String
object
)
throws
DBCException
{
if
(
CommonUtils
.
isEmpty
(
object
))
{
return
null
;
}
try
{
Class
<?>
jtsGeometry
=
DBUtils
.
getDriverClass
(
session
.
getDataSource
(),
"org.postgis.jts.JtsGeometry"
);
Class
<?>
jtsGeometry
=
DBUtils
.
getDriverClass
(
session
.
getDataSource
(),
PostgreConstants
.
PG_GEOMETRY_CLASS
);
return
BeanUtils
.
invokeStaticMethod
(
jtsGeometry
,
"geomFromString"
,
new
Class
[]
{
String
.
class
},
new
Object
[]
{
object
}
);
...
...
@@ -93,7 +103,7 @@ public class PostgreGeometryValueHandler extends JDBCAbstractValueHandler {
private
String
getStringFromGeometry
(
JDBCSession
session
,
Geometry
geometry
)
throws
DBCException
{
try
{
Class
<?>
jtsGeometry
=
DBUtils
.
getDriverClass
(
session
.
getDataSource
(),
"org.postgis.jts.JtsGeometry"
);
Class
<?>
jtsGeometry
=
DBUtils
.
getDriverClass
(
session
.
getDataSource
(),
PostgreConstants
.
PG_GEOMETRY_CLASS
);
Object
jtsg
=
jtsGeometry
.
getConstructor
(
Geometry
.
class
).
newInstance
(
geometry
);
return
(
String
)
BeanUtils
.
invokeObjectMethod
(
jtsg
,
"getValue"
,
null
,
null
);
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/data/PostgreStructValueHandler.java
浏览文件 @
10705576
...
...
@@ -115,7 +115,7 @@ public class PostgreStructValueHandler extends JDBCStructValueHandler {
Iterator
<
PostgreDataTypeAttribute
>
attrIter
=
attributes
.
iterator
();
for
(
int
i
=
0
;
i
<
parsedValues
.
length
&&
attrIter
.
hasNext
();
i
++)
{
final
PostgreDataTypeAttribute
itemAttr
=
attrIter
.
next
();
attrValues
[
i
]
=
PostgreUtils
.
convertStringToValue
(
itemAttr
,
parsedValues
[
i
],
true
);
attrValues
[
i
]
=
PostgreUtils
.
convertStringToValue
(
session
,
itemAttr
,
parsedValues
[
i
],
true
);
}
Struct
contents
=
new
JDBCStructImpl
(
compType
.
getTypeName
(),
attrValues
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/navigator/DBNResource.java
浏览文件 @
10705576
...
...
@@ -87,7 +87,7 @@ public class DBNResource extends DBNNode// implements IContributorResourceAdapte
}
@Override
@Property
(
viewable
=
true
,
order
=
1
)
@Property
(
id
=
DBConstants
.
PROP_ID_NAME
,
viewable
=
true
,
order
=
1
)
public
String
getNodeName
()
{
if
(
resource
==
null
||
handler
==
null
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/plaintext/PlainTextPresentation.java
浏览文件 @
10705576
...
...
@@ -266,23 +266,23 @@ public class PlainTextPresentation extends AbstractPresentation implements IAdap
List
<
DBDAttributeBinding
>
attrs
=
model
.
getVisibleAttributes
();
List
<
ResultSetRow
>
allRows
=
model
.
getAllRows
();
int
extraSpacesNum
=
extraSpaces
?
2
:
0
;
if
(
colWidths
==
null
)
{
// Calculate column widths
colWidths
=
new
int
[
attrs
.
size
()];
for
(
int
i
=
0
;
i
<
attrs
.
size
();
i
++)
{
DBDAttributeBinding
attr
=
attrs
.
get
(
i
);
colWidths
[
i
]
=
getAttributeName
(
attr
).
length
();
colWidths
[
i
]
=
getAttributeName
(
attr
).
length
()
+
extraSpacesNum
;
if
(
showNulls
&&
!
attr
.
isRequired
())
{
colWidths
[
i
]
=
Math
.
max
(
colWidths
[
i
],
DBConstants
.
NULL_VALUE_LABEL
.
length
());
}
for
(
ResultSetRow
row
:
allRows
)
{
String
displayString
=
getCellString
(
model
,
attr
,
row
,
displayFormat
);
colWidths
[
i
]
=
Math
.
max
(
colWidths
[
i
],
getStringWidth
(
displayString
));
colWidths
[
i
]
=
Math
.
max
(
colWidths
[
i
],
getStringWidth
(
displayString
)
+
extraSpacesNum
);
}
}
for
(
int
i
=
0
;
i
<
colWidths
.
length
;
i
++)
{
if
(
extraSpaces
)
colWidths
[
i
]++;
if
(
colWidths
[
i
]
>
maxColumnSize
)
{
colWidths
[
i
]
=
maxColumnSize
;
}
...
...
@@ -294,12 +294,14 @@ public class PlainTextPresentation extends AbstractPresentation implements IAdap
if
(
delimLeading
)
grid
.
append
(
"|"
);
for
(
int
i
=
0
;
i
<
attrs
.
size
();
i
++)
{
if
(
i
>
0
)
grid
.
append
(
"|"
);
if
(
extraSpaces
)
grid
.
append
(
" "
);
DBDAttributeBinding
attr
=
attrs
.
get
(
i
);
String
attrName
=
getAttributeName
(
attr
);
grid
.
append
(
attrName
);
for
(
int
k
=
colWidths
[
i
]
-
attrName
.
length
();
k
>
0
;
k
--)
{
for
(
int
k
=
colWidths
[
i
]
-
attrName
.
length
()
-
extraSpacesNum
;
k
>
0
;
k
--)
{
grid
.
append
(
" "
);
}
if
(
extraSpaces
)
grid
.
append
(
" "
);
}
if
(
delimTrailing
)
grid
.
append
(
"|"
);
grid
.
append
(
"\n"
);
...
...
@@ -334,25 +336,24 @@ public class PlainTextPresentation extends AbstractPresentation implements IAdap
}
int
stringWidth
=
getStringWidth
(
displayString
);
if
(
extraSpaces
)
stringWidth
++;
if
(
extraSpaces
)
grid
.
append
(
" "
);
DBPDataKind
dataKind
=
attr
.
getDataKind
();
if
((
dataKind
==
DBPDataKind
.
NUMERIC
&&
rightJustifyNumbers
)
||
(
dataKind
==
DBPDataKind
.
DATETIME
&&
rightJustifyDateTime
))
{
// Right justify value
for
(
int
j
=
colWidths
[
k
]
-
stringWidth
;
j
>
0
;
j
--)
{
for
(
int
j
=
colWidths
[
k
]
-
stringWidth
-
extraSpacesNum
;
j
>
0
;
j
--)
{
grid
.
append
(
" "
);
}
grid
.
append
(
displayString
);
if
(
extraSpaces
)
grid
.
append
(
" "
);
}
else
{
if
(
extraSpaces
)
grid
.
append
(
" "
);
grid
.
append
(
displayString
);
for
(
int
j
=
colWidths
[
k
]
-
stringWidth
;
j
>
0
;
j
--)
{
for
(
int
j
=
colWidths
[
k
]
-
stringWidth
-
extraSpacesNum
;
j
>
0
;
j
--)
{
grid
.
append
(
" "
);
}
}
if
(
extraSpaces
)
grid
.
append
(
" "
);
}
if
(
delimTrailing
)
grid
.
append
(
"|"
);
grid
.
append
(
"\n"
);
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/editors/BaseValueEditor.java
浏览文件 @
10705576
...
...
@@ -27,7 +27,9 @@ import org.eclipse.swt.events.TraverseListener;
import
org.eclipse.swt.widgets.*
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCResultSetImpl
;
import
org.jkiss.dbeaver.runtime.DBWorkbench
;
import
org.jkiss.dbeaver.ui.UIUtils
;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetPreferences
;
...
...
@@ -44,6 +46,8 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
private
static
final
String
RESULTS_EDIT_CONTEXT_ID
=
"org.jkiss.dbeaver.ui.context.resultset.edit"
;
private
static
final
Log
log
=
Log
.
getLog
(
BaseValueEditor
.
class
);
protected
final
IValueController
valueController
;
protected
T
control
;
protected
boolean
dirty
;
...
...
@@ -142,7 +146,7 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
// Check new focus control in async mode
// (because right now focus is still on edit control)
if
(!
valueController
.
isReadOnly
())
{
saveValue
();
saveValue
(
false
);
}
if
(
valueController
instanceof
IMultiController
)
{
((
IMultiController
)
valueController
).
closeInlineEditor
();
...
...
@@ -151,8 +155,11 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
});
}
protected
void
saveValue
()
{
protected
void
saveValue
()
{
saveValue
(
true
);
}
protected
void
saveValue
(
boolean
showError
)
{
try
{
Object
newValue
=
extractEditorValue
();
if
(
dirty
||
control
instanceof
Combo
||
control
instanceof
CCombo
||
control
instanceof
List
)
{
...
...
@@ -163,7 +170,11 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
if
(
valueController
instanceof
IMultiController
)
{
((
IMultiController
)
valueController
).
closeInlineEditor
();
}
DBWorkbench
.
getPlatformUI
().
showError
(
"Value save"
,
"Can't save edited value"
,
e
);
if
(
showError
)
{
DBWorkbench
.
getPlatformUI
().
showError
(
"Value save"
,
"Can't save edited value"
,
e
);
}
else
{
log
.
debug
(
"Error saving value: "
+
e
.
getMessage
());
}
}
}
...
...
@@ -195,7 +206,7 @@ public abstract class BaseValueEditor<T extends Control> implements IValueEditor
}
setDirty
(
true
);
if
(
autoSaveEnabled
&&
DBWorkbench
.
getPlatform
().
getPreferenceStore
().
getBoolean
(
ResultSetPreferences
.
RS_EDIT_AUTO_UPDATE_VALUE
))
{
saveValue
();
saveValue
(
false
);
}
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/editors/entity/FolderEditor.java
浏览文件 @
10705576
...
...
@@ -16,6 +16,7 @@
*/
package
org.jkiss.dbeaver.ui.editors.entity
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.runtime.IProgressMonitor
;
import
org.eclipse.jface.action.IContributionManager
;
import
org.eclipse.jface.action.Separator
;
...
...
@@ -212,7 +213,7 @@ public class FolderEditor extends EditorPart implements INavigatorModelView, IRe
@Override
protected
void
openNodeEditor
(
DBNNode
node
)
{
final
DBNNode
rootNode
=
getRootNode
();
if
(!
(
node
instanceof
DBNDatabaseN
ode
))
{
if
(!
canOpenNode
(
n
ode
))
{
if
(
node
instanceof
DBNRoot
)
{
if
(
rootNode
instanceof
DBNLocalFolder
)
{
node
=
((
DBNLocalFolder
)
rootNode
).
getLogicalParent
();
...
...
@@ -261,4 +262,9 @@ public class FolderEditor extends EditorPart implements INavigatorModelView, IRe
}
}
private
boolean
canOpenNode
(
DBNNode
node
)
{
return
node
instanceof
DBNDatabaseNode
||
(
node
instanceof
DBNResource
&&
((
DBNResource
)
node
).
getResource
()
instanceof
IFile
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录