Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
bd0bd5d1
提交
bd0bd5d1
authored
2月 14, 2019
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add DATABASE_TO_LOWER and CASE_INSENSITIVE_IDENTIFIERS
上级
27a103a2
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
151 行增加
和
74 行删除
+151
-74
Parser.java
h2/src/main/org/h2/command/Parser.java
+28
-12
Constants.java
h2/src/main/org/h2/engine/Constants.java
+10
-0
Database.java
h2/src/main/org/h2/engine/Database.java
+34
-10
DbSettings.java
h2/src/main/org/h2/engine/DbSettings.java
+30
-4
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+1
-2
Session.java
h2/src/main/org/h2/engine/Session.java
+1
-1
JavaFunction.java
h2/src/main/org/h2/expression/function/JavaFunction.java
+1
-1
Schema.java
h2/src/main/org/h2/schema/Schema.java
+0
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+43
-39
TableView.java
h2/src/main/org/h2/table/TableView.java
+1
-2
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+1
-1
TestPgServer.java
h2/src/test/org/h2/test/unit/TestPgServer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
bd0bd5d1
...
@@ -609,6 +609,11 @@ public class Parser {
...
@@ -609,6 +609,11 @@ public class Parser {
private
final
Database
database
;
private
final
Database
database
;
private
final
Session
session
;
private
final
Session
session
;
/**
* @see org.h2.engine.DbSettings#databaseToLower
*/
private
final
boolean
identifiersToLower
;
/**
/**
* @see org.h2.engine.DbSettings#databaseToUpper
* @see org.h2.engine.DbSettings#databaseToUpper
*/
*/
...
@@ -645,6 +650,7 @@ public class Parser {
...
@@ -645,6 +650,7 @@ public class Parser {
public
Parser
(
Session
session
)
{
public
Parser
(
Session
session
)
{
this
.
database
=
session
.
getDatabase
();
this
.
database
=
session
.
getDatabase
();
this
.
identifiersToLower
=
database
.
getSettings
().
databaseToLower
;
this
.
identifiersToUpper
=
database
.
getSettings
().
databaseToUpper
;
this
.
identifiersToUpper
=
database
.
getSettings
().
databaseToUpper
;
this
.
session
=
session
;
this
.
session
=
session
;
}
}
...
@@ -1375,9 +1381,12 @@ public class Parser {
...
@@ -1375,9 +1381,12 @@ public class Parser {
private
Prepared
parseHelp
()
{
private
Prepared
parseHelp
()
{
Select
select
=
new
Select
(
session
,
null
);
Select
select
=
new
Select
(
session
,
null
);
select
.
setWildcard
();
select
.
setWildcard
();
Table
table
=
database
.
getSchema
(
"INFORMATION_SCHEMA"
).
resolveTableOrView
(
session
,
"HELP"
);
String
informationSchema
=
database
.
sysIdentifier
(
"INFORMATION_SCHEMA"
);
Table
table
=
database
.
getSchema
(
informationSchema
)
.
resolveTableOrView
(
session
,
database
.
sysIdentifier
(
"HELP"
));
Function
function
=
Function
.
getFunction
(
database
,
"UPPER"
);
Function
function
=
Function
.
getFunction
(
database
,
"UPPER"
);
function
.
setParameter
(
0
,
new
ExpressionColumn
(
database
,
"INFORMATION_SCHEMA"
,
"HELP"
,
"TOPIC"
));
function
.
setParameter
(
0
,
new
ExpressionColumn
(
database
,
informationSchema
,
database
.
sysIdentifier
(
"HELP"
),
database
.
sysIdentifier
(
"TOPIC"
)));
function
.
doneWithParameters
();
function
.
doneWithParameters
();
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
null
,
rightsChecked
,
select
,
0
,
null
);
TableFilter
filter
=
new
TableFilter
(
session
,
table
,
null
,
rightsChecked
,
select
,
0
,
null
);
select
.
addTableFilter
(
filter
,
true
);
select
.
addTableFilter
(
filter
,
true
);
...
@@ -1419,7 +1428,7 @@ public class Parser {
...
@@ -1419,7 +1428,7 @@ public class Parser {
buff
.
append
(
"'UTF8' AS SERVER_ENCODING FROM DUAL"
);
buff
.
append
(
"'UTF8' AS SERVER_ENCODING FROM DUAL"
);
}
else
if
(
readIf
(
"TABLES"
))
{
}
else
if
(
readIf
(
"TABLES"
))
{
// for MySQL compatibility
// for MySQL compatibility
String
schema
=
Constants
.
SCHEMA_MAIN
;
String
schema
=
database
.
getMainSchema
().
getName
()
;
if
(
readIf
(
FROM
))
{
if
(
readIf
(
FROM
))
{
schema
=
readUniqueIdentifier
();
schema
=
readUniqueIdentifier
();
}
}
...
@@ -1825,7 +1834,7 @@ public class Parser {
...
@@ -1825,7 +1834,7 @@ public class Parser {
table
=
parseValuesTable
(
0
).
getTable
();
table
=
parseValuesTable
(
0
).
getTable
();
}
else
if
(
readIf
(
TABLE
))
{
}
else
if
(
readIf
(
TABLE
))
{
read
(
OPEN_PAREN
);
read
(
OPEN_PAREN
);
table
=
readTableFunction
(
"TABLE"
,
null
,
database
.
get
Schema
(
Constants
.
SCHEMA_MAIN
));
table
=
readTableFunction
(
"TABLE"
,
null
,
database
.
get
MainSchema
(
));
}
else
{
}
else
{
String
tableName
=
readIdentifierWithSchema
(
null
);
String
tableName
=
readIdentifierWithSchema
(
null
);
Schema
schema
;
Schema
schema
;
...
@@ -1850,7 +1859,7 @@ public class Parser {
...
@@ -1850,7 +1859,7 @@ public class Parser {
foundLeftBracket
=
false
;
foundLeftBracket
=
false
;
}
}
if
(
foundLeftBracket
)
{
if
(
foundLeftBracket
)
{
Schema
mainSchema
=
database
.
get
Schema
(
Constants
.
SCHEMA_MAIN
);
Schema
mainSchema
=
database
.
get
MainSchema
(
);
if
(
equalsToken
(
tableName
,
RangeTable
.
NAME
)
if
(
equalsToken
(
tableName
,
RangeTable
.
NAME
)
||
equalsToken
(
tableName
,
RangeTable
.
ALIAS
))
{
||
equalsToken
(
tableName
,
RangeTable
.
ALIAS
))
{
Expression
min
=
readExpression
();
Expression
min
=
readExpression
();
...
@@ -2812,7 +2821,7 @@ public class Parser {
...
@@ -2812,7 +2821,7 @@ public class Parser {
}
}
private
Table
getDualTable
(
boolean
noColumns
)
{
private
Table
getDualTable
(
boolean
noColumns
)
{
Schema
main
=
database
.
findSchema
(
Constants
.
SCHEMA_MAIN
);
Schema
main
=
database
.
getMainSchema
(
);
Expression
one
=
ValueExpression
.
get
(
ValueLong
.
get
(
1
));
Expression
one
=
ValueExpression
.
get
(
ValueLong
.
get
(
1
));
return
new
RangeTable
(
main
,
one
,
one
,
noColumns
);
return
new
RangeTable
(
main
,
one
,
one
,
noColumns
);
}
}
...
@@ -4098,8 +4107,7 @@ public class Parser {
...
@@ -4098,8 +4107,7 @@ public class Parser {
read
(
DOT
);
read
(
DOT
);
}
}
if
(
readIf
(
"REGCLASS"
))
{
if
(
readIf
(
"REGCLASS"
))
{
FunctionAlias
f
=
findFunctionAlias
(
Constants
.
SCHEMA_MAIN
,
FunctionAlias
f
=
findFunctionAlias
(
database
.
getMainSchema
().
getName
(),
"PG_GET_OID"
);
"PG_GET_OID"
);
if
(
f
==
null
)
{
if
(
f
==
null
)
{
throw
getSyntaxError
();
throw
getSyntaxError
();
}
}
...
@@ -5050,6 +5058,10 @@ public class Parser {
...
@@ -5050,6 +5058,10 @@ public class Parser {
}
}
type
=
CHAR_NAME
;
type
=
CHAR_NAME
;
}
else
if
(
c
>=
'A'
&&
c
<=
'Z'
)
{
}
else
if
(
c
>=
'A'
&&
c
<=
'Z'
)
{
if
(
identifiersToLower
)
{
command
[
i
]
=
(
char
)
(
c
+
(
'a'
-
'A'
));
changed
=
true
;
}
type
=
CHAR_NAME
;
type
=
CHAR_NAME
;
}
else
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
}
else
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
type
=
CHAR_VALUE
;
type
=
CHAR_VALUE
;
...
@@ -5058,8 +5070,8 @@ public class Parser {
...
@@ -5058,8 +5070,8 @@ public class Parser {
// whitespace
// whitespace
}
else
if
(
Character
.
isJavaIdentifierPart
(
c
))
{
}
else
if
(
Character
.
isJavaIdentifierPart
(
c
))
{
type
=
CHAR_NAME
;
type
=
CHAR_NAME
;
if
(
identifiersToUpper
)
{
if
(
identifiersToUpper
||
identifiersToLower
)
{
char
u
=
Character
.
toUpp
erCase
(
c
);
char
u
=
identifiersToUpper
?
Character
.
toUpperCase
(
c
)
:
Character
.
toLow
erCase
(
c
);
if
(
u
!=
c
)
{
if
(
u
!=
c
)
{
command
[
i
]
=
u
;
command
[
i
]
=
u
;
changed
=
true
;
changed
=
true
;
...
@@ -5931,7 +5943,7 @@ public class Parser {
...
@@ -5931,7 +5943,7 @@ public class Parser {
}
}
private
TableFilter
parseValuesTable
(
int
orderInFrom
)
{
private
TableFilter
parseValuesTable
(
int
orderInFrom
)
{
Schema
mainSchema
=
database
.
get
Schema
(
Constants
.
SCHEMA_MAIN
);
Schema
mainSchema
=
database
.
get
MainSchema
(
);
TableFunction
tf
=
(
TableFunction
)
Function
.
getFunction
(
database
,
"TABLE"
);
TableFunction
tf
=
(
TableFunction
)
Function
.
getFunction
(
database
,
"TABLE"
);
ArrayList
<
Column
>
columns
=
Utils
.
newSmallArrayList
();
ArrayList
<
Column
>
columns
=
Utils
.
newSmallArrayList
();
ArrayList
<
ArrayList
<
Expression
>>
rows
=
Utils
.
newSmallArrayList
();
ArrayList
<
ArrayList
<
Expression
>>
rows
=
Utils
.
newSmallArrayList
();
...
@@ -6909,7 +6921,11 @@ public class Parser {
...
@@ -6909,7 +6921,11 @@ public class Parser {
currentToken
=
SetTypes
currentToken
=
SetTypes
.
getTypeName
(
SetTypes
.
REFERENTIAL_INTEGRITY
);
.
getTypeName
(
SetTypes
.
REFERENTIAL_INTEGRITY
);
}
}
int
type
=
SetTypes
.
getType
(
currentToken
);
String
typeName
=
currentToken
;
if
(!
identifiersToUpper
)
{
typeName
=
StringUtils
.
toUpperEnglish
(
typeName
);
}
int
type
=
SetTypes
.
getType
(
typeName
);
if
(
type
<
0
)
{
if
(
type
<
0
)
{
throw
getSyntaxError
();
throw
getSyntaxError
();
}
}
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
bd0bd5d1
...
@@ -401,6 +401,16 @@ public class Constants {
...
@@ -401,6 +401,16 @@ public class Constants {
*/
*/
public
static
final
int
SALT_LEN
=
8
;
public
static
final
int
SALT_LEN
=
8
;
/**
* The identity of INFORMATION_SCHEMA.
*/
public
static
final
int
META_SCHEMA_ID
=
-
1
;
/**
* The identity of PUBLIC schema.
*/
public
static
final
int
MAIN_SCHEMA_ID
=
0
;
/**
/**
* The name of the default schema.
* The name of the default schema.
*/
*/
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
bd0bd5d1
...
@@ -660,7 +660,8 @@ public class Database implements DataHandler {
...
@@ -660,7 +660,8 @@ public class Database implements DataHandler {
if
(
n
==
null
||
n
.
isEmpty
())
{
if
(
n
==
null
||
n
.
isEmpty
())
{
n
=
"unnamed"
;
n
=
"unnamed"
;
}
}
return
dbSettings
.
databaseToUpper
?
StringUtils
.
toUpperEnglish
(
n
)
:
n
;
return
dbSettings
.
databaseToUpper
?
StringUtils
.
toUpperEnglish
(
n
)
:
dbSettings
.
databaseToLower
?
StringUtils
.
toLowerEnglish
(
n
)
:
n
;
}
}
private
synchronized
void
open
(
int
traceLevelFile
,
int
traceLevelSystemOut
,
ConnectionInfo
ci
)
{
private
synchronized
void
open
(
int
traceLevelFile
,
int
traceLevelSystemOut
,
ConnectionInfo
ci
)
{
...
@@ -788,12 +789,14 @@ public class Database implements DataHandler {
...
@@ -788,12 +789,14 @@ public class Database implements DataHandler {
store
.
getTransactionStore
().
init
();
store
.
getTransactionStore
().
init
();
}
}
systemUser
=
new
User
(
this
,
0
,
SYSTEM_USER_NAME
,
true
);
systemUser
=
new
User
(
this
,
0
,
SYSTEM_USER_NAME
,
true
);
mainSchema
=
new
Schema
(
this
,
0
,
Constants
.
SCHEMA_MAIN
,
systemUser
,
true
);
mainSchema
=
new
Schema
(
this
,
Constants
.
MAIN_SCHEMA_ID
,
sysIdentifier
(
Constants
.
SCHEMA_MAIN
),
systemUser
,
infoSchema
=
new
Schema
(
this
,
-
1
,
"INFORMATION_SCHEMA"
,
systemUser
,
true
);
true
);
infoSchema
=
new
Schema
(
this
,
Constants
.
META_SCHEMA_ID
,
sysIdentifier
(
"INFORMATION_SCHEMA"
),
systemUser
,
true
);
schemas
.
put
(
mainSchema
.
getName
(),
mainSchema
);
schemas
.
put
(
mainSchema
.
getName
(),
mainSchema
);
schemas
.
put
(
infoSchema
.
getName
(),
infoSchema
);
schemas
.
put
(
infoSchema
.
getName
(),
infoSchema
);
publicRole
=
new
Role
(
this
,
0
,
Constants
.
PUBLIC_ROLE_NAME
,
true
);
publicRole
=
new
Role
(
this
,
0
,
sysIdentifier
(
Constants
.
PUBLIC_ROLE_NAME
)
,
true
);
roles
.
put
(
Constants
.
PUBLIC_ROLE_NAME
,
publicRole
);
roles
.
put
(
publicRole
.
getName
()
,
publicRole
);
systemUser
.
setAdmin
(
true
);
systemUser
.
setAdmin
(
true
);
systemSession
=
new
Session
(
this
,
systemUser
,
++
nextSessionId
);
systemSession
=
new
Session
(
this
,
systemUser
,
++
nextSessionId
);
lobSession
=
new
Session
(
this
,
systemUser
,
++
nextSessionId
);
lobSession
=
new
Session
(
this
,
systemUser
,
++
nextSessionId
);
...
@@ -1687,6 +1690,15 @@ public class Database implements DataHandler {
...
@@ -1687,6 +1690,15 @@ public class Database implements DataHandler {
return
i
;
return
i
;
}
}
/**
* Returns main schema (usually PUBLIC).
*
* @return main schema (usually PUBLIC)
*/
public
Schema
getMainSchema
()
{
return
mainSchema
;
}
public
ArrayList
<
UserAggregate
>
getAllAggregates
()
{
public
ArrayList
<
UserAggregate
>
getAllAggregates
()
{
return
new
ArrayList
<>(
aggregates
.
values
());
return
new
ArrayList
<>(
aggregates
.
values
());
}
}
...
@@ -2760,8 +2772,8 @@ public class Database implements DataHandler {
...
@@ -2760,8 +2772,8 @@ public class Database implements DataHandler {
continue
;
continue
;
}
}
// exclude the LOB_MAP that the Recover tool creates
// exclude the LOB_MAP that the Recover tool creates
if
(
table
.
get
Name
().
equals
(
"LOB_BLOCKS"
)
&&
table
.
getSchema
()
if
(
table
.
get
Schema
().
getId
()
==
Constants
.
META_SCHEMA_ID
.
getName
().
equals
(
"INFORMATION_SCHEMA
"
))
{
&&
table
.
getName
().
equalsIgnoreCase
(
"LOB_BLOCKS
"
))
{
continue
;
continue
;
}
}
return
table
;
return
table
;
...
@@ -3041,7 +3053,7 @@ public class Database implements DataHandler {
...
@@ -3041,7 +3053,7 @@ public class Database implements DataHandler {
* @return the hash map
* @return the hash map
*/
*/
public
<
V
>
HashMap
<
String
,
V
>
newStringMap
()
{
public
<
V
>
HashMap
<
String
,
V
>
newStringMap
()
{
return
dbSettings
.
databaseToUpper
?
new
HashMap
<
String
,
V
>()
:
new
CaseInsensitiveMap
<
V
>();
return
dbSettings
.
caseInsensitiveIdentifiers
?
new
CaseInsensitiveMap
<
V
>()
:
new
HashMap
<
String
,
V
>();
}
}
/**
/**
...
@@ -3052,7 +3064,8 @@ public class Database implements DataHandler {
...
@@ -3052,7 +3064,8 @@ public class Database implements DataHandler {
* @return the hash map
* @return the hash map
*/
*/
public
<
V
>
ConcurrentHashMap
<
String
,
V
>
newConcurrentStringMap
()
{
public
<
V
>
ConcurrentHashMap
<
String
,
V
>
newConcurrentStringMap
()
{
return
dbSettings
.
databaseToUpper
?
new
ConcurrentHashMap
<
String
,
V
>()
:
new
CaseInsensitiveConcurrentMap
<
V
>();
return
dbSettings
.
caseInsensitiveIdentifiers
?
new
CaseInsensitiveConcurrentMap
<
V
>()
:
new
ConcurrentHashMap
<
String
,
V
>();
}
}
/**
/**
...
@@ -3064,7 +3077,18 @@ public class Database implements DataHandler {
...
@@ -3064,7 +3077,18 @@ public class Database implements DataHandler {
* @return true if they match
* @return true if they match
*/
*/
public
boolean
equalsIdentifiers
(
String
a
,
String
b
)
{
public
boolean
equalsIdentifiers
(
String
a
,
String
b
)
{
return
a
.
equals
(
b
)
||
(!
dbSettings
.
databaseToUpper
&&
a
.
equalsIgnoreCase
(
b
));
return
a
.
equals
(
b
)
||
dbSettings
.
caseInsensitiveIdentifiers
&&
a
.
equalsIgnoreCase
(
b
);
}
/**
* Returns identifier in upper or lower case depending on database settings.
*
* @param upperName
* identifier in the upper case
* @return identifier in upper or lower case
*/
public
String
sysIdentifier
(
String
upperName
)
{
return
dbSettings
.
databaseToLower
?
StringUtils
.
toLowerEnglish
(
upperName
)
:
upperName
;
}
}
@Override
@Override
...
...
h2/src/main/org/h2/engine/DbSettings.java
浏览文件 @
bd0bd5d1
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
org
.
h2
.
engine
;
package
org
.
h2
.
engine
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
...
@@ -55,15 +56,28 @@ public class DbSettings extends SettingsBase {
...
@@ -55,15 +56,28 @@ public class DbSettings extends SettingsBase {
*/
*/
public
final
int
analyzeSample
=
get
(
"ANALYZE_SAMPLE"
,
10_000
);
public
final
int
analyzeSample
=
get
(
"ANALYZE_SAMPLE"
,
10_000
);
/**
* Database setting <code>DATABASE_TO_LOWER</code> (default: false).<br />
* Database short names are converted to lowercase for the DATABASE()
* function, and in the CATALOG column of all database meta data methods.
* Setting this to "true" is experimental.
*/
public
final
boolean
databaseToLower
;
/**
/**
* Database setting <code>DATABASE_TO_UPPER</code> (default: true).<br />
* Database setting <code>DATABASE_TO_UPPER</code> (default: true).<br />
* Database short names are converted to uppercase for the DATABASE()
* Database short names are converted to uppercase for the DATABASE()
* function, and in the CATALOG column of all database meta data methods.
* function, and in the CATALOG column of all database meta data methods.
* Setting this to "false" is experimental. When set to false, all
* identifier names (table names, column names) are case sensitive (except
* aggregate, built-in functions, data types, and keywords).
*/
*/
public
final
boolean
databaseToUpper
=
get
(
"DATABASE_TO_UPPER"
,
true
);
public
final
boolean
databaseToUpper
;
/**
* Database setting <code>CASE_INSENSITIVE_IDENTIFIERS</code> (default:
* false).<br />
* When set to true, all identifier names (table names, column names) are
* case insensitive. Setting this to "true" is experimental.
*/
public
final
boolean
caseInsensitiveIdentifiers
=
get
(
"CASE_INSENSITIVE_IDENTIFIERS"
,
false
);
/**
/**
* Database setting <code>DB_CLOSE_ON_EXIT</code> (default: true).<br />
* Database setting <code>DB_CLOSE_ON_EXIT</code> (default: true).<br />
...
@@ -337,6 +351,18 @@ public class DbSettings extends SettingsBase {
...
@@ -337,6 +351,18 @@ public class DbSettings extends SettingsBase {
if
(
s
.
get
(
"NESTED_JOINS"
)
!=
null
||
Utils
.
getProperty
(
"h2.nestedJoins"
,
null
)
!=
null
)
{
if
(
s
.
get
(
"NESTED_JOINS"
)
!=
null
||
Utils
.
getProperty
(
"h2.nestedJoins"
,
null
)
!=
null
)
{
throw
DbException
.
getUnsupportedException
(
"NESTED_JOINS setting is not available since 1.4.197"
);
throw
DbException
.
getUnsupportedException
(
"NESTED_JOINS setting is not available since 1.4.197"
);
}
}
boolean
lower
=
get
(
"DATABASE_TO_LOWER"
,
false
);
boolean
upperSet
=
containsKey
(
"DATABASE_TO_UPPER"
);
boolean
upper
=
get
(
"DATABASE_TO_UPPER"
,
true
);
if
(
lower
&&
upper
)
{
if
(
upperSet
)
{
throw
DbException
.
get
(
ErrorCode
.
UNSUPPORTED_SETTING_COMBINATION
,
"DATABASE_TO_LOWER & DATABASE_TO_UPPER"
);
}
upper
=
false
;
}
databaseToLower
=
lower
;
databaseToUpper
=
upper
;
}
}
/**
/**
...
...
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
bd0bd5d1
...
@@ -205,8 +205,7 @@ public class FunctionAlias extends SchemaObjectBase {
...
@@ -205,8 +205,7 @@ public class FunctionAlias extends SchemaObjectBase {
@Override
@Override
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
// TODO can remove this method once FUNCTIONS_IN_SCHEMA is enabled
// TODO can remove this method once FUNCTIONS_IN_SCHEMA is enabled
if
(
database
.
getSettings
().
functionsInSchema
||
if
(
database
.
getSettings
().
functionsInSchema
||
getSchema
().
getId
()
!=
Constants
.
MAIN_SCHEMA_ID
)
{
!
getSchema
().
getName
().
equals
(
Constants
.
SCHEMA_MAIN
))
{
return
super
.
getSQL
(
builder
);
return
super
.
getSQL
(
builder
);
}
}
return
Parser
.
quoteIdentifier
(
builder
,
getName
());
return
Parser
.
quoteIdentifier
(
builder
,
getName
());
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
bd0bd5d1
...
@@ -176,7 +176,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
...
@@ -176,7 +176,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
this
.
user
=
user
;
this
.
user
=
user
;
this
.
id
=
id
;
this
.
id
=
id
;
this
.
lockTimeout
=
database
.
getLockTimeout
();
this
.
lockTimeout
=
database
.
getLockTimeout
();
this
.
currentSchemaName
=
Constants
.
SCHEMA_MAIN
;
this
.
currentSchemaName
=
database
.
getMainSchema
().
getName
()
;
this
.
columnNamerConfiguration
=
ColumnNamerConfiguration
.
getDefault
();
this
.
columnNamerConfiguration
=
ColumnNamerConfiguration
.
getDefault
();
}
}
...
...
h2/src/main/org/h2/expression/function/JavaFunction.java
浏览文件 @
bd0bd5d1
...
@@ -84,7 +84,7 @@ public class JavaFunction extends Expression implements FunctionCall {
...
@@ -84,7 +84,7 @@ public class JavaFunction extends Expression implements FunctionCall {
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
public
StringBuilder
getSQL
(
StringBuilder
builder
)
{
// TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled
// TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled
if
(
functionAlias
.
getDatabase
().
getSettings
().
functionsInSchema
||
if
(
functionAlias
.
getDatabase
().
getSettings
().
functionsInSchema
||
!
functionAlias
.
getSchema
().
getName
().
equals
(
Constants
.
SCHEMA_MAIN
)
)
{
functionAlias
.
getSchema
().
getId
()
!=
Constants
.
MAIN_SCHEMA_ID
)
{
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getSchema
().
getName
()).
append
(
'.'
);
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getSchema
().
getName
()).
append
(
'.'
);
}
}
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getName
()).
append
(
'('
);
Parser
.
quoteIdentifier
(
builder
,
functionAlias
.
getName
()).
append
(
'('
);
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
bd0bd5d1
...
@@ -343,7 +343,6 @@ public class Schema extends DbObjectBase {
...
@@ -343,7 +343,6 @@ public class Schema extends DbObjectBase {
if
(
synonym
!=
null
)
{
if
(
synonym
!=
null
)
{
return
synonym
.
getSynonymFor
();
return
synonym
.
getSynonymFor
();
}
}
return
null
;
}
}
return
table
;
return
table
;
}
}
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
bd0bd5d1
...
@@ -139,7 +139,7 @@ public class MetaTable extends Table {
...
@@ -139,7 +139,7 @@ public class MetaTable extends Table {
String
indexColumnName
=
null
;
String
indexColumnName
=
null
;
switch
(
type
)
{
switch
(
type
)
{
case
TABLES:
case
TABLES:
set
Object
Name
(
"TABLES"
);
set
MetaTable
Name
(
"TABLES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TABLE_CATALOG"
,
"TABLE_CATALOG"
,
"TABLE_SCHEMA"
,
"TABLE_SCHEMA"
,
...
@@ -158,7 +158,7 @@ public class MetaTable extends Table {
...
@@ -158,7 +158,7 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
COLUMNS:
case
COLUMNS:
set
Object
Name
(
"COLUMNS"
);
set
MetaTable
Name
(
"COLUMNS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TABLE_CATALOG"
,
"TABLE_CATALOG"
,
"TABLE_SCHEMA"
,
"TABLE_SCHEMA"
,
...
@@ -197,7 +197,7 @@ public class MetaTable extends Table {
...
@@ -197,7 +197,7 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
INDEXES:
case
INDEXES:
set
Object
Name
(
"INDEXES"
);
set
MetaTable
Name
(
"INDEXES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TABLE_CATALOG"
,
"TABLE_CATALOG"
,
"TABLE_SCHEMA"
,
"TABLE_SCHEMA"
,
...
@@ -225,11 +225,11 @@ public class MetaTable extends Table {
...
@@ -225,11 +225,11 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
TABLE_TYPES:
case
TABLE_TYPES:
set
Object
Name
(
"TABLE_TYPES"
);
set
MetaTable
Name
(
"TABLE_TYPES"
);
cols
=
createColumns
(
"TYPE"
);
cols
=
createColumns
(
"TYPE"
);
break
;
break
;
case
TYPE_INFO:
case
TYPE_INFO:
set
Object
Name
(
"TYPE_INFO"
);
set
MetaTable
Name
(
"TYPE_INFO"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TYPE_NAME"
,
"TYPE_NAME"
,
"DATA_TYPE INT"
,
"DATA_TYPE INT"
,
...
@@ -248,15 +248,15 @@ public class MetaTable extends Table {
...
@@ -248,15 +248,15 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
CATALOGS:
case
CATALOGS:
set
Object
Name
(
"CATALOGS"
);
set
MetaTable
Name
(
"CATALOGS"
);
cols
=
createColumns
(
"CATALOG_NAME"
);
cols
=
createColumns
(
"CATALOG_NAME"
);
break
;
break
;
case
SETTINGS:
case
SETTINGS:
set
Object
Name
(
"SETTINGS"
);
set
MetaTable
Name
(
"SETTINGS"
);
cols
=
createColumns
(
"NAME"
,
"VALUE"
);
cols
=
createColumns
(
"NAME"
,
"VALUE"
);
break
;
break
;
case
HELP:
case
HELP:
set
Object
Name
(
"HELP"
);
set
MetaTable
Name
(
"HELP"
);
cols
=
createColumns
(
cols
=
createColumns
(
"ID INT"
,
"ID INT"
,
"SECTION"
,
"SECTION"
,
...
@@ -266,7 +266,7 @@ public class MetaTable extends Table {
...
@@ -266,7 +266,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
SEQUENCES:
case
SEQUENCES:
set
Object
Name
(
"SEQUENCES"
);
set
MetaTable
Name
(
"SEQUENCES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"SEQUENCE_CATALOG"
,
"SEQUENCE_CATALOG"
,
"SEQUENCE_SCHEMA"
,
"SEQUENCE_SCHEMA"
,
...
@@ -283,7 +283,7 @@ public class MetaTable extends Table {
...
@@ -283,7 +283,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
USERS:
case
USERS:
set
Object
Name
(
"USERS"
);
set
MetaTable
Name
(
"USERS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"NAME"
,
"NAME"
,
"ADMIN"
,
"ADMIN"
,
...
@@ -292,7 +292,7 @@ public class MetaTable extends Table {
...
@@ -292,7 +292,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
ROLES:
case
ROLES:
set
Object
Name
(
"ROLES"
);
set
MetaTable
Name
(
"ROLES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"NAME"
,
"NAME"
,
"REMARKS"
,
"REMARKS"
,
...
@@ -300,7 +300,7 @@ public class MetaTable extends Table {
...
@@ -300,7 +300,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
RIGHTS:
case
RIGHTS:
set
Object
Name
(
"RIGHTS"
);
set
MetaTable
Name
(
"RIGHTS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"GRANTEE"
,
"GRANTEE"
,
"GRANTEETYPE"
,
"GRANTEETYPE"
,
...
@@ -313,7 +313,7 @@ public class MetaTable extends Table {
...
@@ -313,7 +313,7 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
FUNCTION_ALIASES:
case
FUNCTION_ALIASES:
set
Object
Name
(
"FUNCTION_ALIASES"
);
set
MetaTable
Name
(
"FUNCTION_ALIASES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"ALIAS_CATALOG"
,
"ALIAS_CATALOG"
,
"ALIAS_SCHEMA"
,
"ALIAS_SCHEMA"
,
...
@@ -330,7 +330,7 @@ public class MetaTable extends Table {
...
@@ -330,7 +330,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
FUNCTION_COLUMNS:
case
FUNCTION_COLUMNS:
set
Object
Name
(
"FUNCTION_COLUMNS"
);
set
MetaTable
Name
(
"FUNCTION_COLUMNS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"ALIAS_CATALOG"
,
"ALIAS_CATALOG"
,
"ALIAS_SCHEMA"
,
"ALIAS_SCHEMA"
,
...
@@ -352,7 +352,7 @@ public class MetaTable extends Table {
...
@@ -352,7 +352,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
SCHEMATA:
case
SCHEMATA:
set
Object
Name
(
"SCHEMATA"
);
set
MetaTable
Name
(
"SCHEMATA"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CATALOG_NAME"
,
"CATALOG_NAME"
,
"SCHEMA_NAME"
,
"SCHEMA_NAME"
,
...
@@ -365,7 +365,7 @@ public class MetaTable extends Table {
...
@@ -365,7 +365,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
TABLE_PRIVILEGES:
case
TABLE_PRIVILEGES:
set
Object
Name
(
"TABLE_PRIVILEGES"
);
set
MetaTable
Name
(
"TABLE_PRIVILEGES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"GRANTOR"
,
"GRANTOR"
,
"GRANTEE"
,
"GRANTEE"
,
...
@@ -378,7 +378,7 @@ public class MetaTable extends Table {
...
@@ -378,7 +378,7 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
COLUMN_PRIVILEGES:
case
COLUMN_PRIVILEGES:
set
Object
Name
(
"COLUMN_PRIVILEGES"
);
set
MetaTable
Name
(
"COLUMN_PRIVILEGES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"GRANTOR"
,
"GRANTOR"
,
"GRANTEE"
,
"GRANTEE"
,
...
@@ -392,14 +392,14 @@ public class MetaTable extends Table {
...
@@ -392,14 +392,14 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
COLLATIONS:
case
COLLATIONS:
set
Object
Name
(
"COLLATIONS"
);
set
MetaTable
Name
(
"COLLATIONS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"NAME"
,
"NAME"
,
"KEY"
"KEY"
);
);
break
;
break
;
case
VIEWS:
case
VIEWS:
set
Object
Name
(
"VIEWS"
);
set
MetaTable
Name
(
"VIEWS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TABLE_CATALOG"
,
"TABLE_CATALOG"
,
"TABLE_SCHEMA"
,
"TABLE_SCHEMA"
,
...
@@ -414,14 +414,14 @@ public class MetaTable extends Table {
...
@@ -414,14 +414,14 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
IN_DOUBT:
case
IN_DOUBT:
set
Object
Name
(
"IN_DOUBT"
);
set
MetaTable
Name
(
"IN_DOUBT"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TRANSACTION"
,
"TRANSACTION"
,
"STATE"
"STATE"
);
);
break
;
break
;
case
CROSS_REFERENCES:
case
CROSS_REFERENCES:
set
Object
Name
(
"CROSS_REFERENCES"
);
set
MetaTable
Name
(
"CROSS_REFERENCES"
);
cols
=
createColumns
(
cols
=
createColumns
(
"PKTABLE_CATALOG"
,
"PKTABLE_CATALOG"
,
"PKTABLE_SCHEMA"
,
"PKTABLE_SCHEMA"
,
...
@@ -441,7 +441,7 @@ public class MetaTable extends Table {
...
@@ -441,7 +441,7 @@ public class MetaTable extends Table {
indexColumnName
=
"PKTABLE_NAME"
;
indexColumnName
=
"PKTABLE_NAME"
;
break
;
break
;
case
CONSTRAINTS:
case
CONSTRAINTS:
set
Object
Name
(
"CONSTRAINTS"
);
set
MetaTable
Name
(
"CONSTRAINTS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_SCHEMA"
,
"CONSTRAINT_SCHEMA"
,
...
@@ -460,7 +460,7 @@ public class MetaTable extends Table {
...
@@ -460,7 +460,7 @@ public class MetaTable extends Table {
indexColumnName
=
"TABLE_NAME"
;
indexColumnName
=
"TABLE_NAME"
;
break
;
break
;
case
CONSTANTS:
case
CONSTANTS:
set
Object
Name
(
"CONSTANTS"
);
set
MetaTable
Name
(
"CONSTANTS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CONSTANT_CATALOG"
,
"CONSTANT_CATALOG"
,
"CONSTANT_SCHEMA"
,
"CONSTANT_SCHEMA"
,
...
@@ -472,7 +472,7 @@ public class MetaTable extends Table {
...
@@ -472,7 +472,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
DOMAINS:
case
DOMAINS:
set
Object
Name
(
"DOMAINS"
);
set
MetaTable
Name
(
"DOMAINS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"DOMAIN_CATALOG"
,
"DOMAIN_CATALOG"
,
"DOMAIN_SCHEMA"
,
"DOMAIN_SCHEMA"
,
...
@@ -491,7 +491,7 @@ public class MetaTable extends Table {
...
@@ -491,7 +491,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
TRIGGERS:
case
TRIGGERS:
set
Object
Name
(
"TRIGGERS"
);
set
MetaTable
Name
(
"TRIGGERS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TRIGGER_CATALOG"
,
"TRIGGER_CATALOG"
,
"TRIGGER_SCHEMA"
,
"TRIGGER_SCHEMA"
,
...
@@ -510,7 +510,7 @@ public class MetaTable extends Table {
...
@@ -510,7 +510,7 @@ public class MetaTable extends Table {
);
);
break
;
break
;
case
SESSIONS:
{
case
SESSIONS:
{
set
Object
Name
(
"SESSIONS"
);
set
MetaTable
Name
(
"SESSIONS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"ID INT"
,
"ID INT"
,
"USER_NAME"
,
"USER_NAME"
,
...
@@ -524,7 +524,7 @@ public class MetaTable extends Table {
...
@@ -524,7 +524,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
LOCKS:
{
case
LOCKS:
{
set
Object
Name
(
"LOCKS"
);
set
MetaTable
Name
(
"LOCKS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"TABLE_SCHEMA"
,
"TABLE_SCHEMA"
,
"TABLE_NAME"
,
"TABLE_NAME"
,
...
@@ -534,7 +534,7 @@ public class MetaTable extends Table {
...
@@ -534,7 +534,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
SESSION_STATE:
{
case
SESSION_STATE:
{
set
Object
Name
(
"SESSION_STATE"
);
set
MetaTable
Name
(
"SESSION_STATE"
);
cols
=
createColumns
(
cols
=
createColumns
(
"KEY"
,
"KEY"
,
"SQL"
"SQL"
...
@@ -542,7 +542,7 @@ public class MetaTable extends Table {
...
@@ -542,7 +542,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
QUERY_STATISTICS:
{
case
QUERY_STATISTICS:
{
set
Object
Name
(
"QUERY_STATISTICS"
);
set
MetaTable
Name
(
"QUERY_STATISTICS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"SQL_STATEMENT"
,
"SQL_STATEMENT"
,
"EXECUTION_COUNT INT"
,
"EXECUTION_COUNT INT"
,
...
@@ -560,7 +560,7 @@ public class MetaTable extends Table {
...
@@ -560,7 +560,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
SYNONYMS:
{
case
SYNONYMS:
{
set
Object
Name
(
"SYNONYMS"
);
set
MetaTable
Name
(
"SYNONYMS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"SYNONYM_CATALOG"
,
"SYNONYM_CATALOG"
,
"SYNONYM_SCHEMA"
,
"SYNONYM_SCHEMA"
,
...
@@ -576,7 +576,7 @@ public class MetaTable extends Table {
...
@@ -576,7 +576,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
TABLE_CONSTRAINTS:
{
case
TABLE_CONSTRAINTS:
{
set
Object
Name
(
"TABLE_CONSTRAINTS"
);
set
MetaTable
Name
(
"TABLE_CONSTRAINTS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_SCHEMA"
,
"CONSTRAINT_SCHEMA"
,
...
@@ -592,7 +592,7 @@ public class MetaTable extends Table {
...
@@ -592,7 +592,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
KEY_COLUMN_USAGE:
{
case
KEY_COLUMN_USAGE:
{
set
Object
Name
(
"KEY_COLUMN_USAGE"
);
set
MetaTable
Name
(
"KEY_COLUMN_USAGE"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_SCHEMA"
,
"CONSTRAINT_SCHEMA"
,
...
@@ -608,7 +608,7 @@ public class MetaTable extends Table {
...
@@ -608,7 +608,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
REFERENTIAL_CONSTRAINTS:
{
case
REFERENTIAL_CONSTRAINTS:
{
set
Object
Name
(
"REFERENTIAL_CONSTRAINTS"
);
set
MetaTable
Name
(
"REFERENTIAL_CONSTRAINTS"
);
cols
=
createColumns
(
cols
=
createColumns
(
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_CATALOG"
,
"CONSTRAINT_SCHEMA"
,
"CONSTRAINT_SCHEMA"
,
...
@@ -631,13 +631,17 @@ public class MetaTable extends Table {
...
@@ -631,13 +631,17 @@ public class MetaTable extends Table {
indexColumn
=
-
1
;
indexColumn
=
-
1
;
metaIndex
=
null
;
metaIndex
=
null
;
}
else
{
}
else
{
indexColumn
=
getColumn
(
indexColumnName
).
getColumnId
();
indexColumn
=
getColumn
(
database
.
sysIdentifier
(
indexColumnName
)
).
getColumnId
();
IndexColumn
[]
indexCols
=
IndexColumn
.
wrap
(
IndexColumn
[]
indexCols
=
IndexColumn
.
wrap
(
new
Column
[]
{
cols
[
indexColumn
]
});
new
Column
[]
{
cols
[
indexColumn
]
});
metaIndex
=
new
MetaIndex
(
this
,
indexCols
,
false
);
metaIndex
=
new
MetaIndex
(
this
,
indexCols
,
false
);
}
}
}
}
private
void
setMetaTableName
(
String
upperName
)
{
setObjectName
(
database
.
sysIdentifier
(
upperName
));
}
private
Column
[]
createColumns
(
String
...
names
)
{
private
Column
[]
createColumns
(
String
...
names
)
{
Column
[]
cols
=
new
Column
[
names
.
length
];
Column
[]
cols
=
new
Column
[
names
.
length
];
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
...
@@ -653,7 +657,7 @@ public class MetaTable extends Table {
...
@@ -653,7 +657,7 @@ public class MetaTable extends Table {
dataType
=
DataType
.
getTypeByName
(
nameType
.
substring
(
idx
+
1
),
database
.
getMode
()).
type
;
dataType
=
DataType
.
getTypeByName
(
nameType
.
substring
(
idx
+
1
),
database
.
getMode
()).
type
;
name
=
nameType
.
substring
(
0
,
idx
);
name
=
nameType
.
substring
(
0
,
idx
);
}
}
cols
[
i
]
=
new
Column
(
name
,
dataType
);
cols
[
i
]
=
new
Column
(
database
.
sysIdentifier
(
name
)
,
dataType
);
}
}
return
cols
;
return
cols
;
}
}
...
@@ -886,7 +890,7 @@ public class MetaTable extends Table {
...
@@ -886,7 +890,7 @@ public class MetaTable extends Table {
// DOMAIN_CATALOG
// DOMAIN_CATALOG
domain
!=
null
?
catalog
:
null
,
domain
!=
null
?
catalog
:
null
,
// DOMAIN_SCHEMA
// DOMAIN_SCHEMA
domain
!=
null
?
Constants
.
SCHEMA_MAIN
:
null
,
domain
!=
null
?
database
.
getMainSchema
().
getName
()
:
null
,
// DOMAIN_NAME
// DOMAIN_NAME
domain
!=
null
?
domain
.
getName
()
:
null
,
domain
!=
null
?
domain
.
getName
()
:
null
,
// COLUMN_DEFAULT
// COLUMN_DEFAULT
...
@@ -1381,7 +1385,7 @@ public class MetaTable extends Table {
...
@@ -1381,7 +1385,7 @@ public class MetaTable extends Table {
// ALIAS_CATALOG
// ALIAS_CATALOG
catalog
,
catalog
,
// ALIAS_SCHEMA
// ALIAS_SCHEMA
Constants
.
SCHEMA_MAIN
,
database
.
getMainSchema
().
getName
()
,
// ALIAS_NAME
// ALIAS_NAME
identifier
(
agg
.
getName
()),
identifier
(
agg
.
getName
()),
// JAVA_CLASS
// JAVA_CLASS
...
@@ -1524,7 +1528,7 @@ public class MetaTable extends Table {
...
@@ -1524,7 +1528,7 @@ public class MetaTable extends Table {
// DEFAULT_COLLATION_NAME
// DEFAULT_COLLATION_NAME
collation
,
collation
,
// IS_DEFAULT
// IS_DEFAULT
ValueBoolean
.
get
(
Constants
.
SCHEMA_MAIN
.
equals
(
schema
.
getName
())
),
ValueBoolean
.
get
(
schema
.
getId
()
==
Constants
.
MAIN_SCHEMA_ID
),
// REMARKS
// REMARKS
replaceNullWithEmpty
(
schema
.
getComment
()),
replaceNullWithEmpty
(
schema
.
getComment
()),
// ID
// ID
...
@@ -1786,7 +1790,7 @@ public class MetaTable extends Table {
...
@@ -1786,7 +1790,7 @@ public class MetaTable extends Table {
// DOMAIN_CATALOG
// DOMAIN_CATALOG
catalog
,
catalog
,
// DOMAIN_SCHEMA
// DOMAIN_SCHEMA
Constants
.
SCHEMA_MAIN
,
database
.
getMainSchema
().
getName
()
,
// DOMAIN_NAME
// DOMAIN_NAME
identifier
(
dt
.
getName
()),
identifier
(
dt
.
getName
()),
// COLUMN_DEFAULT
// COLUMN_DEFAULT
...
...
h2/src/main/org/h2/table/TableView.java
浏览文件 @
bd0bd5d1
...
@@ -16,7 +16,6 @@ import org.h2.command.Prepared;
...
@@ -16,7 +16,6 @@ import org.h2.command.Prepared;
import
org.h2.command.ddl.CreateTableData
;
import
org.h2.command.ddl.CreateTableData
;
import
org.h2.command.dml.AllColumnsForPlan
;
import
org.h2.command.dml.AllColumnsForPlan
;
import
org.h2.command.dml.Query
;
import
org.h2.command.dml.Query
;
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.Session
;
import
org.h2.engine.Session
;
...
@@ -547,7 +546,7 @@ public class TableView extends Table {
...
@@ -547,7 +546,7 @@ public class TableView extends Table {
*/
*/
public
static
TableView
createTempView
(
Session
session
,
User
owner
,
public
static
TableView
createTempView
(
Session
session
,
User
owner
,
String
name
,
Query
query
,
Query
topQuery
)
{
String
name
,
Query
query
,
Query
topQuery
)
{
Schema
mainSchema
=
session
.
getDatabase
().
get
Schema
(
Constants
.
SCHEMA_MAIN
);
Schema
mainSchema
=
session
.
getDatabase
().
get
MainSchema
(
);
String
querySQL
=
query
.
getPlanSQL
();
String
querySQL
=
query
.
getPlanSQL
();
TableView
v
=
new
TableView
(
mainSchema
,
0
,
name
,
TableView
v
=
new
TableView
(
mainSchema
,
0
,
name
,
querySQL
,
query
.
getParameters
(),
null
/* column templates */
,
session
,
querySQL
,
query
.
getParameters
(),
null
/* column templates */
,
session
,
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
bd0bd5d1
...
@@ -71,7 +71,7 @@ public class TestCompatibility extends TestDb {
...
@@ -71,7 +71,7 @@ public class TestCompatibility extends TestDb {
}
}
private
void
testCaseSensitiveIdentifiers
()
throws
SQLException
{
private
void
testCaseSensitiveIdentifiers
()
throws
SQLException
{
Connection
c
=
getConnection
(
"compatibility;DATABASE_TO_UPPER=FALSE"
);
Connection
c
=
getConnection
(
"compatibility;DATABASE_TO_UPPER=FALSE
;CASE_INSENSITIVE_IDENTIFIERS=TRUE
"
);
Statement
stat
=
c
.
createStatement
();
Statement
stat
=
c
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, name varchar) "
+
stat
.
execute
(
"create table test(id int primary key, name varchar) "
+
"as select 1, 'hello'"
);
"as select 1, 'hello'"
);
...
...
h2/src/test/org/h2/test/unit/TestPgServer.java
浏览文件 @
bd0bd5d1
...
@@ -73,7 +73,7 @@ public class TestPgServer extends TestDb {
...
@@ -73,7 +73,7 @@ public class TestPgServer extends TestDb {
}
}
deleteDb
(
"pgserver"
);
deleteDb
(
"pgserver"
);
Connection
conn
=
getConnection
(
Connection
conn
=
getConnection
(
"mem:pgserver;DATABASE_TO_
UPPER=fals
e"
,
"sa"
,
"sa"
);
"mem:pgserver;DATABASE_TO_
LOWER=tru
e"
,
"sa"
,
"sa"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int, name varchar(255))"
);
stat
.
execute
(
"create table test(id int, name varchar(255))"
);
Server
server
=
createPgServer
(
"-baseDir"
,
getBaseDir
(),
Server
server
=
createPgServer
(
"-baseDir"
,
getBaseDir
(),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论