Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
679b07b0
提交
679b07b0
authored
15 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
boolean getX > isX
上级
9cbd604d
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
43 行增加
和
44 行删除
+43
-44
Optimizer.java
h2/src/main/org/h2/command/dml/Optimizer.java
+1
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+6
-6
Constraint.java
h2/src/main/org/h2/constraint/Constraint.java
+1
-1
ConstraintReferential.java
h2/src/main/org/h2/constraint/ConstraintReferential.java
+1
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+9
-10
DbObject.java
h2/src/main/org/h2/engine/DbObject.java
+1
-1
DbObjectBase.java
h2/src/main/org/h2/engine/DbObjectBase.java
+1
-1
Engine.java
h2/src/main/org/h2/engine/Engine.java
+1
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+2
-2
User.java
h2/src/main/org/h2/engine/User.java
+2
-2
ConditionIn.java
h2/src/main/org/h2/expression/ConditionIn.java
+1
-1
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+1
-1
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+2
-2
BtreeLeaf.java
h2/src/main/org/h2/index/BtreeLeaf.java
+1
-1
BtreeNode.java
h2/src/main/org/h2/index/BtreeNode.java
+2
-2
IndexType.java
h2/src/main/org/h2/index/IndexType.java
+5
-5
MultiVersionCursor.java
h2/src/main/org/h2/index/MultiVersionCursor.java
+1
-1
MultiVersionIndex.java
h2/src/main/org/h2/index/MultiVersionIndex.java
+2
-2
ScanCursor.java
h2/src/main/org/h2/index/ScanCursor.java
+1
-1
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+1
-1
TreeIndex.java
h2/src/main/org/h2/index/TreeIndex.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/dml/Optimizer.java
浏览文件 @
679b07b0
...
...
@@ -127,7 +127,7 @@ public class Optimizer {
double
costPart
=
-
1.0
;
int
bestPart
=
-
1
;
for
(
int
j
=
0
;
j
<
filters
.
length
;
j
++)
{
if
(!
filters
[
j
].
get
Used
())
{
if
(!
filters
[
j
].
is
Used
())
{
if
(
i
==
filters
.
length
-
1
)
{
bestPart
=
j
;
break
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
679b07b0
...
...
@@ -239,7 +239,7 @@ public class Select extends Query {
ObjectArray
<
Index
>
indexes
=
topTableFilter
.
getTable
().
getIndexes
();
for
(
int
i
=
0
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
Index
index
=
indexes
.
get
(
i
);
if
(
index
.
getIndexType
().
get
Scan
())
{
if
(
index
.
getIndexType
().
is
Scan
())
{
continue
;
}
if
(
isGroupSortedIndex
(
topTableFilter
,
index
))
{
...
...
@@ -414,7 +414,7 @@ public class Select extends Query {
// can't use the scan index
continue
;
}
if
(
index
.
getIndexType
().
get
Hash
())
{
if
(
index
.
getIndexType
().
is
Hash
())
{
continue
;
}
IndexColumn
[]
indexCols
=
index
.
getIndexColumns
();
...
...
@@ -748,10 +748,10 @@ public class Select extends Query {
boolean
ascending
=
columnIndex
.
getIndexColumns
()[
0
].
sortType
==
SortOrder
.
ASCENDING
;
Index
current
=
topTableFilter
.
getIndex
();
// if another index is faster
if
(
columnIndex
.
canFindNext
()
&&
ascending
&&
(
current
==
null
||
current
.
getIndexType
().
get
Scan
()
||
columnIndex
==
current
))
{
if
(
columnIndex
.
canFindNext
()
&&
ascending
&&
(
current
==
null
||
current
.
getIndexType
().
is
Scan
()
||
columnIndex
==
current
))
{
IndexType
type
=
columnIndex
.
getIndexType
();
// hash indexes don't work, and unique single column indexes don't work
if
(!
type
.
getHash
()
&&
(!
type
.
get
Unique
()
||
columnIndex
.
getColumns
().
length
>
1
))
{
if
(!
type
.
isHash
()
&&
(!
type
.
is
Unique
()
||
columnIndex
.
getColumns
().
length
>
1
))
{
topTableFilter
.
setIndex
(
columnIndex
);
isDistinctQuery
=
true
;
}
...
...
@@ -762,7 +762,7 @@ public class Select extends Query {
if
(
sort
!=
null
&&
!
isQuickAggregateQuery
&&
!
isGroupQuery
)
{
Index
index
=
getSortIndex
();
Index
current
=
topTableFilter
.
getIndex
();
if
(
index
!=
null
&&
(
current
.
getIndexType
().
get
Scan
()
||
current
==
index
))
{
if
(
index
!=
null
&&
(
current
.
getIndexType
().
is
Scan
()
||
current
==
index
))
{
topTableFilter
.
setIndex
(
index
);
if
(!
distinct
||
isDistinctQuery
)
{
// sort using index would not work correctly for distinct result sets
...
...
@@ -774,7 +774,7 @@ public class Select extends Query {
if
(
SysProperties
.
OPTIMIZE_GROUP_SORTED
&&
!
isQuickAggregateQuery
&&
isGroupQuery
&&
getGroupByExpressionCount
()
>
0
)
{
Index
index
=
getGroupSortedIndex
();
Index
current
=
topTableFilter
.
getIndex
();
if
(
index
!=
null
&&
(
current
.
getIndexType
().
get
Scan
()
||
current
==
index
))
{
if
(
index
!=
null
&&
(
current
.
getIndexType
().
is
Scan
()
||
current
==
index
))
{
topTableFilter
.
setIndex
(
index
);
isGroupSortedQuery
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/Constraint.java
浏览文件 @
679b07b0
...
...
@@ -52,7 +52,7 @@ public abstract class Constraint extends SchemaObjectBase implements Comparable<
public
Constraint
(
Schema
schema
,
int
id
,
String
name
,
Table
table
)
{
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
CONSTRAINT
);
this
.
table
=
table
;
this
.
setTemporary
(
table
.
get
Temporary
());
this
.
setTemporary
(
table
.
is
Temporary
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/constraint/ConstraintReferential.java
浏览文件 @
679b07b0
...
...
@@ -207,7 +207,7 @@ public class ConstraintReferential extends Constraint {
public
void
setRefTable
(
Table
refTable
)
{
this
.
refTable
=
refTable
;
if
(
refTable
.
get
Temporary
())
{
if
(
refTable
.
is
Temporary
())
{
setTemporary
(
true
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
679b07b0
...
...
@@ -637,7 +637,7 @@ public class Database implements DataHandler {
if
(
pageStore
!=
null
)
{
headPos
=
pageStore
.
getSystemTableHeadPos
();
}
meta
=
mainSchema
.
createTable
(
"SYS"
,
0
,
cols
,
persistent
,
persistent
,
false
,
headPos
,
systemSession
);
meta
=
mainSchema
.
createTable
(
"SYS"
,
0
,
cols
,
false
,
persistent
,
persistent
,
false
,
headPos
,
systemSession
);
IndexColumn
[]
pkCols
=
IndexColumn
.
wrap
(
new
Column
[]
{
columnId
});
metaIdIndex
=
meta
.
addIndex
(
systemSession
,
"SYS_ID"
,
0
,
pkCols
,
IndexType
.
createPrimaryKey
(
false
,
false
),
Index
.
EMPTY_HEAD
,
null
);
...
...
@@ -709,13 +709,13 @@ public class Database implements DataHandler {
for
(
Table
obj
:
getAllTablesAndViews
())
{
if
(
obj
instanceof
TableView
)
{
TableView
view
=
(
TableView
)
obj
;
if
(
view
.
get
Invalid
())
{
if
(
view
.
is
Invalid
())
{
try
{
view
.
recompile
(
session
);
}
catch
(
SQLException
e
)
{
// ignore
}
if
(!
view
.
get
Invalid
())
{
if
(!
view
.
is
Invalid
())
{
recompileSuccessful
=
true
;
}
}
...
...
@@ -728,7 +728,7 @@ public class Database implements DataHandler {
for
(
Table
obj
:
getAllTablesAndViews
())
{
if
(
obj
instanceof
TableView
)
{
TableView
view
=
(
TableView
)
obj
;
if
(!
view
.
get
Invalid
())
{
if
(!
view
.
is
Invalid
())
{
try
{
view
.
recompile
(
systemSession
);
}
catch
(
SQLException
e
)
{
...
...
@@ -810,7 +810,7 @@ public class Database implements DataHandler {
private
synchronized
void
addMeta
(
Session
session
,
DbObject
obj
)
throws
SQLException
{
int
id
=
obj
.
getId
();
if
(
id
>
0
&&
!
starting
&&
!
obj
.
get
Temporary
())
{
if
(
id
>
0
&&
!
starting
&&
!
obj
.
is
Temporary
())
{
Row
r
=
meta
.
getTemplateRow
();
MetaRecord
rec
=
new
MetaRecord
(
obj
);
rec
.
setRecord
(
r
);
...
...
@@ -918,7 +918,7 @@ public class Database implements DataHandler {
HashMap
<
String
,
DbObject
>
map
=
getMap
(
obj
.
getType
());
if
(
obj
.
getType
()
==
DbObject
.
USER
)
{
User
user
=
(
User
)
obj
;
if
(
user
.
get
Admin
()
&&
systemUser
.
getName
().
equals
(
Constants
.
DBA_NAME
))
{
if
(
user
.
is
Admin
()
&&
systemUser
.
getName
().
equals
(
Constants
.
DBA_NAME
))
{
systemUser
.
rename
(
user
.
getName
());
}
}
...
...
@@ -1304,7 +1304,6 @@ public class Database implements DataHandler {
if
((
i
&
1
)
!=
(
dataFile
?
1
:
0
))
{
i
++;
}
while
(
storageMap
.
get
(
i
)
!=
null
||
objectIds
.
get
(
i
))
{
i
++;
if
((
i
&
1
)
!=
(
dataFile
?
1
:
0
))
{
...
...
@@ -1677,21 +1676,21 @@ public class Database implements DataHandler {
int
type
=
obj
.
getType
();
if
(
type
==
DbObject
.
TABLE_OR_VIEW
)
{
Table
table
=
(
Table
)
obj
;
if
(
table
.
getTemporary
()
&&
!
table
.
get
GlobalTemporary
())
{
if
(
table
.
isTemporary
()
&&
!
table
.
is
GlobalTemporary
())
{
session
.
removeLocalTempTable
(
table
);
return
;
}
}
else
if
(
type
==
DbObject
.
INDEX
)
{
Index
index
=
(
Index
)
obj
;
Table
table
=
index
.
getTable
();
if
(
table
.
getTemporary
()
&&
!
table
.
get
GlobalTemporary
())
{
if
(
table
.
isTemporary
()
&&
!
table
.
is
GlobalTemporary
())
{
session
.
removeLocalTempTableIndex
(
index
);
return
;
}
}
else
if
(
type
==
DbObject
.
CONSTRAINT
)
{
Constraint
constraint
=
(
Constraint
)
obj
;
Table
table
=
constraint
.
getTable
();
if
(
table
.
getTemporary
()
&&
!
table
.
get
GlobalTemporary
())
{
if
(
table
.
isTemporary
()
&&
!
table
.
is
GlobalTemporary
())
{
session
.
removeLocalTempTableConstraint
(
constraint
);
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/DbObject.java
浏览文件 @
679b07b0
...
...
@@ -196,7 +196,7 @@ public interface DbObject {
*
* @return true if is temporary
*/
boolean
get
Temporary
();
boolean
is
Temporary
();
/**
* Tell this object that it is temporary or not.
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/DbObjectBase.java
浏览文件 @
679b07b0
...
...
@@ -155,7 +155,7 @@ public abstract class DbObjectBase implements DbObject {
setModified
();
}
public
boolean
get
Temporary
()
{
public
boolean
is
Temporary
()
{
return
temporary
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
679b07b0
...
...
@@ -83,7 +83,7 @@ public class Engine {
}
}
}
if
(
opened
&&
(
user
==
null
||
!
user
.
get
Admin
()))
{
if
(
opened
&&
(
user
==
null
||
!
user
.
is
Admin
()))
{
// reset - because the user is not an admin, and has no
// right to listen to exceptions
database
.
setEventListener
(
null
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
679b07b0
...
...
@@ -1008,7 +1008,7 @@ public class Session extends SessionWithState {
this
.
undoLogEnabled
=
b
;
}
public
boolean
get
UndoLogEnabled
()
{
public
boolean
is
UndoLogEnabled
()
{
return
undoLogEnabled
;
}
...
...
@@ -1053,7 +1053,7 @@ public class Session extends SessionWithState {
/**
* Remember the result set and close it as soon as the transaction is
* committed (if it needs to be closed). This is done to delete temporary
* files as soon as possible.
* files as soon as possible
, and free object ids of temporary tables
.
*
* @param result the temporary result set
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/User.java
浏览文件 @
679b07b0
...
...
@@ -41,7 +41,7 @@ public class User extends RightOwner {
this
.
admin
=
admin
;
}
public
boolean
get
Admin
()
{
public
boolean
is
Admin
()
{
return
admin
;
}
...
...
@@ -117,7 +117,7 @@ public class User extends RightOwner {
return
;
}
if
(!
isRightGrantedRecursive
(
table
,
rightMask
))
{
if
(
table
.
getTemporary
()
&&
!
table
.
get
GlobalTemporary
())
{
if
(
table
.
isTemporary
()
&&
!
table
.
is
GlobalTemporary
())
{
// the owner has all rights on local temporary tables
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ConditionIn.java
浏览文件 @
679b07b0
...
...
@@ -114,7 +114,7 @@ public class ConditionIn extends Condition {
if
(
areAllValues
(
independent
))
{
if
(
left
instanceof
ExpressionColumn
)
{
Column
column
=
((
ExpressionColumn
)
left
).
getColumn
();
boolean
nullable
=
column
.
get
Nullable
();
boolean
nullable
=
column
.
is
Nullable
();
CompareMode
mode
=
session
.
getDatabase
().
getCompareMode
();
for
(
int
i
=
0
;
i
<
values
.
size
();
i
++)
{
Expression
e
=
values
.
get
(
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
679b07b0
...
...
@@ -229,7 +229,7 @@ public class ExpressionColumn extends Expression {
}
public
int
getNullable
()
{
return
column
.
get
Nullable
()
?
Column
.
NULLABLE
:
Column
.
NOT_NULLABLE
;
return
column
.
is
Nullable
()
?
Column
.
NULLABLE
:
Column
.
NOT_NULLABLE
;
}
public
boolean
isEverything
(
ExpressionVisitor
visitor
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
679b07b0
...
...
@@ -204,7 +204,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
int
index
=
column
.
getColumnId
();
int
mask
=
masks
[
index
];
if
((
mask
&
IndexCondition
.
EQUALITY
)
==
IndexCondition
.
EQUALITY
)
{
if
(
i
==
columns
.
length
-
1
&&
getIndexType
().
get
Unique
())
{
if
(
i
==
columns
.
length
-
1
&&
getIndexType
().
is
Unique
())
{
cost
=
getLookupCost
(
rowCount
)
+
1
;
break
;
}
...
...
@@ -319,7 +319,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
StringBuilder
buff
=
new
StringBuilder
(
"CREATE "
);
buff
.
append
(
indexType
.
getSQL
());
if
(!
indexType
.
get
PrimaryKey
())
{
if
(!
indexType
.
is
PrimaryKey
())
{
buff
.
append
(
' '
).
append
(
quotedName
);
}
buff
.
append
(
" ON "
).
append
(
table
.
getSQL
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BtreeLeaf.java
浏览文件 @
679b07b0
...
...
@@ -60,7 +60,7 @@ public class BtreeLeaf extends BtreePage {
SearchRow
row
=
pageData
.
get
(
i
);
int
comp
=
index
.
compareRows
(
row
,
newRow
);
if
(
comp
==
0
)
{
if
(
index
.
indexType
.
get
Unique
())
{
if
(
index
.
indexType
.
is
Unique
())
{
if
(!
index
.
containsNullAndAllowMultipleNull
(
newRow
))
{
throw
index
.
getDuplicateKeyException
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BtreeNode.java
浏览文件 @
679b07b0
...
...
@@ -78,7 +78,7 @@ public class BtreeNode extends BtreePage {
SearchRow
row
=
getData
(
i
);
int
comp
=
index
.
compareRows
(
row
,
newRow
);
if
(
comp
==
0
)
{
if
(
index
.
indexType
.
get
Unique
())
{
if
(
index
.
indexType
.
is
Unique
())
{
if
(!
index
.
containsNullAndAllowMultipleNull
(
newRow
))
{
throw
index
.
getDuplicateKeyException
();
}
...
...
@@ -187,7 +187,7 @@ public class BtreeNode extends BtreePage {
IntArray
children
=
new
IntArray
();
splitPoint
++;
int
max
=
pageData
.
size
();
if
(
SysProperties
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
get
Deleted
())
{
if
(
SysProperties
.
CHECK
&&
index
.
getDatabase
().
getLogIndexChanges
()
&&
!
is
Deleted
())
{
// page must have been deleted already before calling
// getSplitPoint()
Message
.
throwInternalError
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/IndexType.java
浏览文件 @
679b07b0
...
...
@@ -93,7 +93,7 @@ public class IndexType {
*
* @return true if it is a hash index
*/
public
boolean
get
Hash
()
{
public
boolean
is
Hash
()
{
return
hash
;
}
...
...
@@ -102,7 +102,7 @@ public class IndexType {
*
* @return true if it is persistent
*/
public
boolean
get
Persistent
()
{
public
boolean
is
Persistent
()
{
return
persistent
;
}
...
...
@@ -111,7 +111,7 @@ public class IndexType {
*
* @return true if it references a primary key constraint
*/
public
boolean
get
PrimaryKey
()
{
public
boolean
is
PrimaryKey
()
{
return
primaryKey
;
}
...
...
@@ -120,7 +120,7 @@ public class IndexType {
*
* @return true if it is
*/
public
boolean
get
Unique
()
{
public
boolean
is
Unique
()
{
return
unique
;
}
...
...
@@ -153,7 +153,7 @@ public class IndexType {
*
* @return true if it is
*/
public
boolean
get
Scan
()
{
public
boolean
is
Scan
()
{
return
scan
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/MultiVersionCursor.java
浏览文件 @
679b07b0
...
...
@@ -125,7 +125,7 @@ public class MultiVersionCursor implements Cursor {
}
int
sessionId
=
deltaRow
.
getSessionId
();
boolean
isThisSession
=
sessionId
==
session
.
getId
();
boolean
isDeleted
=
deltaRow
.
get
Deleted
();
boolean
isDeleted
=
deltaRow
.
is
Deleted
();
if
(
isThisSession
&&
isDeleted
)
{
needNewDelta
=
true
;
continue
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/MultiVersionIndex.java
浏览文件 @
679b07b0
...
...
@@ -289,8 +289,8 @@ public class MultiVersionIndex implements Index {
return
base
.
getName
();
}
public
boolean
get
Temporary
()
{
return
base
.
get
Temporary
();
public
boolean
is
Temporary
()
{
return
base
.
is
Temporary
();
}
public
void
rename
(
String
newName
)
throws
SQLException
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/ScanCursor.java
浏览文件 @
679b07b0
...
...
@@ -55,7 +55,7 @@ public class ScanCursor implements Cursor {
continue
;
}
row
=
delta
.
next
();
if
(!
row
.
get
Deleted
()
||
row
.
getSessionId
()
==
session
.
getId
())
{
if
(!
row
.
is
Deleted
()
||
row
.
getSessionId
()
==
session
.
getId
())
{
continue
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
679b07b0
...
...
@@ -50,7 +50,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
sessionRowCount
=
New
.
hashMap
();
}
tableData
=
table
;
if
(!
database
.
isPersistent
()
||
id
<
0
||
!
indexType
.
get
Persistent
())
{
if
(!
database
.
isPersistent
()
||
id
<
0
||
!
indexType
.
is
Persistent
())
{
return
;
}
this
.
storage
=
database
.
getStorage
(
table
,
id
,
true
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/TreeIndex.java
浏览文件 @
679b07b0
...
...
@@ -53,7 +53,7 @@ public class TreeIndex extends BaseIndex {
Row
r
=
n
.
row
;
int
compare
=
compareRows
(
row
,
r
);
if
(
compare
==
0
)
{
if
(
indexType
.
get
Unique
())
{
if
(
indexType
.
is
Unique
())
{
if
(!
containsNullAndAllowMultipleNull
(
row
))
{
throw
getDuplicateKeyException
();
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论