Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
57d5928d
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,发现更多精彩内容 >>
提交
57d5928d
编写于
5月 12, 2021
作者:
N
Nikita Akilov
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'devel' into ora-procedure#11357
Former-commit-id:
a5d2e021
上级
d3aa1a7c
64f1d744
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
272 addition
and
77 deletion
+272
-77
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
+10
-0
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
...r.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
+2
-1
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2SQLDialect.java
....ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2SQLDialect.java
+17
-9
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
.../org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
+12
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreForeignKeyManager.java
...dbeaver/ext/postgresql/edit/PostgreForeignKeyManager.java
+7
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreDialect.java
...rg/jkiss/dbeaver/ext/postgresql/model/PostgreDialect.java
+6
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreExecutionContext.java
...dbeaver/ext/postgresql/model/PostgreExecutionContext.java
+3
-2
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/edit/VerticaSequenceManager.java
...kiss/dbeaver/ext/vertica/edit/VerticaSequenceManager.java
+11
-11
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/model/VerticaSQLDialect.java
...rg/jkiss/dbeaver/ext/vertica/model/VerticaSQLDialect.java
+1
-0
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/model/VerticaSequence.java
.../org/jkiss/dbeaver/ext/vertica/model/VerticaSequence.java
+44
-13
plugins/org.jkiss.dbeaver.model.sql/src/org/jkiss/dbeaver/model/sql/parser/rules/SQLMultiWordRule.java
...kiss/dbeaver/model/sql/parser/rules/SQLMultiWordRule.java
+82
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCSQLDialect.java
...src/org/jkiss/dbeaver/model/impl/jdbc/JDBCSQLDialect.java
+1
-1
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/runtime/BlockCanceler.java
...el/src/org/jkiss/dbeaver/model/runtime/BlockCanceler.java
+3
-0
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
...eaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
+0
-3
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/lightgrid/GridCellRenderer.java
...jkiss/dbeaver/ui/controls/lightgrid/GridCellRenderer.java
+6
-1
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
.../jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
+1
-0
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetFindReplaceTarget.java
...s/resultset/spreadsheet/SpreadsheetFindReplaceTarget.java
+1
-1
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
...ntrols/resultset/spreadsheet/SpreadsheetPresentation.java
+1
-1
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/valuefilter/GenericFilterValueEdit.java
...ontrols/resultset/valuefilter/GenericFilterValueEdit.java
+3
-1
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
...s.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
+5
-0
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/itemlist/ItemListControl.java
.../jkiss/dbeaver/ui/navigator/itemlist/ItemListControl.java
+3
-2
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
...g/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
+53
-28
未找到文件。
bundles/org.jkiss.utils/src/org/jkiss/utils/CommonUtils.java
浏览文件 @
57d5928d
...
...
@@ -476,6 +476,16 @@ public class CommonUtils {
}
}
public
static
boolean
isNaN
(
@Nullable
Object
value
)
{
return
(
value
instanceof
Float
&&
((
Float
)
value
).
isNaN
())
||
(
value
instanceof
Double
&&
((
Double
)
value
).
isNaN
());
}
public
static
boolean
isInfinite
(
@Nullable
Object
value
)
{
return
(
value
instanceof
Float
&&
((
Float
)
value
).
isInfinite
())
||
(
value
instanceof
Double
&&
((
Double
)
value
).
isInfinite
());
}
@NotNull
public
static
String
toHexString
(
@Nullable
byte
[]
bytes
)
{
return
bytes
==
null
?
""
:
toHexString
(
bytes
,
0
,
bytes
.
length
);
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2Constants.java
浏览文件 @
57d5928d
...
...
@@ -122,7 +122,8 @@ public class DB2Constants {
"RESULT"
,
"RESULT_SET_LOCATOR"
,
"RETURN"
,
"RETURNS"
,
"ROUTINE"
,
"ROW"
,
"RRN"
,
"RUN"
,
"SAVEPOINT"
,
"SCRATCHPAD"
,
"SECOND"
,
"SECONDS"
,
"SECQTY"
,
"SECURITY"
,
"SENSITIVE"
,
"SIGNAL"
,
"SIMPLE"
,
"SOURCE"
,
"SPECIFIC"
,
"SQLID"
,
"STANDARD"
,
"START"
,
"STARTING"
,
"STATIC"
,
"STAY"
,
"STOGROUP"
,
"STORES"
,
"STYLE"
,
"SUBPAGES"
,
"SYNONYM"
,
"SYSTEM"
,
"TABLESPACE"
,
"TRIGGER"
,
"TYPE"
,
"UNDO"
,
"UNTIL"
,
"VALIDPROC"
,
"VARIABLE"
,
"VARIANT"
,
"VCAT"
,
"VOLATILE"
,
"VOLUMES"
,
"WHILE"
,
"WLM"
};
"TRIGGER"
,
"TYPE"
,
"UNDO"
,
"UNTIL"
,
"VALIDPROC"
,
"VARIABLE"
,
"VARIANT"
,
"VCAT"
,
"VOLATILE"
,
"VOLUMES"
,
"WHILE"
,
"WLM"
,
"IMPLICITLY"
,
"HIDDEN"
};
public
static
final
DBDPseudoAttribute
PSEUDO_ATTR_RID_BIT
=
new
DBDPseudoAttribute
(
DBDPseudoAttributeType
.
ROWID
,
"RID_BIT()"
,
"RID_BIT($alias)"
,
"RID_BIT"
,
"Unique physical row identifier"
,
false
);
...
...
plugins/org.jkiss.dbeaver.ext.db2/src/org/jkiss/dbeaver/ext/db2/DB2SQLDialect.java
浏览文件 @
57d5928d
...
...
@@ -22,6 +22,7 @@ import org.jkiss.code.Nullable;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.db2.model.DB2Routine
;
import
org.jkiss.dbeaver.model.DBPDataSourceContainer
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.data.DBDBinaryFormatter
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData
;
...
...
@@ -31,12 +32,18 @@ import org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement;
import
org.jkiss.dbeaver.model.impl.data.formatters.BinaryFormatterHexString
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect
;
import
org.jkiss.dbeaver.model.sql.parser.rules.SQLMultiWordRule
;
import
org.jkiss.dbeaver.model.sql.parser.tokens.SQLTokenType
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedure
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedureType
;
import
org.jkiss.dbeaver.model.text.parser.TPRule
;
import
org.jkiss.dbeaver.model.text.parser.TPRuleProvider
;
import
org.jkiss.dbeaver.model.text.parser.TPTokenDefault
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
/**
...
...
@@ -45,15 +52,12 @@ import java.util.Set;
* @author Denis Forveille
*
*/
public
class
DB2SQLDialect
extends
JDBCSQLDialect
{
public
class
DB2SQLDialect
extends
JDBCSQLDialect
implements
TPRuleProvider
{
private
static
final
Log
log
=
Log
.
getLog
(
DB2SQLDialect
.
class
);
public
static
final
String
[]
EXEC_KEYWORDS
=
new
String
[]{
"CALL"
};
private
static
final
String
[][]
DB2_BEGIN_END_BLOCK
=
new
String
[][]{
};
private
static
final
boolean
LOAD_ROUTINES_FROM_SYSCAT
=
false
;
public
DB2SQLDialect
()
{
...
...
@@ -146,13 +150,17 @@ public class DB2SQLDialect extends JDBCSQLDialect {
return
BinaryFormatterHexString
.
INSTANCE
;
}
@Override
public
String
[][]
getBlockBoundStrings
()
{
return
DB2_BEGIN_END_BLOCK
;
}
@Override
public
String
getScriptDelimiterRedefiner
()
{
return
"DELIMITER"
;
}
@Override
public
void
extendRules
(
@Nullable
DBPDataSourceContainer
dataSource
,
@NotNull
List
<
TPRule
>
rules
,
@NotNull
RulePosition
position
)
{
if
(
position
==
RulePosition
.
KEYWORDS
)
{
final
TPTokenDefault
keywordToken
=
new
TPTokenDefault
(
SQLTokenType
.
T_KEYWORD
);
rules
.
add
(
new
SQLMultiWordRule
(
new
String
[]{
"ROW"
,
"BEGIN"
},
keywordToken
));
rules
.
add
(
new
SQLMultiWordRule
(
new
String
[]{
"ROW"
,
"END"
},
keywordToken
));
}
}
}
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
浏览文件 @
57d5928d
...
...
@@ -33,6 +33,7 @@ import org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect;
import
org.jkiss.dbeaver.model.preferences.DBPPreferenceStore
;
import
org.jkiss.dbeaver.model.sql.SQLConstants
;
import
org.jkiss.dbeaver.model.sql.SQLExpressionFormatter
;
import
org.jkiss.dbeaver.model.struct.DBSAttributeBase
;
import
org.jkiss.dbeaver.model.struct.DBSTypedObject
;
import
org.jkiss.dbeaver.model.struct.rdb.DBSProcedure
;
import
org.jkiss.utils.ArrayUtils
;
...
...
@@ -382,6 +383,17 @@ public class OracleSQLDialect extends JDBCSQLDialect {
return
MultiValueInsertMode
.
INSERT_ALL
;
}
@NotNull
@Override
public
String
escapeScriptValue
(
DBSAttributeBase
attribute
,
@NotNull
Object
value
,
@NotNull
String
strValue
)
{
if
(
CommonUtils
.
isNaN
(
value
)
||
CommonUtils
.
isInfinite
(
value
))
{
// These special values should be quoted, as shown in the example below
// https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions090.htm
return
'\''
+
String
.
valueOf
(
value
)
+
'\''
;
}
return
super
.
escapeScriptValue
(
attribute
,
value
,
strValue
);
}
@Override
public
boolean
supportsAliasInSelect
()
{
return
true
;
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/edit/PostgreForeignKeyManager.java
浏览文件 @
57d5928d
...
...
@@ -28,7 +28,6 @@ import org.jkiss.dbeaver.model.DBUtils;
import
org.jkiss.dbeaver.model.edit.DBECommandContext
;
import
org.jkiss.dbeaver.model.edit.DBEObjectRenamer
;
import
org.jkiss.dbeaver.model.edit.DBEPersistAction
;
import
org.jkiss.dbeaver.model.exec.DBCException
;
import
org.jkiss.dbeaver.model.exec.DBCExecutionContext
;
import
org.jkiss.dbeaver.model.impl.edit.DBECommandAbstract
;
import
org.jkiss.dbeaver.model.impl.edit.SQLDatabasePersistAction
;
...
...
@@ -80,7 +79,7 @@ public class PostgreForeignKeyManager extends SQLForeignKeyManager<PostgreTableF
@Override
public
StringBuilder
getNestedDeclaration
(
DBRProgressMonitor
monitor
,
PostgreTableBase
owner
,
DBECommandAbstract
<
PostgreTableForeignKey
>
command
,
Map
<
String
,
Object
>
options
)
{
PostgreTableForeignKey
fk
=
command
.
getObject
();
if
(
fk
.
isPersisted
())
{
/*
if (fk.isPersisted()) {
try {
String constrDDL = fk.getObjectDefinitionText(
monitor,
...
...
@@ -91,9 +90,14 @@ public class PostgreForeignKeyManager extends SQLForeignKeyManager<PostgreTableF
} catch (DBException e) {
log.warn("Can't extract FK DDL", e);
}
}
}
*/
StringBuilder
sql
=
super
.
getNestedDeclaration
(
monitor
,
owner
,
command
,
options
);
if
(
fk
.
getMatchType
().
equals
(
PostgreTableForeignKey
.
MatchType
.
f
))
{
//Foreign key match types: f = full, p = partial (not implemented yet), s = simple (u == s in old PG versions - default value)
sql
.
append
(
" MATCH FULL"
);
}
if
(
fk
.
isDeferrable
())
{
sql
.
append
(
" DEFERRABLE"
);
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreDialect.java
浏览文件 @
57d5928d
...
...
@@ -42,6 +42,7 @@ import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import
org.jkiss.dbeaver.model.text.parser.TPRule
;
import
org.jkiss.dbeaver.model.text.parser.TPRuleProvider
;
import
org.jkiss.utils.ArrayUtils
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.Types
;
import
java.util.Arrays
;
...
...
@@ -816,6 +817,11 @@ public class PostgreDialect extends JDBCSQLDialect implements TPRuleProvider {
// For now we use workaround: represent objects as strings
return
'\''
+
escapeString
(
strValue
)
+
'\''
;
}
if
(
CommonUtils
.
isNaN
(
value
)
||
CommonUtils
.
isInfinite
(
value
))
{
// These special values should be quoted
// https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL
return
'\''
+
String
.
valueOf
(
value
)
+
'\''
;
}
return
super
.
escapeScriptValue
(
attribute
,
value
,
strValue
);
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreExecutionContext.java
浏览文件 @
57d5928d
...
...
@@ -207,10 +207,11 @@ public class PostgreExecutionContext extends JDBCExecutionContext implements DBC
private
void
setSearchPath
(
DBRProgressMonitor
monitor
,
String
defSchemaName
)
throws
DBCException
{
List
<
String
>
newSearchPath
=
new
ArrayList
<>(
getDefaultSearchPath
());
int
schemaIndex
=
newSearchPath
.
indexOf
(
defSchemaName
);
if
(
schemaIndex
==
0
||
(
schemaIndex
==
1
&&
isUserFirstInPath
(
newSearchPath
)))
{
/*
if (schemaIndex == 0 || (schemaIndex == 1 && isUserFirstInPath(newSearchPath))) {
// Already default schema
return;
}
else
{
} else*/
{
if
(
schemaIndex
>
0
)
{
// Remove from previous position
newSearchPath
.
remove
(
schemaIndex
);
...
...
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/edit/VerticaSequenceManager.java
浏览文件 @
57d5928d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp
* Copyright (C) 2010-2021 DBeaver Corp
and others
*
* All Rights Reserved.
* 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
*
* NOTICE: All information contained herein is, and remains
* the property of DBeaver Corp and its suppliers, if any.
* The intellectual and technical concepts contained
* herein are proprietary to DBeaver Corp and its suppliers
* and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from DBeaver Corp.
* 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.ext.vertica.edit
;
...
...
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/model/VerticaSQLDialect.java
浏览文件 @
57d5928d
...
...
@@ -33,6 +33,7 @@ public class VerticaSQLDialect extends GenericSQLDialect {
private
static
String
[]
VERTICA_KEYWORDS
=
new
String
[]{
// SELECT * FROM keywords WHERE reserved = 'R'
"BIT"
,
"CACHE"
,
"COMMENT"
,
"CORRELATION"
,
"ENCODED"
,
...
...
plugins/org.jkiss.dbeaver.ext.vertica/src/org/jkiss/dbeaver/ext/vertica/model/VerticaSequence.java
浏览文件 @
57d5928d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp
* Copyright (C) 2010-2021 DBeaver Corp
and others
*
* All Rights Reserved.
* 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
*
* NOTICE: All information contained herein is, and remains
* the property of DBeaver Corp and its suppliers, if any.
* The intellectual and technical concepts contained
* herein are proprietary to DBeaver Corp and its suppliers
* and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from DBeaver Corp.
* 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.ext.vertica.model
;
...
...
@@ -20,15 +20,20 @@ import org.jkiss.code.NotNull;
import
org.jkiss.code.Nullable
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.Log
;
import
org.jkiss.dbeaver.ext.generic.model.GenericScriptObject
;
import
org.jkiss.dbeaver.ext.generic.model.GenericSequence
;
import
org.jkiss.dbeaver.ext.generic.model.GenericStructContainer
;
import
org.jkiss.dbeaver.ext.generic.model.GenericTableBase
;
import
org.jkiss.dbeaver.model.DBPEvaluationContext
;
import
org.jkiss.dbeaver.model.meta.Property
;
import
org.jkiss.dbeaver.model.meta.PropertyLength
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.dbeaver.model.sql.SQLUtils
;
import
org.jkiss.utils.CommonUtils
;
public
class
VerticaSequence
extends
GenericSequence
{
import
java.util.Map
;
public
class
VerticaSequence
extends
GenericSequence
implements
GenericScriptObject
{
private
static
final
Log
log
=
Log
.
getLog
(
VerticaSequence
.
class
);
...
...
@@ -38,6 +43,7 @@ public class VerticaSequence extends GenericSequence {
private
boolean
isCycle
;
private
VerticaSchema
schema
;
private
String
description
;
private
String
source
;
public
VerticaSequence
(
GenericStructContainer
container
,
String
name
,
String
description
,
Number
lastValue
,
Number
minValue
,
Number
maxValue
,
Number
incrementBy
,
String
identityTableName
,
long
cacheCount
,
boolean
isCycle
)
{
super
(
container
,
name
,
description
,
lastValue
,
minValue
,
maxValue
,
incrementBy
);
...
...
@@ -110,5 +116,30 @@ public class VerticaSequence extends GenericSequence {
}
@Override
public
String
getObjectDefinitionText
(
DBRProgressMonitor
monitor
,
Map
<
String
,
Object
>
options
)
throws
DBException
{
if
(
source
==
null
)
{
StringBuilder
ddl
=
new
StringBuilder
();
ddl
.
append
(
"CREATE SEQUENCE "
)
.
append
(
getFullyQualifiedName
(
DBPEvaluationContext
.
DML
))
.
append
(
"\n\tINCREMENT BY "
).
append
(
getIncrementBy
())
.
append
(
"\n\tMINVALUE "
).
append
(
getMinValue
())
.
append
(
"\n\tMAXVALUE "
).
append
(
getMaxValue
())
.
append
(
"\n\tSTART WITH "
).
append
(
getLastValue
());
if
(
cacheCount
<=
1
)
{
ddl
.
append
(
"\n\tNO CACHE"
);
}
else
{
ddl
.
append
(
"\n\tCACHE "
).
append
(
cacheCount
);
}
ddl
.
append
(
"\n\t"
).
append
(
isCycle
?
""
:
"NO "
).
append
(
"CYCLE;"
);
if
(!
CommonUtils
.
isEmpty
(
description
))
{
ddl
.
append
(
"\n\nCOMMENT ON SEQUENCE "
).
append
(
getFullyQualifiedName
(
DBPEvaluationContext
.
DML
)).
append
(
" IS "
)
.
append
(
SQLUtils
.
quoteString
(
this
,
description
)).
append
(
";"
);
}
source
=
ddl
.
toString
();
}
return
source
;
}
}
plugins/org.jkiss.dbeaver.model.sql/src/org/jkiss/dbeaver/model/sql/parser/rules/SQLMultiWordRule.java
0 → 100644
浏览文件 @
57d5928d
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* 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.model.sql.parser.rules
;
import
org.eclipse.core.runtime.Assert
;
import
org.jkiss.dbeaver.model.text.parser.TPCharacterScanner
;
import
org.jkiss.dbeaver.model.text.parser.TPRule
;
import
org.jkiss.dbeaver.model.text.parser.TPToken
;
import
org.jkiss.dbeaver.model.text.parser.TPTokenAbstract
;
/**
* Rule for matching tokens consisting of several words separated by one or more whitespaces.
*/
public
class
SQLMultiWordRule
implements
TPRule
{
private
final
String
[]
parts
;
private
final
TPToken
token
;
public
SQLMultiWordRule
(
String
[]
parts
,
TPToken
token
)
{
this
.
parts
=
parts
;
this
.
token
=
token
;
Assert
.
isLegal
(
parts
.
length
>
1
,
"Multi-word rule should consist of two or more parts"
);
}
@Override
public
TPToken
evaluate
(
TPCharacterScanner
scanner
)
{
int
ch
=
scanner
.
read
();
int
read
=
1
;
outer:
for
(
int
partIndex
=
0
;
partIndex
<
parts
.
length
;
partIndex
++)
{
if
(
ch
==
TPCharacterScanner
.
EOF
||
!
Character
.
isUnicodeIdentifierStart
(
ch
))
{
break
;
}
for
(
char
partCh
:
parts
[
partIndex
].
toCharArray
())
{
if
(
ch
==
TPCharacterScanner
.
EOF
||
!
Character
.
isUnicodeIdentifierPart
(
ch
)
||
Character
.
toUpperCase
(
partCh
)
!=
Character
.
toUpperCase
(
ch
))
{
break
outer
;
}
ch
=
scanner
.
read
();
read
++;
}
if
(
partIndex
==
parts
.
length
-
1
&&
!
Character
.
isUnicodeIdentifierPart
(
ch
))
{
// Accept rule if last part is preceded by non-identifier character
scanner
.
unread
();
return
token
;
}
if
(
ch
==
TPCharacterScanner
.
EOF
||
!
Character
.
isWhitespace
(
ch
))
{
// Require at least one whitespace character between parts
break
;
}
while
(
ch
!=
TPCharacterScanner
.
EOF
&&
Character
.
isWhitespace
(
ch
))
{
ch
=
scanner
.
read
();
read
++;
}
}
while
(
read
>
0
)
{
scanner
.
unread
();
read
--;
}
return
TPTokenAbstract
.
UNDEFINED
;
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCSQLDialect.java
浏览文件 @
57d5928d
...
...
@@ -112,7 +112,7 @@ public class JDBCSQLDialect extends BasicSQLDialect {
}
try
{
this
.
supportsUnquotedMixedCase
=
!
metaData
.
supportsMixedCaseIdentifiers
();
this
.
supportsUnquotedMixedCase
=
metaData
.
supportsMixedCaseIdentifiers
();
}
catch
(
Throwable
e
)
{
log
.
debug
(
"Error getting supportsUnquotedMixedCase:"
+
e
.
getMessage
());
this
.
supportsUnquotedMixedCase
=
false
;
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/runtime/BlockCanceler.java
浏览文件 @
57d5928d
...
...
@@ -35,6 +35,9 @@ public class BlockCanceler
try
{
block
.
cancelBlock
(
monitor
,
blockActiveThread
);
}
catch
(
Throwable
e
)
{
if
(
e
instanceof
RuntimeException
)
{
throw
e
;
}
throw
new
DBException
(
"Cancel error"
,
e
);
}
finally
{
thread
.
setName
(
threadOldName
);
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLUtils.java
浏览文件 @
57d5928d
...
...
@@ -646,9 +646,6 @@ public final class SQLUtils {
}
else
{
strValue
=
valueHandler
.
getValueDisplayString
(
attribute
,
value
,
displayFormat
);
}
if
(
value
instanceof
Number
)
{
return
strValue
;
}
SQLDialect
sqlDialect
=
dataSource
.
getSQLDialect
();
DBPDataKind
dataKind
=
attribute
.
getDataKind
();
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/lightgrid/GridCellRenderer.java
浏览文件 @
57d5928d
...
...
@@ -133,7 +133,12 @@ class GridCellRenderer extends AbstractRenderer {
case
IGridContentProvider
.
ALIGN_RIGHT
:
{
// Right (numbers, datetimes)
Point
textSize
=
gc
.
textExtent
(
text
);
boolean
useClipping
=
textSize
.
x
+
INSIDE_MARGIN
>
bounds
.
width
;
int
valueWidth
=
textSize
.
x
+
INSIDE_MARGIN
;
if
(
imageBounds
!=
null
)
{
valueWidth
+=
imageBounds
.
width
+
INSIDE_MARGIN
;
}
valueWidth
+=
RIGHT_MARGIN
;
boolean
useClipping
=
valueWidth
>
bounds
.
width
;
int
imageMargin
=
0
;
if
(
image
!=
null
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetViewer.java
浏览文件 @
57d5928d
...
...
@@ -2681,6 +2681,7 @@ public class ResultSetViewer extends Viewer
}
if
((
getDecorator
().
getDecoratorFeatures
()
&
IResultSetDecorator
.
FEATURE_PANELS
)
!=
0
)
{
layoutMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetHandlerMain
.
CMD_TOGGLE_PANELS
));
layoutMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetHandlerMain
.
CMD_ACTIVATE_PANELS
));
layoutMenu
.
add
(
ActionUtils
.
makeCommandContribution
(
site
,
ResultSetHandlerMain
.
CMD_TOGGLE_LAYOUT
));
}
if
((
getDecorator
().
getDecoratorFeatures
()
&
IResultSetDecorator
.
FEATURE_PRESENTATIONS
)
!=
0
)
{
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetFindReplaceTarget.java
浏览文件 @
57d5928d
...
...
@@ -312,7 +312,7 @@ class SpreadsheetFindReplaceTarget implements IFindReplaceTarget, IFindReplaceTa
}
else
{
GridCell
cell
=
spreadsheet
.
posToCell
(
curPosition
);
if
(
cell
!=
null
)
{
cellText
=
CommonUtils
.
toString
(
spreadsheet
.
getContentProvider
().
getCellValue
(
cell
.
col
,
cell
.
row
,
true
,
tru
e
));
cellText
=
CommonUtils
.
toString
(
spreadsheet
.
getContentProvider
().
getCellValue
(
cell
.
col
,
cell
.
row
,
false
,
fals
e
));
}
else
{
continue
;
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/spreadsheet/SpreadsheetPresentation.java
浏览文件 @
57d5928d
...
...
@@ -1986,7 +1986,7 @@ public class SpreadsheetPresentation extends AbstractPresentation implements IRe
if
(!
hasScope
||
inScope
)
{
java
.
util
.
regex
.
Pattern
searchPattern
=
findReplaceTarget
.
getSearchPattern
();
if
(
searchPattern
!=
null
)
{
String
cellText
=
getCellText
(
colElement
,
rowElement
);
String
cellText
=
CommonUtils
.
toString
(
getCellValue
(
colElement
,
rowElement
,
false
,
false
)
);
if
(
searchPattern
.
matcher
(
cellText
).
find
())
{
return
backgroundMatched
;
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/valuefilter/GenericFilterValueEdit.java
浏览文件 @
57d5928d
...
...
@@ -241,7 +241,9 @@ class GenericFilterValueEdit {
void
loadValues
(
Runnable
onFinish
)
{
KeyLoadJob
curLoadJob
=
this
.
loadJob
;
if
(
curLoadJob
!=
null
)
{
curLoadJob
.
cancel
();
if
(!
curLoadJob
.
isCanceled
())
{
curLoadJob
.
cancel
();
}
curLoadJob
.
schedule
(
200
);
return
;
}
...
...
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java
浏览文件 @
57d5928d
...
...
@@ -4054,6 +4054,11 @@ public class SQLEditor extends SQLEditorBase implements
@Override
public
void
run
()
{
getActivePreferenceStore
().
setValue
(
SQLPreferenceConstants
.
OUTPUT_PANEL_AUTO_SHOW
,
isChecked
());
try
{
getActivePreferenceStore
().
save
();
}
catch
(
IOException
e
)
{
log
.
error
(
e
);
}
}
}
...
...
plugins/org.jkiss.dbeaver.ui.navigator/src/org/jkiss/dbeaver/ui/navigator/itemlist/ItemListControl.java
浏览文件 @
57d5928d
...
...
@@ -383,14 +383,15 @@ public class ItemListControl extends NodeListControl
if
(
property
!=
null
)
{
Object
oldValue
=
getListPropertySource
().
getPropertyValue
(
null
,
objectValue
,
property
,
false
);
getListPropertySource
().
setPropertyValue
(
null
,
objectValue
,
property
,
UIUtils
.
normalizePropertyValue
(
value
));
Object
newValue
=
getListPropertySource
().
getPropertyValue
(
null
,
objectValue
,
property
,
false
);
if
(
value
instanceof
Boolean
)
{
// Redraw control to let it repaint checkbox
getItemsViewer
().
getControl
().
redraw
();
}
if
(!
CommonUtils
.
equalObjects
(
oldValue
,
v
alue
))
{
if
(!
CommonUtils
.
equalObjects
(
oldValue
,
newV
alue
))
{
Map
<
String
,
Object
>
propMap
=
changedProperties
.
computeIfAbsent
(
object
,
dbnNode
->
new
HashMap
<>());
Object
savedValue
=
propMap
.
get
(
property
.
getId
());
if
(
CommonUtils
.
equalObjects
(
savedValue
,
v
alue
))
{
if
(
CommonUtils
.
equalObjects
(
savedValue
,
newV
alue
))
{
// Reset to original value
propMap
.
remove
(
property
.
getId
());
}
else
if
(!
propMap
.
containsKey
(
property
.
getId
()))
{
...
...
plugins/org.jkiss.dbeaver.ui/src/org/jkiss/dbeaver/ui/controls/CustomCheckboxCellEditor.java
浏览文件 @
57d5928d
...
...
@@ -20,10 +20,9 @@ import org.eclipse.core.runtime.Assert;
import
org.eclipse.jface.viewers.CellEditor
;
import
org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.FocusAdapter
;
import
org.eclipse.swt.events.FocusEvent
;
import
org.eclipse.swt.events.MouseAdapter
;
import
org.eclipse.swt.events.MouseEvent
;
import
org.eclipse.swt.events.*
;
import
org.eclipse.swt.layout.GridData
;
import
org.eclipse.swt.layout.GridLayout
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Control
;
import
org.eclipse.swt.widgets.Label
;
...
...
@@ -48,21 +47,59 @@ public class CustomCheckboxCellEditor extends CellEditor {
@Override
protected
Control
createControl
(
Composite
parent
)
{
//Composite ph = UIUtils.createPlaceholder(parent, 1);
checkBox
=
new
Label
(
parent
,
SWT
.
NONE
);
//setCheckIcon();
checkBox
.
setFont
(
parent
.
getFont
());
checkBox
.
setBackground
(
null
);
checkBox
.
addFocusListener
(
new
FocusAdapter
()
{
Composite
ph
=
new
Composite
(
parent
,
SWT
.
NONE
);
GridLayout
gl
=
new
GridLayout
(
1
,
false
);
gl
.
marginWidth
=
0
;
gl
.
marginHeight
=
0
;
ph
.
setLayout
(
gl
);
ph
.
setBackground
(
parent
.
getBackground
());
checkBox
=
new
Label
(
ph
,
SWT
.
NONE
);
GridData
gd
=
new
GridData
(
SWT
.
CENTER
,
SWT
.
FILL
,
true
,
true
);
checkBox
.
setLayoutData
(
gd
);
checkBox
.
setBackground
(
ph
.
getBackground
());
ph
.
addFocusListener
(
new
FocusAdapter
()
{
@Override
public
void
focusLost
(
FocusEvent
e
)
{
CustomCheckboxCellEditor
.
this
.
focusLost
();
}
});
addMouseListener
();
ph
.
addKeyListener
(
new
KeyListener
()
{
@Override
public
void
keyPressed
(
KeyEvent
e
)
{
switch
(
e
.
character
)
{
case
SWT
.
ESC
:
dispose
();
break
;
case
SWT
.
SPACE
:
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
break
;
case
SWT
.
CR
:
applyEditorValue
();
fireApplyEditorValue
();
break
;
}
}
return
checkBox
;
@Override
public
void
keyReleased
(
KeyEvent
e
)
{
}
});
checkBox
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseDown
(
MouseEvent
e
)
{
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
//fireApplyEditorValue();
}
});
return
ph
;
}
private
void
setCheckIcon
()
{
...
...
@@ -81,7 +118,7 @@ public class CustomCheckboxCellEditor extends CellEditor {
@Override
protected
void
doSetFocus
()
{
checkBox
.
setFocus
();
checkBox
.
getParent
().
setFocus
();
}
@Override
...
...
@@ -98,7 +135,7 @@ public class CustomCheckboxCellEditor extends CellEditor {
layoutData
.
grabHorizontal
=
true
;
layoutData
.
horizontalAlignment
=
SWT
.
LEFT
;
}
else
{
layoutData
.
grabHorizontal
=
fals
e
;
layoutData
.
grabHorizontal
=
tru
e
;
layoutData
.
horizontalAlignment
=
SWT
.
CENTER
;
}
return
layoutData
;
...
...
@@ -135,21 +172,9 @@ public class CustomCheckboxCellEditor extends CellEditor {
}
}
private
void
addMouseListener
()
{
checkBox
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseDown
(
MouseEvent
e
)
{
checked
=
!
checked
;
setCheckIcon
();
applyEditorValue
();
fireApplyEditorValue
();
}
});
}
@Override
public
void
activate
(
ColumnViewerEditorActivationEvent
activationEvent
)
{
if
(
activationEvent
.
eventType
!=
ColumnViewerEditorActivationEvent
.
TRAVERSAL
)
{
/*if (activationEvent.eventType != ColumnViewerEditorActivationEvent.TRAVERSAL) */
{
super
.
activate
(
activationEvent
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录