Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6e8730ae
提交
6e8730ae
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
boolean getX > isX
上级
d57c80c0
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
28 行增加
和
28 行删除
+28
-28
Column.java
h2/src/main/org/h2/table/Column.java
+3
-3
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+16
-16
Table.java
h2/src/main/org/h2/table/Table.java
+4
-4
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+1
-1
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+2
-2
TableView.java
h2/src/main/org/h2/table/TableView.java
+2
-2
没有找到文件。
h2/src/main/org/h2/table/Column.java
浏览文件 @
6e8730ae
...
@@ -433,7 +433,7 @@ public class Column {
...
@@ -433,7 +433,7 @@ public class Column {
return
buff
.
toString
();
return
buff
.
toString
();
}
}
public
boolean
get
Nullable
()
{
public
boolean
is
Nullable
()
{
return
nullable
;
return
nullable
;
}
}
...
@@ -449,7 +449,7 @@ public class Column {
...
@@ -449,7 +449,7 @@ public class Column {
return
defaultExpression
;
return
defaultExpression
;
}
}
public
boolean
get
AutoIncrement
()
{
public
boolean
is
AutoIncrement
()
{
return
autoIncrement
;
return
autoIncrement
;
}
}
...
@@ -625,7 +625,7 @@ public class Column {
...
@@ -625,7 +625,7 @@ public class Column {
return
true
;
return
true
;
}
}
public
boolean
get
PrimaryKey
()
{
public
boolean
is
PrimaryKey
()
{
return
primaryKey
;
return
primaryKey
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
6e8730ae
...
@@ -623,8 +623,8 @@ public class MetaTable extends Table {
...
@@ -623,8 +623,8 @@ public class MetaTable extends Table {
continue
;
continue
;
}
}
String
storageType
;
String
storageType
;
if
(
table
.
get
Temporary
())
{
if
(
table
.
is
Temporary
())
{
if
(
table
.
get
GlobalTemporary
())
{
if
(
table
.
is
GlobalTemporary
())
{
storageType
=
"GLOBAL TEMPORARY"
;
storageType
=
"GLOBAL TEMPORARY"
;
}
else
{
}
else
{
storageType
=
"LOCAL TEMPORARY"
;
storageType
=
"LOCAL TEMPORARY"
;
...
@@ -680,7 +680,7 @@ public class MetaTable extends Table {
...
@@ -680,7 +680,7 @@ public class MetaTable extends Table {
// COLUMN_DEFAULT
// COLUMN_DEFAULT
c
.
getDefaultSQL
(),
c
.
getDefaultSQL
(),
// IS_NULLABLE
// IS_NULLABLE
c
.
get
Nullable
()
?
"YES"
:
"NO"
,
c
.
is
Nullable
()
?
"YES"
:
"NO"
,
// DATA_TYPE
// DATA_TYPE
""
+
DataType
.
convertTypeToSQLType
(
c
.
getType
()),
""
+
DataType
.
convertTypeToSQLType
(
c
.
getType
()),
// CHARACTER_MAXIMUM_LENGTH
// CHARACTER_MAXIMUM_LENGTH
...
@@ -700,7 +700,7 @@ public class MetaTable extends Table {
...
@@ -700,7 +700,7 @@ public class MetaTable extends Table {
// TYPE_NAME
// TYPE_NAME
identifier
(
DataType
.
getDataType
(
c
.
getType
()).
name
),
identifier
(
DataType
.
getDataType
(
c
.
getType
()).
name
),
// NULLABLE
// NULLABLE
""
+
(
c
.
get
Nullable
()
?
DatabaseMetaData
.
columnNullable
:
DatabaseMetaData
.
columnNoNulls
)
,
""
+
(
c
.
is
Nullable
()
?
DatabaseMetaData
.
columnNullable
:
DatabaseMetaData
.
columnNoNulls
)
,
// IS_COMPUTED
// IS_COMPUTED
""
+
(
c
.
getComputed
()
?
"TRUE"
:
"FALSE"
),
""
+
(
c
.
getComputed
()
?
"TRUE"
:
"FALSE"
),
// SELECTIVITY
// SELECTIVITY
...
@@ -748,7 +748,7 @@ public class MetaTable extends Table {
...
@@ -748,7 +748,7 @@ public class MetaTable extends Table {
// TABLE_NAME
// TABLE_NAME
tableName
,
tableName
,
// NON_UNIQUE
// NON_UNIQUE
index
.
getIndexType
().
get
Unique
()
?
"FALSE"
:
"TRUE"
,
index
.
getIndexType
().
is
Unique
()
?
"FALSE"
:
"TRUE"
,
// INDEX_NAME
// INDEX_NAME
identifier
(
index
.
getName
()),
identifier
(
index
.
getName
()),
// ORDINAL_POSITION
// ORDINAL_POSITION
...
@@ -758,7 +758,7 @@ public class MetaTable extends Table {
...
@@ -758,7 +758,7 @@ public class MetaTable extends Table {
// CARDINALITY
// CARDINALITY
"0"
,
"0"
,
// PRIMARY_KEY
// PRIMARY_KEY
index
.
getIndexType
().
get
PrimaryKey
()
?
"TRUE"
:
"FALSE"
,
index
.
getIndexType
().
is
PrimaryKey
()
?
"TRUE"
:
"FALSE"
,
// INDEX_TYPE_NAME
// INDEX_TYPE_NAME
index
.
getIndexType
().
getSQL
(),
index
.
getIndexType
().
getSQL
(),
// IS_GENERATED
// IS_GENERATED
...
@@ -813,7 +813,7 @@ public class MetaTable extends Table {
...
@@ -813,7 +813,7 @@ public class MetaTable extends Table {
add
(
rows
,
new
String
[]{
"info.VERSION_MAJOR"
,
""
+
Constants
.
VERSION_MAJOR
});
add
(
rows
,
new
String
[]{
"info.VERSION_MAJOR"
,
""
+
Constants
.
VERSION_MAJOR
});
add
(
rows
,
new
String
[]{
"info.VERSION_MINOR"
,
""
+
Constants
.
VERSION_MINOR
});
add
(
rows
,
new
String
[]{
"info.VERSION_MINOR"
,
""
+
Constants
.
VERSION_MINOR
});
add
(
rows
,
new
String
[]{
"info.VERSION"
,
""
+
Constants
.
getFullVersion
()});
add
(
rows
,
new
String
[]{
"info.VERSION"
,
""
+
Constants
.
getFullVersion
()});
if
(
session
.
getUser
().
get
Admin
())
{
if
(
session
.
getUser
().
is
Admin
())
{
String
[]
settings
=
new
String
[]{
String
[]
settings
=
new
String
[]{
"java.runtime.version"
,
"java.runtime.version"
,
"java.vm.name"
,
"java.vendor"
,
"java.vm.name"
,
"java.vendor"
,
...
@@ -864,7 +864,7 @@ public class MetaTable extends Table {
...
@@ -864,7 +864,7 @@ public class MetaTable extends Table {
DiskFile
dataFile
=
database
.
getDataFile
();
DiskFile
dataFile
=
database
.
getDataFile
();
if
(
dataFile
!=
null
)
{
if
(
dataFile
!=
null
)
{
add
(
rows
,
new
String
[]
{
"CACHE_TYPE"
,
dataFile
.
getCache
().
getTypeName
()
});
add
(
rows
,
new
String
[]
{
"CACHE_TYPE"
,
dataFile
.
getCache
().
getTypeName
()
});
if
(
session
.
getUser
().
get
Admin
())
{
if
(
session
.
getUser
().
is
Admin
())
{
DiskFile
indexFile
=
database
.
getIndexFile
();
DiskFile
indexFile
=
database
.
getIndexFile
();
add
(
rows
,
new
String
[]{
"info.FILE_DISK_WRITE"
,
""
+
dataFile
.
getWriteCount
()});
add
(
rows
,
new
String
[]{
"info.FILE_DISK_WRITE"
,
""
+
dataFile
.
getWriteCount
()});
add
(
rows
,
new
String
[]{
"info.FILE_DISK_READ"
,
""
+
dataFile
.
getReadCount
()});
add
(
rows
,
new
String
[]{
"info.FILE_DISK_READ"
,
""
+
dataFile
.
getReadCount
()});
...
@@ -973,7 +973,7 @@ public class MetaTable extends Table {
...
@@ -973,7 +973,7 @@ public class MetaTable extends Table {
// NAME
// NAME
identifier
(
u
.
getName
()),
identifier
(
u
.
getName
()),
// ADMIN
// ADMIN
String
.
valueOf
(
u
.
get
Admin
()),
String
.
valueOf
(
u
.
is
Admin
()),
// REMARKS
// REMARKS
replaceNullWithEmpty
(
u
.
getComment
()),
replaceNullWithEmpty
(
u
.
getComment
()),
// ID
// ID
...
@@ -1239,7 +1239,7 @@ public class MetaTable extends Table {
...
@@ -1239,7 +1239,7 @@ public class MetaTable extends Table {
// IS_UPDATABLE
// IS_UPDATABLE
"NO"
,
"NO"
,
// STATUS
// STATUS
view
.
get
Invalid
()
?
"INVALID"
:
"VALID"
,
view
.
is
Invalid
()
?
"INVALID"
:
"VALID"
,
// REMARKS
// REMARKS
replaceNullWithEmpty
(
view
.
getComment
()),
replaceNullWithEmpty
(
view
.
getComment
()),
// ID
// ID
...
@@ -1412,7 +1412,7 @@ public class MetaTable extends Table {
...
@@ -1412,7 +1412,7 @@ public class MetaTable extends Table {
// COLUMN_DEFAULT
// COLUMN_DEFAULT
col
.
getDefaultSQL
(),
col
.
getDefaultSQL
(),
// IS_NULLABLE
// IS_NULLABLE
col
.
get
Nullable
()
?
"YES"
:
"NO"
,
col
.
is
Nullable
()
?
"YES"
:
"NO"
,
// DATA_TYPE
// DATA_TYPE
""
+
col
.
getDataType
().
sqlType
,
""
+
col
.
getDataType
().
sqlType
,
// PRECISION INT
// PRECISION INT
...
@@ -1455,13 +1455,13 @@ public class MetaTable extends Table {
...
@@ -1455,13 +1455,13 @@ public class MetaTable extends Table {
// TABLE_NAME
// TABLE_NAME
identifier
(
table
.
getName
()),
identifier
(
table
.
getName
()),
// BEFORE BIT
// BEFORE BIT
""
+
trigger
.
get
Before
(),
""
+
trigger
.
is
Before
(),
// JAVA_CLASS
// JAVA_CLASS
trigger
.
getTriggerClassName
(),
trigger
.
getTriggerClassName
(),
// QUEUE_SIZE INT
// QUEUE_SIZE INT
""
+
trigger
.
getQueueSize
(),
""
+
trigger
.
getQueueSize
(),
// NO_WAIT BIT
// NO_WAIT BIT
""
+
trigger
.
get
NoWait
(),
""
+
trigger
.
is
NoWait
(),
// REMARKS
// REMARKS
replaceNullWithEmpty
(
trigger
.
getComment
()),
replaceNullWithEmpty
(
trigger
.
getComment
()),
// SQL
// SQL
...
@@ -1473,7 +1473,7 @@ public class MetaTable extends Table {
...
@@ -1473,7 +1473,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
SESSIONS:
{
case
SESSIONS:
{
boolean
admin
=
session
.
getUser
().
get
Admin
();
boolean
admin
=
session
.
getUser
().
is
Admin
();
for
(
Session
s
:
database
.
getSessions
(
false
))
{
for
(
Session
s
:
database
.
getSessions
(
false
))
{
if
(
admin
||
s
==
session
)
{
if
(
admin
||
s
==
session
)
{
Command
command
=
s
.
getCurrentCommand
();
Command
command
=
s
.
getCurrentCommand
();
...
@@ -1494,7 +1494,7 @@ public class MetaTable extends Table {
...
@@ -1494,7 +1494,7 @@ public class MetaTable extends Table {
break
;
break
;
}
}
case
LOCKS:
{
case
LOCKS:
{
boolean
admin
=
session
.
getUser
().
get
Admin
();
boolean
admin
=
session
.
getUser
().
is
Admin
();
for
(
Session
s
:
database
.
getSessions
(
false
))
{
for
(
Session
s
:
database
.
getSessions
(
false
))
{
if
(
admin
||
s
==
session
)
{
if
(
admin
||
s
==
session
)
{
for
(
Table
table
:
s
.
getLocks
())
{
for
(
Table
table
:
s
.
getLocks
())
{
...
@@ -1618,7 +1618,7 @@ public class MetaTable extends Table {
...
@@ -1618,7 +1618,7 @@ public class MetaTable extends Table {
String
isGrantable
=
"NO"
;
String
isGrantable
=
"NO"
;
if
(
grantee
.
getType
()
==
DbObject
.
USER
)
{
if
(
grantee
.
getType
()
==
DbObject
.
USER
)
{
User
user
=
(
User
)
grantee
;
User
user
=
(
User
)
grantee
;
if
(
user
.
get
Admin
())
{
if
(
user
.
is
Admin
())
{
// the right is grantable if the grantee is an admin
// the right is grantable if the grantee is an admin
isGrantable
=
"YES"
;
isGrantable
=
"YES"
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
6e8730ae
...
@@ -417,7 +417,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -417,7 +417,7 @@ public abstract class Table extends SchemaObjectBase {
while
(
sequences
!=
null
&&
sequences
.
size
()
>
0
)
{
while
(
sequences
!=
null
&&
sequences
.
size
()
>
0
)
{
Sequence
sequence
=
sequences
.
get
(
0
);
Sequence
sequence
=
sequences
.
get
(
0
);
sequences
.
remove
(
0
);
sequences
.
remove
(
0
);
if
(!
get
Temporary
())
{
if
(!
is
Temporary
())
{
// only remove if no other table depends on this sequence
// only remove if no other table depends on this sequence
// this is possible when calling ALTER TABLE ALTER COLUMN
// this is possible when calling ALTER TABLE ALTER COLUMN
if
(
database
.
getDependentTable
(
sequence
,
this
)
==
null
)
{
if
(
database
.
getDependentTable
(
sequence
,
this
)
==
null
)
{
...
@@ -550,7 +550,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -550,7 +550,7 @@ public abstract class Table extends SchemaObjectBase {
ObjectArray
<
Index
>
indexes
=
getIndexes
();
ObjectArray
<
Index
>
indexes
=
getIndexes
();
for
(
int
i
=
0
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
for
(
int
i
=
0
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
Index
idx
=
indexes
.
get
(
i
);
Index
idx
=
indexes
.
get
(
i
);
if
(
idx
.
getIndexType
().
get
PrimaryKey
())
{
if
(
idx
.
getIndexType
().
is
PrimaryKey
())
{
return
idx
;
return
idx
;
}
}
}
}
...
@@ -608,7 +608,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -608,7 +608,7 @@ public abstract class Table extends SchemaObjectBase {
ObjectArray
<
Index
>
indexes
=
getIndexes
();
ObjectArray
<
Index
>
indexes
=
getIndexes
();
if
(
indexes
!=
null
)
{
if
(
indexes
!=
null
)
{
remove
(
indexes
,
index
);
remove
(
indexes
,
index
);
if
(
index
.
getIndexType
().
get
PrimaryKey
())
{
if
(
index
.
getIndexType
().
is
PrimaryKey
())
{
for
(
Column
col
:
index
.
getColumns
())
{
for
(
Column
col
:
index
.
getColumns
())
{
col
.
setPrimaryKey
(
false
);
col
.
setPrimaryKey
(
false
);
}
}
...
@@ -784,7 +784,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -784,7 +784,7 @@ public abstract class Table extends SchemaObjectBase {
}
}
}
}
public
boolean
get
GlobalTemporary
()
{
public
boolean
is
GlobalTemporary
()
{
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
6e8730ae
...
@@ -583,7 +583,7 @@ public class TableFilter implements ColumnResolver {
...
@@ -583,7 +583,7 @@ public class TableFilter implements ColumnResolver {
this
.
used
=
used
;
this
.
used
=
used
;
}
}
public
boolean
get
Used
()
{
public
boolean
is
Used
()
{
return
used
;
return
used
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
6e8730ae
...
@@ -297,7 +297,7 @@ public class TableLink extends Table {
...
@@ -297,7 +297,7 @@ public class TableLink extends Table {
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
StringBuilder
buff
=
new
StringBuilder
(
"CREATE FORCE "
);
StringBuilder
buff
=
new
StringBuilder
(
"CREATE FORCE "
);
if
(
get
Temporary
())
{
if
(
is
Temporary
())
{
if
(
globalTemporary
)
{
if
(
globalTemporary
)
{
buff
.
append
(
"GLOBAL "
);
buff
.
append
(
"GLOBAL "
);
}
}
...
@@ -480,7 +480,7 @@ public class TableLink extends Table {
...
@@ -480,7 +480,7 @@ public class TableLink extends Table {
public
Index
getUniqueIndex
()
{
public
Index
getUniqueIndex
()
{
for
(
Index
idx
:
indexes
)
{
for
(
Index
idx
:
indexes
)
{
if
(
idx
.
getIndexType
().
get
Unique
())
{
if
(
idx
.
getIndexType
().
is
Unique
())
{
return
idx
;
return
idx
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableView.java
浏览文件 @
6e8730ae
...
@@ -133,7 +133,7 @@ public class TableView extends Table {
...
@@ -133,7 +133,7 @@ public class TableView extends Table {
*
*
* @return true if it is
* @return true if it is
*/
*/
public
boolean
get
Invalid
()
{
public
boolean
is
Invalid
()
{
return
createException
!=
null
;
return
createException
!=
null
;
}
}
...
@@ -246,7 +246,7 @@ public class TableView extends Table {
...
@@ -246,7 +246,7 @@ public class TableView extends Table {
}
}
public
String
getSQL
()
{
public
String
getSQL
()
{
if
(
get
Temporary
())
{
if
(
is
Temporary
())
{
return
"("
+
querySQL
+
")"
;
return
"("
+
querySQL
+
")"
;
}
}
return
super
.
getSQL
();
return
super
.
getSQL
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论