Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
92114d22
提交
92114d22
authored
9月 19, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The database supports the SHOW command for better MySQL and PostgreSQL compatibility.
上级
fe62b1dc
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
66 行增加
和
8 行删除
+66
-8
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+64
-7
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
92114d22
...
...
@@ -18,7 +18,8 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The H2 Console now abbreviates large texts in results.
<ul><li>
The database supports the SHOW command for better MySQL and PostgreSQL compatibility.
</li><li>
The H2 Console now abbreviates large texts in results.
</li><li>
Multiple UNION queries could not be used in derived tables.
</li><li>
Linked tables can now be read-only.
</li><li>
Temporary linked tables are now supported.
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
92114d22
...
...
@@ -10,9 +10,7 @@ import java.math.BigDecimal;
import
java.math.BigInteger
;
import
java.sql.SQLException
;
import
java.text.Collator
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
org.h2.api.Trigger
;
import
org.h2.command.ddl.AlterIndexRename
;
...
...
@@ -400,6 +398,8 @@ public class Parser {
c
=
parseScript
();
}
else
if
(
readIf
(
"SHUTDOWN"
))
{
c
=
parseShutdown
();
}
else
if
(
readIf
(
"SHOW"
))
{
c
=
parseShow
();
}
break
;
case
'T'
:
...
...
@@ -768,6 +768,7 @@ public class Parser {
private
Prepared
parseHelp
()
throws
SQLException
{
StringBuffer
buff
=
new
StringBuffer
(
"SELECT * FROM INFORMATION_SCHEMA.HELP"
);
int
i
=
0
;
ObjectArray
paramValues
=
new
ObjectArray
();
while
(
currentTokenType
!=
END
)
{
String
s
=
currentToken
;
read
();
...
...
@@ -777,10 +778,61 @@ public class Parser {
buff
.
append
(
" AND "
);
}
i
++;
buff
.
append
(
"UPPER(TOPIC) LIKE "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
"%"
+
s
+
"%"
));
buff
.
append
(
"UPPER(TOPIC) LIKE
?
"
);
paramValues
.
add
(
ValueString
.
get
(
"%"
+
s
+
"%"
));
}
return
session
.
prepare
(
buff
.
toString
());
return
prepare
(
session
,
buff
.
toString
(),
paramValues
);
}
private
Prepared
parseShow
()
throws
SQLException
{
ObjectArray
paramValues
=
new
ObjectArray
();
StringBuffer
buff
=
new
StringBuffer
(
"SELECT "
);
if
(
readIf
(
"CLIENT_ENCODING"
))
{
// for PostgreSQL compatibility
buff
.
append
(
"'UNICODE' AS CLIENT_ENCODING FROM DUAL"
);
}
else
if
(
readIf
(
"DATESTYLE"
))
{
// for PostgreSQL compatibility
buff
.
append
(
"'ISO' AS DATESTYLE FROM DUAL"
);
}
else
if
(
readIf
(
"SERVER_VERSION"
))
{
// for PostgreSQL compatibility
buff
.
append
(
"'8.1.4' AS SERVER_VERSION FROM DUAL"
);
}
else
if
(
readIf
(
"SERVER_ENCODING"
))
{
// for PostgreSQL compatibility
buff
.
append
(
"'UTF8' AS SERVER_ENCODING FROM DUAL"
);
}
else
if
(
readIf
(
"TABLES"
))
{
// for MySQL compatibility
String
schema
=
Constants
.
SCHEMA_MAIN
;
if
(
readIf
(
"FROM"
))
{
schema
=
readUniqueIdentifier
();
}
buff
.
append
(
"TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=? ORDER BY TABLE_NAME"
);
paramValues
.
add
(
ValueString
.
get
(
schema
));
}
else
if
(
readIf
(
"COLUMNS"
))
{
// for MySQL compatibility
read
(
"FROM"
);
String
tableName
=
readUniqueIdentifier
();
paramValues
.
add
(
ValueString
.
get
(
tableName
));
String
schema
=
Constants
.
SCHEMA_MAIN
;
if
(
readIf
(
"FROM"
))
{
schema
=
readUniqueIdentifier
();
}
buff
.
append
(
"COLUMN_NAME, TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=? AND TABLE_SCHEMA=? ORDER BY ORDINAL_POSITION"
);
paramValues
.
add
(
ValueString
.
get
(
schema
));
}
else
if
(
readIf
(
"DATABASES"
)
||
readIf
(
"SCHEMAS"
))
{
// for MySQL compatibility
buff
.
append
(
"SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA"
);
}
return
prepare
(
session
,
buff
.
toString
(),
paramValues
);
}
private
Prepared
prepare
(
Session
session
,
String
sql
,
ObjectArray
paramValues
)
throws
SQLException
{
Prepared
prep
=
session
.
prepare
(
sql
);
ObjectArray
params
=
prep
.
getParameters
();
for
(
int
i
=
0
;
params
!=
null
&&
i
<
params
.
size
();
i
++)
{
Parameter
p
=
(
Parameter
)
params
.
get
(
i
);
p
.
setValue
((
Value
)
paramValues
.
get
(
i
));
}
return
prep
;
}
private
Merge
parseMerge
()
throws
SQLException
{
...
...
@@ -1854,7 +1906,7 @@ public class Parser {
throw
Message
.
getSQLException
(
ErrorCode
.
FUNCTION_NOT_FOUND_1
,
name
);
}
Expression
[]
args
;
List
argList
=
new
ArrayList
();
ObjectArray
argList
=
new
ObjectArray
();
int
numArgs
=
0
;
while
(!
readIf
(
")"
))
{
if
(
numArgs
++
>
0
)
{
...
...
@@ -4007,7 +4059,12 @@ public class Parser {
}
else
if
(
readIf
(
"DATESTYLE"
))
{
// PostgreSQL compatibility
readIfEqualOrTo
();
read
(
"ISO"
);
if
(!
readIf
(
"ISO"
))
{
String
s
=
readString
();
if
(!
s
.
equals
(
"ISO"
))
{
throw
getSyntaxError
();
}
}
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"SEARCH_PATH"
)
||
readIf
(
SetTypes
.
getTypeName
(
SetTypes
.
SCHEMA_SEARCH_PATH
)))
{
readIfEqualOrTo
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论