Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
c8217a52
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
c8217a52
编写于
2月 28, 2016
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SQL keywords reorganized
Former-commit-id:
f1f854c2
上级
8a8039c3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
60 deletion
+64
-60
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
.../org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
+4
-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
-4
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/BasicSQLDialect.java
...src/org/jkiss/dbeaver/model/impl/sql/BasicSQLDialect.java
+14
-6
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLConstants.java
...r.model/src/org/jkiss/dbeaver/model/sql/SQLConstants.java
+45
-50
未找到文件。
plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/model/OracleSQLDialect.java
浏览文件 @
c8217a52
...
...
@@ -18,9 +18,11 @@
package
org.jkiss.dbeaver.ext.oracle.model
;
import
org.jkiss.code.NotNull
;
import
org.jkiss.dbeaver.model.DBPKeywordType
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCSQLDialect
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
...
...
@@ -40,6 +42,8 @@ class OracleSQLDialect extends JDBCSQLDialect {
addSQLKeyword
(
"STRUCTURE"
);
addSQLKeyword
(
"COMPUTE"
);
addSQLKeyword
(
"STATISTICS"
);
addFunctions
(
Arrays
.
asList
(
"SUBSTR"
,
"APPROX_COUNT_DISTINCT"
));
}
@NotNull
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/jdbc/JDBCSQLDialect.java
浏览文件 @
c8217a52
...
...
@@ -354,14 +354,11 @@ public class JDBCSQLDialect extends BasicSQLDialect {
for
(
String
func
:
makeStringList
(
metaData
.
getTimeDateFunctions
()))
{
allFunctions
.
add
(
func
.
toUpperCase
());
}
functions
.
addAll
(
allFunctions
);
addFunctions
(
allFunctions
);
}
catch
(
Throwable
e
)
{
log
.
error
(
e
);
}
// Remove types and functions from reserved words list
addKeywords
(
functions
,
DBPKeywordType
.
FUNCTION
);
}
private
static
List
<
String
>
makeStringList
(
String
source
)
...
...
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/impl/sql/BasicSQLDialect.java
浏览文件 @
c8217a52
...
...
@@ -45,7 +45,7 @@ public class BasicSQLDialect implements SQLDialect {
private
TreeMap
<
String
,
DBPKeywordType
>
allKeywords
=
new
TreeMap
<>();
protected
final
TreeSet
<
String
>
reservedWords
=
new
TreeSet
<>();
pr
otected
final
TreeSet
<
String
>
functions
=
new
TreeSet
<>();
pr
ivate
final
TreeSet
<
String
>
functions
=
new
TreeSet
<>();
protected
final
TreeSet
<
String
>
types
=
new
TreeSet
<>();
protected
final
TreeSet
<
String
>
tableQueryWords
=
new
TreeSet
<>();
protected
final
TreeSet
<
String
>
columnQueryWords
=
new
TreeSet
<>();
...
...
@@ -88,13 +88,18 @@ public class BasicSQLDialect implements SQLDialect {
allKeywords
.
remove
(
keyword
);
}
protected
void
addFunctions
(
Collection
<
String
>
allFunctions
)
{
functions
.
addAll
(
allFunctions
);
addKeywords
(
allFunctions
,
DBPKeywordType
.
FUNCTION
);
}
public
void
addKeywords
(
Collection
<
String
>
set
,
DBPKeywordType
type
)
{
if
(
set
!=
null
)
{
for
(
String
keyword
:
set
)
{
reservedWords
.
add
(
keyword
);
DBPKeywordType
oldType
=
allKeywords
.
get
(
keyword
);
if
(
oldType
==
null
||
oldType
.
ordinal
()
>
type
.
ordinal
())
{
if
(
oldType
==
null
||
oldType
.
ordinal
()
<
type
.
ordinal
())
{
allKeywords
.
put
(
keyword
,
type
);
}
}
...
...
@@ -300,9 +305,11 @@ public class BasicSQLDialect implements SQLDialect {
protected
void
loadStandardKeywords
()
{
// Add default set of keywords
Collections
.
addAll
(
reservedWords
,
SQLConstants
.
SQL2003_RESERVED_KEYWORDS
);
Collections
.
addAll
(
reservedWords
,
SQLConstants
.
SQL2003_NON_RESERVED_KEYWORDS
);
Collections
.
addAll
(
reservedWords
,
SQLConstants
.
SQL_EX_KEYWORDS
);
Set
<
String
>
all
=
new
HashSet
<>();
Collections
.
addAll
(
all
,
SQLConstants
.
SQL2003_RESERVED_KEYWORDS
);
//Collections.addAll(reservedWords, SQLConstants.SQL2003_NON_RESERVED_KEYWORDS);
Collections
.
addAll
(
all
,
SQLConstants
.
SQL_EX_KEYWORDS
);
Collections
.
addAll
(
functions
,
SQLConstants
.
SQL2003_FUNCTIONS
);
Collections
.
addAll
(
tableQueryWords
,
SQLConstants
.
TABLE_KEYWORDS
);
Collections
.
addAll
(
columnQueryWords
,
SQLConstants
.
COLUMN_KEYWORDS
);
...
...
@@ -312,8 +319,9 @@ public class BasicSQLDialect implements SQLDialect {
// Add default types
Collections
.
addAll
(
types
,
SQLConstants
.
DEFAULT_TYPES
);
addKeywords
(
all
,
DBPKeywordType
.
KEYWORD
);
addKeywords
(
types
,
DBPKeywordType
.
TYPE
);
addKeywords
(
reservedWords
,
DBPKeywordType
.
KEYWORD
);
addKeywords
(
functions
,
DBPKeywordType
.
FUNCTION
);
}
}
plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/sql/SQLConstants.java
浏览文件 @
c8217a52
...
...
@@ -66,7 +66,6 @@ public class SQLConstants {
};
public
static
final
String
[]
SQL2003_RESERVED_KEYWORDS
=
{
"ABS"
,
"ALL"
,
"ALLOCATE"
,
"ALTER"
,
...
...
@@ -80,29 +79,23 @@ public class SQLConstants {
"AT"
,
"ATOMIC"
,
"AUTHORIZATION"
,
"AVG"
,
"BEGIN"
,
"BETWEEN"
,
"BIGINT"
,
"BINARY"
,
"BLOB"
,
"BOOLEAN"
,
"BOTH"
,
"BY"
,
"CALL"
,
"CALLED"
,
"CARDINALITY"
,
"CASCADE"
,
"CASCADED"
,
"CASE"
,
"CAST"
,
"CEIL"
,
"CEILING"
,
"CHAR"
,
"CHAR_LENGTH"
,
"CHARACTER"
,
"CHARACTER_LENGTH"
,
"CHECK"
,
"CLOB"
,
"CLOSE"
,
"COALESCE"
,
"COLLATE"
,
...
...
@@ -115,7 +108,6 @@ public class SQLConstants {
"CONVERT"
,
"CORR"
,
"CORRESPONDING"
,
"COUNT"
,
"COVAR_POP"
,
"COVAR_SAMP"
,
"CREATE"
,
...
...
@@ -123,21 +115,11 @@ public class SQLConstants {
"CUBE"
,
"CUME_DIST"
,
"CURRENT"
,
"CURRENT_DATE"
,
"CURRENT_DEFAULT_TRANSFORM_GROUP"
,
"CURRENT_PATH"
,
"CURRENT_ROLE"
,
"CURRENT_TIME"
,
"CURRENT_TIMESTAMP"
,
"CURRENT_TRANSFORM_GROUP_FOR_TYPE"
,
"CURRENT_USER"
,
"CURSOR"
,
"CYCLE"
,
"DATE"
,
"DAY"
,
"DEALLOCATE"
,
"DEC"
,
"DECIMAL"
,
"DECLARE"
,
"DEFAULT"
,
"DELETE"
,
...
...
@@ -147,7 +129,6 @@ public class SQLConstants {
"DETERMINISTIC"
,
"DISCONNECT"
,
"DISTINCT"
,
"DOUBLE"
,
"DROP"
,
"DYNAMIC"
,
"EACH"
,
...
...
@@ -167,8 +148,6 @@ public class SQLConstants {
"FALSE"
,
"FETCH"
,
"FILTER"
,
"FLOAT"
,
"FLOOR"
,
"FOR"
,
"FOREIGN"
,
"FREE"
,
...
...
@@ -191,8 +170,6 @@ public class SQLConstants {
"INOUT"
,
"INSENSITIVE"
,
"INSERT"
,
"INT"
,
"INTEGER"
,
"INTERSECT"
,
"INTERSECTION"
,
"INTERVAL"
,
...
...
@@ -202,20 +179,16 @@ public class SQLConstants {
"LANGUAGE"
,
"LARGE"
,
"LATERAL"
,
"LEADING"
,
"LEFT"
,
"LIKE"
,
"LN"
,
"LOCAL"
,
"LOCALTIME"
,
"LOCALTIMESTAMP"
,
"LOWER"
,
"MATCH"
,
"MAX"
,
"MEMBER"
,
"MERGE"
,
"METHOD"
,
"MIN"
,
"MINUTE"
,
"MOD"
,
"MODIFIES"
,
...
...
@@ -234,7 +207,6 @@ public class SQLConstants {
"NULL"
,
"NULLIF"
,
"NUMERIC"
,
"OCTET_LENGTH"
,
"OF"
,
"OLD"
,
"ON"
,
...
...
@@ -249,11 +221,7 @@ public class SQLConstants {
"OVERLAY"
,
"PARAMETER"
,
"PARTITION"
,
"PERCENT_RANK"
,
"PERCENTILE_CONT"
,
"PERCENTILE_DISC"
,
"POSITION"
,
"POWER"
,
"PRECISION"
,
"PREPARE"
,
"PRIMARY"
,
...
...
@@ -266,15 +234,6 @@ public class SQLConstants {
"REF"
,
"REFERENCES"
,
"REFERENCING"
,
"REGR_AVGX"
,
"REGR_AVGY"
,
"REGR_COUNT"
,
"REGR_INTERCEPT"
,
"REGR_R2"
,
"REGR_SLOPE"
,
"REGR_SXX"
,
"REGR_SXY"
,
"REGR_SYY"
,
"RELEASE"
,
"RESULT"
,
"RETURN"
,
...
...
@@ -304,22 +263,17 @@ public class SQLConstants {
"SQLEXCEPTION"
,
"SQLSTATE"
,
"SQLWARNING"
,
"SQRT"
,
"START"
,
"STATIC"
,
"STDDEV_POP"
,
"STDDEV_SAMP"
,
"SUBMULTISET"
,
"SUBSTRING"
,
"SUM"
,
"SYMMETRIC"
,
"SYSTEM"
,
"SYSTEM_USER"
,
"TABLE"
,
"TABLESAMPLE"
,
"THEN"
,
"TIME"
,
"TIMESTAMP"
,
"TIMEZONE_HOUR"
,
"TIMEZONE_MINUTE"
,
"TO"
,
...
...
@@ -328,15 +282,12 @@ public class SQLConstants {
"TRANSLATION"
,
"TREAT"
,
"TRIGGER"
,
"TRIM"
,
"TRUE"
,
"UESCAPE"
,
"UNION"
,
"UNIQUE"
,
"UNKNOWN"
,
"UNNEST"
,
"UPDATE"
,
"UPPER"
,
"USER"
,
"USING"
,
"VALUE"
,
...
...
@@ -356,6 +307,47 @@ public class SQLConstants {
"YEAR"
,
};
public
static
final
String
[]
SQL2003_FUNCTIONS
=
{
"ABS"
,
"AVG"
,
"CHAR_LENGTH"
,
"CHARACTER_LENGTH"
,
"COUNT"
,
"CURRENT_DATE"
,
"CURRENT_DEFAULT_TRANSFORM_GROUP"
,
"CURRENT_PATH"
,
"CURRENT_ROLE"
,
"CURRENT_TIME"
,
"CURRENT_TIMESTAMP"
,
"CURRENT_TRANSFORM_GROUP_FOR_TYPE"
,
"CURRENT_USER"
,
"FLOOR"
,
"LEADING"
,
"LOWER"
,
"MAX"
,
"MIN"
,
"OCTET_LENGTH"
,
"PERCENT_RANK"
,
"PERCENTILE_CONT"
,
"PERCENTILE_DISC"
,
"POWER"
,
"REGR_AVGX"
,
"REGR_AVGY"
,
"REGR_COUNT"
,
"REGR_INTERCEPT"
,
"REGR_R2"
,
"REGR_SLOPE"
,
"REGR_SXX"
,
"REGR_SXY"
,
"REGR_SYY"
,
"SQRT"
,
"SUBSTRING"
,
"SUM"
,
"TRIM"
,
"UESCAPE"
,
"UPPER"
,
};
public
static
final
String
[]
SQL2003_NON_RESERVED_KEYWORDS
=
{
"A"
,
"ABSOLUTE"
,
...
...
@@ -573,9 +565,12 @@ public class SQLConstants {
"MODIFY"
,
};
public
static
final
String
[]
DEFAULT_TYPES
=
{
"BOOLEAN"
,
"CHAR"
,
"VARCHAR"
,
"BINARY"
,
"VARBINARY"
,
"INT"
,
"INTEGER"
,
"SMALLINT"
,
"BIGINT"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录