Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
5f48478f
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,发现更多精彩内容 >>
提交
5f48478f
编写于
9月 08, 2020
作者:
L
LonwoLonwo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#6178 sql server simple data type DDL added
上级
5d2e1cfe
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
155 addition
and
30 deletion
+155
-30
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle.properties
...g.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle.properties
+2
-0
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_de.properties
...kiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_de.properties
+8
-0
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_ru.properties
...kiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_ru.properties
+10
-1
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/SQLServerConstants.java
...l/src/org/jkiss/dbeaver/ext/mssql/SQLServerConstants.java
+16
-0
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDataSource.java
...rg/jkiss/dbeaver/ext/mssql/model/SQLServerDataSource.java
+3
-1
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDataType.java
.../org/jkiss/dbeaver/ext/mssql/model/SQLServerDataType.java
+53
-26
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
...c/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
+6
-2
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerTypedObject.java
...g/jkiss/dbeaver/ext/mssql/model/SQLServerTypedObject.java
+57
-0
未找到文件。
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle.properties
浏览文件 @
5f48478f
...
...
@@ -82,6 +82,8 @@ meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.fullTypeName.name = Typ
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.nullable.name
=
Nullable
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.collationName.name
=
Collation
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.assemblyType.name
=
Assembly Type
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.name
=
Table type
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.description
=
Is data type - table type
meta.org.jkiss.dbeaver.ext.mssql.model.session.SQLServerSession.id.name
=
ID
meta.org.jkiss.dbeaver.ext.mssql.model.session.SQLServerSession.hostName.name
=
Host
...
...
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_de.properties
浏览文件 @
5f48478f
...
...
@@ -12,6 +12,14 @@ meta.org.jkiss.dbeaver.ext.mssql.model.generic.SQLServerGenericSynonym.targetObj
meta.org.jkiss.dbeaver.ext.mssql.model.generic.SQLServerGenericTable.description.description
=
Tabellenbeschreibung
meta.org.jkiss.dbeaver.ext.mssql.model.generic.SQLServerGenericTable.description.name
=
Beschreibung
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.maxLength.name
=
L
\u
00E4nge
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.scale.name
=
Scala
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.precision.name
=
Pr
\u
00E4zision
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.fullTypeName.name
=
Typ
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.collationName.name
=
Kollation
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.name
=
Tabellentyp
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.description
=
Ist Datentyp - Tabellentyp
sqlserver.dialog.connection.header
=
SQL Server Verbindungseinstellungen
sybase.dialog.connection.header
=
Sybase Verbindungseinstellungen
...
...
plugins/org.jkiss.dbeaver.ext.mssql/OSGI-INF/l10n/bundle_ru.properties
浏览文件 @
5f48478f
...
...
@@ -7,4 +7,13 @@ driver.sqlserver.description=Microsoft JDBC \u0434\u0440\u0430\u0439\u0432\u0435
driver.jTDS.description
=
\u0414\u0440\u0430\u0439\u0432\u0435\u0440
jTDS SQL Server (MSSQL)
driver.sqlserver.old.description
=
\u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0439
\u0434\u0440\u0430\u0439\u0432\u0435\u0440
Microsoft JDBC
\u0434\u
043B
\u
044F SQL Server (MSSQL).
\u0418\u0441\u
043F
\u
043E
\u
043B
\u
044C
\u0437\u0443\u0439\u0442\u0435
\u0435\u0433\u
043E
\u0434\u
043B
\u
044F SQL server
\u
043F
\u
043E
\u0437\u0434\u
043D
\u0435\u0435
2005
\u0433\u
043E
\u0434\u0430
\u0438\u
043B
\u0438
\u0435\u0441\u
043B
\u0438
\u0441\u0442\u0430\u
043D
\u0434\u0430\u0440\u0442\u
043D
\u
044B
\u0435
\u0434\u0440\u0430\u0439\u0432\u0435\u0440\u
044B
\u
043D
\u0435
\u0440\u0430\u0431\u
043E
\u0442\u0430\u
044E
\u0442
.
meta.org.jkiss.dbeaver.ext.mssql.tasks.SQLServerToolWithStatus$
ToolStatus.message.name
=
\u0421\u
043E
\u
043E
\u0431\u0449\u0435\u
043D
\u0438\u0435
\ No newline at end of file
meta.org.jkiss.dbeaver.ext.mssql.tasks.SQLServerToolWithStatus$
ToolStatus.message.name
=
\u0421\u
043E
\u
043E
\u0431\u0449\u0435\u
043D
\u0438\u0435
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.schema.name
=
\u0421\u0445\u0435\u
043C
\u0430
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.name.name
=
\u0418\u
043C
\u
044F
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.maxLength.name
=
\u0414\u
043B
\u0438\u
043D
\u0430
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.scale.name
=
\u
041C
\u0430\u0441\u0448\u0442\u0430\u0431
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.precision.name
=
\u0422\u
043E
\u0447\u
043D
\u
043E
\u0441\u0442\u
044C
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.fullTypeName.name
=
\u0422\u0438\u
043F
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.name
=
\u0422\u0430\u0431\u
043B
\u0438\u0447\u
043D
\u
044B
\u0439
\u0442\u0438\u
043F
meta.org.jkiss.dbeaver.ext.mssql.model.SQLServerDataType.tableType.description
=
\u
042F
\u0432\u
043B
\u
044F
\u0435\u0442\u0441\u
044F
\u
043B
\u0438
\u0442\u0438\u
043F
\u0442\u0430\u0431\u
043B
\u0438\u0447\u
043D
\u
044B
\u
043C
\ No newline at end of file
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/SQLServerConstants.java
浏览文件 @
5f48478f
...
...
@@ -54,6 +54,22 @@ public class SQLServerConstants {
public
static
final
String
TYPE_GEOGRAPHY
=
"geography"
;
public
static
final
String
TYPE_TIMESTAMP
=
"timestamp"
;
public
static
final
String
TYPE_IMAGE
=
"image"
;
public
static
final
String
TYPE_TINYINT
=
"tinyint"
;
public
static
final
String
TYPE_SMALLINT
=
"smallint"
;
public
static
final
String
TYPE_INT
=
"int"
;
public
static
final
String
TYPE_REAL
=
"real"
;
public
static
final
String
TYPE_MONEY
=
"money"
;
public
static
final
String
TYPE_FLOAT
=
"float"
;
public
static
final
String
TYPE_SQL_VARIANT
=
"sql_variant"
;
public
static
final
String
TYPE_BIT
=
"bit"
;
public
static
final
String
TYPE_DECIMAL
=
"decimal"
;
public
static
final
String
TYPE_NUMERIC
=
"numeric"
;
public
static
final
String
TYPE_SMALLMONEY
=
"smallmoney"
;
public
static
final
String
TYPE_BIGINT
=
"bigint"
;
public
static
final
String
TYPE_VARBINARY
=
"varbinary"
;
public
static
final
String
TYPE_BINARY
=
"binary"
;
public
static
final
String
TYPE_HIERARCHYID
=
"hierarchyid"
;
public
static
final
String
TYPE_XML
=
"xml"
;
public
static
final
String
PROP_AUTHENTICATION
=
DBConstants
.
INTERNAL_PROP_PREFIX
+
"authentication@"
;
public
static
final
String
PROP_SHOW_ALL_SCHEMAS
=
DBConstants
.
INTERNAL_PROP_PREFIX
+
"show-all-schemas@"
;
...
...
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDataSource.java
浏览文件 @
5f48478f
...
...
@@ -203,7 +203,9 @@ public class SQLServerDataSource extends JDBCDataSource implements DBSInstanceCo
return
dt
;
}
}
log
.
debug
(
"System data type "
+
systemTypeId
+
" not found"
);
if
(
systemTypeId
!=
243
)
{
// 243 - ID of user defined types
log
.
debug
(
"System data type "
+
systemTypeId
+
" not found"
);
}
SQLServerDataType
sdt
=
new
SQLServerDataType
(
this
,
String
.
valueOf
(
systemTypeId
),
systemTypeId
,
DBPDataKind
.
OBJECT
,
java
.
sql
.
Types
.
OTHER
);
dataTypeCache
.
cacheObject
(
sdt
);
return
sdt
;
...
...
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDataType.java
浏览文件 @
5f48478f
...
...
@@ -28,12 +28,14 @@ import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.dbeaver.model.struct.DBSDataType
;
import
org.jkiss.dbeaver.model.struct.DBSObject
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
java.sql.ResultSet
;
import
java.sql.Types
;
import
java.util.Locale
;
import
java.util.Map
;
/**
...
...
@@ -56,6 +58,7 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
private
boolean
nullable
;
private
boolean
userType
;
private
boolean
assemblyType
;
private
boolean
tableType
;
private
String
collationName
;
private
boolean
persisted
;
...
...
@@ -74,6 +77,7 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
this
.
nullable
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"is_nullable"
)
!=
0
;
this
.
userType
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"is_user_defined"
)
!=
0
;
this
.
assemblyType
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"is_assembly_type"
)
!=
0
;
this
.
tableType
=
JDBCUtils
.
safeGetInt
(
dbResult
,
"is_table_type"
)
!=
0
;
this
.
collationName
=
JDBCUtils
.
safeGetString
(
dbResult
,
"collation_name"
);
...
...
@@ -133,7 +137,25 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
@Override
@Property
(
hidden
=
true
,
editable
=
true
,
updatable
=
true
,
order
=
-
1
)
public
String
getObjectDefinitionText
(
DBRProgressMonitor
monitor
,
Map
<
String
,
Object
>
options
)
throws
DBCException
{
return
""
;
StringBuilder
sql
=
new
StringBuilder
();
sql
.
append
(
"-- DROP TYPE "
).
append
(
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
)).
append
(
";\n\n"
);
//$NON-NLS-1$ //$NON-NLS-2$
if
(!
tableType
)
{
sql
.
append
(
"CREATE TYPE "
).
append
(
getFullyQualifiedName
(
DBPEvaluationContext
.
DDL
)).
append
(
"\n"
).
append
(
"FROM "
);
SQLServerDataType
systemDataType
=
getSystemDataType
();
String
typeName
=
systemDataType
.
getName
();
sql
.
append
(
typeName
.
toUpperCase
(
Locale
.
ENGLISH
));
SQLServerTypedObject
serverTypedObjects
=
new
SQLServerTypedObject
(
typeName
,
getDataTypeIDByName
(
typeName
),
dataKind
,
scale
,
precision
,
maxLength
);
String
modifiers
=
SQLUtils
.
getColumnTypeModifiers
(
getDataSource
(),
serverTypedObjects
,
typeName
,
dataKind
);
if
(
modifiers
!=
null
)
{
sql
.
append
(
modifiers
);
}
if
(!
nullable
)
{
sql
.
append
(
" NOT NULL;"
);
}
}
else
{
sql
.
append
(
"-- Table types DDL not yet available"
);
}
return
sql
.
toString
();
}
@Override
...
...
@@ -196,6 +218,11 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
}
@Property
(
viewable
=
false
,
order
=
25
)
public
boolean
isTableType
()
{
return
tableType
;
}
@Property
(
viewable
=
false
,
order
=
26
)
public
String
getCollationName
()
{
return
collationName
;
}
...
...
@@ -255,24 +282,24 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
public
static
DBPDataKind
getDataKindByName
(
String
systemTypeName
)
{
switch
(
systemTypeName
)
{
case
"char"
:
case
"nchar"
:
case
"ntext"
:
case
"nvarchar"
:
case
"varchar"
:
case
"text"
:
case
SQLServerConstants
.
TYPE_CHAR
:
case
SQLServerConstants
.
TYPE_NCHAR
:
case
SQLServerConstants
.
TYPE_NTEXT
:
case
SQLServerConstants
.
TYPE_NVARCHAR
:
case
SQLServerConstants
.
TYPE_VARCHAR
:
case
SQLServerConstants
.
TYPE_TEXT
:
case
"sysname"
:
return
DBPDataKind
.
STRING
;
case
"tinyint"
:
case
"bigint"
:
case
"bit"
:
case
"int"
:
case
"numeric"
:
case
"real"
:
case
"smallint"
:
case
"decimal"
:
case
"float"
:
case
SQLServerConstants
.
TYPE_TINYINT
:
case
SQLServerConstants
.
TYPE_BIGINT
:
case
SQLServerConstants
.
TYPE_BIT
:
case
SQLServerConstants
.
TYPE_INT
:
case
SQLServerConstants
.
TYPE_NUMERIC
:
case
SQLServerConstants
.
TYPE_REAL
:
case
SQLServerConstants
.
TYPE_SMALLINT
:
case
SQLServerConstants
.
TYPE_DECIMAL
:
case
SQLServerConstants
.
TYPE_FLOAT
:
return
DBPDataKind
.
NUMERIC
;
case
SQLServerConstants
.
TYPE_DATETIME
:
...
...
@@ -285,28 +312,28 @@ public class SQLServerDataType implements DBSDataType, SQLServerObject, DBPQuali
case
SQLServerConstants
.
TYPE_DATETIMEOFFSET
:
return
DBPDataKind
.
STRING
;
case
"binary"
:
case
"timestamp"
:
case
SQLServerConstants
.
TYPE_BINARY
:
case
SQLServerConstants
.
TYPE_TIMESTAMP
:
return
DBPDataKind
.
BINARY
;
case
"image"
:
case
"varbinary"
:
case
SQLServerConstants
.
TYPE_IMAGE
:
case
SQLServerConstants
.
TYPE_VARBINARY
:
return
DBPDataKind
.
CONTENT
;
case
"uniqueidentifier"
:
case
SQLServerConstants
.
TYPE_UNIQUEIDENTIFIER
:
return
DBPDataKind
.
STRING
;
case
SQLServerConstants
.
TYPE_GEOGRAPHY
:
case
SQLServerConstants
.
TYPE_GEOMETRY
:
case
"hierarchyid"
:
case
SQLServerConstants
.
TYPE_HIERARCHYID
:
return
DBPDataKind
.
BINARY
;
case
"money"
:
case
"smallmoney"
:
case
"sql_variant"
:
case
SQLServerConstants
.
TYPE_MONEY
:
case
SQLServerConstants
.
TYPE_SMALLMONEY
:
case
SQLServerConstants
.
TYPE_SQL_VARIANT
:
return
DBPDataKind
.
OBJECT
;
case
"xml"
:
case
SQLServerConstants
.
TYPE_XML
:
return
DBPDataKind
.
CONTENT
;
default
:
...
...
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerDialect.java
浏览文件 @
5f48478f
...
...
@@ -174,7 +174,9 @@ public class SQLServerDialect extends JDBCSQLDialect {
@Override
public
String
getColumnTypeModifiers
(
DBPDataSource
dataSource
,
@NotNull
DBSTypedObject
column
,
@NotNull
String
typeName
,
@NotNull
DBPDataKind
dataKind
)
{
if
(
dataKind
==
DBPDataKind
.
DATETIME
)
{
if
(
SQLServerConstants
.
TYPE_DATETIME2
.
equalsIgnoreCase
(
typeName
))
{
if
(
SQLServerConstants
.
TYPE_DATETIME2
.
equalsIgnoreCase
(
typeName
)
||
SQLServerConstants
.
TYPE_TIME
.
equalsIgnoreCase
(
typeName
)
||
SQLServerConstants
.
TYPE_DATETIMEOFFSET
.
equalsIgnoreCase
(
typeName
))
{
Integer
scale
=
column
.
getScale
();
if
(
scale
!=
null
&&
scale
!=
0
)
{
return
"("
+
scale
+
')'
;
...
...
@@ -185,7 +187,9 @@ public class SQLServerDialect extends JDBCSQLDialect {
case
SQLServerConstants
.
TYPE_CHAR
:
case
SQLServerConstants
.
TYPE_NCHAR
:
case
SQLServerConstants
.
TYPE_VARCHAR
:
case
SQLServerConstants
.
TYPE_NVARCHAR
:
{
case
SQLServerConstants
.
TYPE_NVARCHAR
:
case
SQLServerConstants
.
TYPE_SQL_VARIANT
:
case
SQLServerConstants
.
TYPE_VARBINARY
:{
long
maxLength
=
column
.
getMaxLength
();
if
(
maxLength
==
0
)
{
return
null
;
...
...
plugins/org.jkiss.dbeaver.ext.mssql/src/org/jkiss/dbeaver/ext/mssql/model/SQLServerTypedObject.java
0 → 100644
浏览文件 @
5f48478f
package
org.jkiss.dbeaver.ext.mssql.model
;
import
org.jkiss.dbeaver.model.DBPDataKind
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
public
class
SQLServerTypedObject
implements
DBSTypedObject
{
private
String
typeName
;
private
int
typeId
;
private
DBPDataKind
dataKind
;
private
int
scale
;
private
int
precision
;
private
int
maxLength
;
public
SQLServerTypedObject
(
String
typeName
,
int
typeId
,
DBPDataKind
dataKind
,
int
scale
,
int
precision
,
int
maxLength
)
{
this
.
typeName
=
typeName
;
this
.
typeId
=
typeId
;
this
.
dataKind
=
dataKind
;
this
.
scale
=
scale
;
this
.
precision
=
precision
;
this
.
maxLength
=
maxLength
;
}
@Override
public
String
getTypeName
()
{
return
typeName
;
}
@Override
public
String
getFullTypeName
()
{
return
typeName
;
}
@Override
public
int
getTypeID
()
{
return
typeId
;
}
@Override
public
DBPDataKind
getDataKind
()
{
return
dataKind
;
}
@Override
public
Integer
getScale
()
{
return
scale
;
}
@Override
public
Integer
getPrecision
()
{
return
precision
;
}
@Override
public
long
getMaxLength
()
{
return
maxLength
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录