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