Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
dec792ce
提交
dec792ce
authored
9 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/h2database/h2database
上级
a90a803e
efe3c311
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
63 行增加
和
33 行删除
+63
-33
changelog.html
h2/src/docsrc/html/changelog.html
+2
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+5
-1
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+32
-32
Mode.java
h2/src/main/org/h2/engine/Mode.java
+7
-0
TestCompatibilityOracle.java
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
+17
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
dec792ce
...
...
@@ -24,6 +24,8 @@ Change Log
<li>
For compatibility with other databases, support for (double and float)
-0.0 has been removed. 0.0 is used instead.
</li>
<li>
Fix for #134, Column name with a # character. Patch by bradmesserle.
</li>
<li>
In version 1.4.186, "order by" was broken in some cases
due to the change "Make the planner use indexes for sorting when doing a GROUP BY".
The change was reverted.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Parser.java
浏览文件 @
dec792ce
...
...
@@ -14,7 +14,6 @@ import java.nio.charset.Charset;
import
java.text.Collator
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.Trigger
;
import
org.h2.command.ddl.AlterIndexRename
;
...
...
@@ -3573,6 +3572,11 @@ public class Parser {
case
'_'
:
type
=
CHAR_NAME
;
break
;
case
'#'
:
if
(
database
.
getMode
().
supportPoundSymbolForColumnNames
)
{
type
=
CHAR_NAME
;
break
;
}
default
:
if
(
c
>=
'a'
&&
c
<=
'z'
)
{
if
(
identifiersToUpper
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
dec792ce
...
...
@@ -382,7 +382,9 @@ public class ConnectionInfo implements Cloneable {
* @return the database name
*/
public
String
getName
()
{
if
(
persistent
)
{
if
(!
persistent
)
{
return
name
;
}
if
(
nameNormalized
==
null
)
{
if
(!
SysProperties
.
IMPLICIT_RELATIVE_PATH
)
{
if
(!
FileUtils
.
isAbsolute
(
name
))
{
...
...
@@ -417,8 +419,6 @@ public class ConnectionInfo implements Cloneable {
}
return
nameNormalized
;
}
return
name
;
}
/**
* Get the file password hash if it is set.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
dec792ce
...
...
@@ -137,6 +137,11 @@ public class Mode {
*/
public
boolean
onDuplicateKeyUpdate
;
/**
* Support the # for column names
*/
public
boolean
supportPoundSymbolForColumnNames
;
private
final
String
name
;
static
{
...
...
@@ -173,6 +178,7 @@ public class Mode {
mode
.
uniqueIndexSingleNull
=
true
;
mode
.
allowPlusForStringConcat
=
true
;
mode
.
swapConvertFunctionParameters
=
true
;
mode
.
supportPoundSymbolForColumnNames
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"MySQL"
);
...
...
@@ -187,6 +193,7 @@ public class Mode {
mode
.
convertOnlyToSmallerScale
=
true
;
mode
.
uniqueIndexSingleNullExceptAllColumnsAreNull
=
true
;
mode
.
treatEmptyStringsAsNull
=
true
;
mode
.
supportPoundSymbolForColumnNames
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"PostgreSQL"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCompatibilityOracle.java
浏览文件 @
dec792ce
...
...
@@ -34,6 +34,7 @@ public class TestCompatibilityOracle extends TestBase {
public
void
test
()
throws
Exception
{
testTreatEmptyStringsAsNull
();
testDecimalScale
();
testPoundSymbolInColumnName
();
}
private
void
testTreatEmptyStringsAsNull
()
throws
SQLException
{
...
...
@@ -121,6 +122,22 @@ public class TestCompatibilityOracle extends TestBase {
conn
.
close
();
}
/**
* Test the # in a column name for oracle compatibility
*/
private
void
testPoundSymbolInColumnName
()
throws
SQLException
{
deleteDb
(
"oracle"
);
Connection
conn
=
getConnection
(
"oracle;MODE=Oracle"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, U##NAME VARCHAR(255))"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, 'Hello'), (2, 'HelloWorld'), (3, 'HelloWorldWorld')"
);
assertResult
(
"1"
,
stat
,
"SELECT ID FROM TEST where U##NAME ='Hello'"
);
conn
.
close
();
}
private
void
assertResult
(
Object
[][]
expectedRowsOfValues
,
Statement
stat
,
String
sql
)
throws
SQLException
{
assertResult
(
newSimpleResultSet
(
expectedRowsOfValues
),
stat
,
sql
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论