Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
baea6316
提交
baea6316
authored
8月 07, 2017
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue #585: MySQL mode DELETE statements compatibility
上级
9e9e37f9
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
14 行增加
和
3 行删除
+14
-3
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+5
-1
Mode.java
h2/src/main/org/h2/engine/Mode.java
+2
-2
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+5
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
baea6316
...
@@ -21,6 +21,8 @@ Change Log
...
@@ -21,6 +21,8 @@ Change Log
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul>
<ul>
<li>
Issue #585: MySQL mode DELETE statements compatibility
</li>
<li>
Issue #569: ClassCastException when filtering on ENUM value in WHERE clause
<li>
Issue #569: ClassCastException when filtering on ENUM value in WHERE clause
</li>
</li>
<li>
Issue #539: Allow override of builtin functions/aliases
<li>
Issue #539: Allow override of builtin functions/aliases
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
baea6316
...
@@ -92,6 +92,7 @@ import org.h2.engine.Constants;
...
@@ -92,6 +92,7 @@ import org.h2.engine.Constants;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.DbObject
;
import
org.h2.engine.DbObject
;
import
org.h2.engine.FunctionAlias
;
import
org.h2.engine.FunctionAlias
;
import
org.h2.engine.Mode
;
import
org.h2.engine.Procedure
;
import
org.h2.engine.Procedure
;
import
org.h2.engine.Right
;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
...
@@ -818,7 +819,10 @@ public class Parser {
...
@@ -818,7 +819,10 @@ public class Parser {
}
}
currentPrepared
=
command
;
currentPrepared
=
command
;
int
start
=
lastParseIndex
;
int
start
=
lastParseIndex
;
readIf
(
"FROM"
);
if
(!
readIf
(
"FROM"
)
&&
database
.
getMode
()
==
Mode
.
MYSQL
)
{
readIdentifierWithSchema
();
read
(
"FROM"
);
}
TableFilter
filter
=
readSimpleTableFilter
(
0
);
TableFilter
filter
=
readSimpleTableFilter
(
0
);
command
.
setTableFilter
(
filter
);
command
.
setTableFilter
(
filter
);
if
(
readIf
(
"WHERE"
))
{
if
(
readIf
(
"WHERE"
))
{
...
...
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
baea6316
...
@@ -9,7 +9,6 @@ import java.util.Collections;
...
@@ -9,7 +9,6 @@ import java.util.Collections;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -25,6 +24,7 @@ public class Mode {
...
@@ -25,6 +24,7 @@ public class Mode {
static
final
String
REGULAR
=
"REGULAR"
;
static
final
String
REGULAR
=
"REGULAR"
;
private
static
final
HashMap
<
String
,
Mode
>
MODES
=
New
.
hashMap
();
private
static
final
HashMap
<
String
,
Mode
>
MODES
=
New
.
hashMap
();
public
static
final
Mode
MYSQL
;
// Modes are also documented in the features section
// Modes are also documented in the features section
...
@@ -236,7 +236,7 @@ public class Mode {
...
@@ -236,7 +236,7 @@ public class Mode {
mode
.
supportedClientInfoPropertiesRegEx
=
null
;
mode
.
supportedClientInfoPropertiesRegEx
=
null
;
add
(
mode
);
add
(
mode
);
mode
=
new
Mode
(
"MySQL"
);
MYSQL
=
mode
=
new
Mode
(
"MySQL"
);
mode
.
convertInsertNullToZero
=
true
;
mode
.
convertInsertNullToZero
=
true
;
mode
.
indexDefinitionInCreateTable
=
true
;
mode
.
indexDefinitionInCreateTable
=
true
;
mode
.
lowerCaseIdentifiers
=
true
;
mode
.
lowerCaseIdentifiers
=
true
;
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
baea6316
...
@@ -292,6 +292,7 @@ public class TestCompatibility extends TestBase {
...
@@ -292,6 +292,7 @@ public class TestCompatibility extends TestBase {
private
void
testMySQL
()
throws
SQLException
{
private
void
testMySQL
()
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"set mode mysql"
);
stat
.
execute
(
"create schema test_schema"
);
stat
.
execute
(
"create schema test_schema"
);
stat
.
execute
(
"use test_schema"
);
stat
.
execute
(
"use test_schema"
);
assertResult
(
"TEST_SCHEMA"
,
stat
,
"select schema()"
);
assertResult
(
"TEST_SCHEMA"
,
stat
,
"select schema()"
);
...
@@ -312,6 +313,10 @@ public class TestCompatibility extends TestBase {
...
@@ -312,6 +313,10 @@ public class TestCompatibility extends TestBase {
"SELECT FROM_UNIXTIME(1196300000, '%Y %M')"
);
"SELECT FROM_UNIXTIME(1196300000, '%Y %M')"
);
assertResult
(
"2003-12-31"
,
stat
,
assertResult
(
"2003-12-31"
,
stat
,
"SELECT DATE('2003-12-31 11:02:03')"
);
"SELECT DATE('2003-12-31 11:02:03')"
);
assertResult
(
"2003-12-31"
,
stat
,
"SELECT DATE('2003-12-31 11:02:03')"
);
// check the weird MySQL variant of DELETE
stat
.
execute
(
"DELETE TEST FROM TEST WHERE 1=2"
);
if
(
config
.
memory
)
{
if
(
config
.
memory
)
{
return
;
return
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论