Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4354f8a0
提交
4354f8a0
authored
12月 26, 2018
作者:
tledkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
javadoc cleanup
上级
c3afed94
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
173 行增加
和
10 行删除
+173
-10
SequenceOptions.java
h2/src/main/org/h2/command/ddl/SequenceOptions.java
+71
-5
AllColumnsForPlan.java
h2/src/main/org/h2/command/dml/AllColumnsForPlan.java
+11
-1
MergeUsing.java
h2/src/main/org/h2/command/dml/MergeUsing.java
+48
-0
SelectGroups.java
h2/src/main/org/h2/command/dml/SelectGroups.java
+3
-0
Page.java
h2/src/main/org/h2/mvstore/Page.java
+15
-0
SimpleResult.java
h2/src/main/org/h2/result/SimpleResult.java
+9
-1
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+14
-0
AuthenticationInfo.java
h2/src/main/org/h2/security/auth/AuthenticationInfo.java
+2
-2
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+0
-1
没有找到文件。
h2/src/main/org/h2/command/ddl/SequenceOptions.java
浏览文件 @
4354f8a0
...
@@ -39,22 +39,51 @@ public class SequenceOptions {
...
@@ -39,22 +39,51 @@ public class SequenceOptions {
return
null
;
return
null
;
}
}
/**
* Gets start value.
*
* @param session The session to calculate the value.
* @return start value.
*/
public
Long
getStartValue
(
Session
session
)
{
public
Long
getStartValue
(
Session
session
)
{
return
getLong
(
session
,
start
);
return
getLong
(
session
,
start
);
}
}
/**
* Sets start value expression.
*
* @param start START WITH value expression.
*/
public
void
setStartValue
(
Expression
start
)
{
public
void
setStartValue
(
Expression
start
)
{
this
.
start
=
start
;
this
.
start
=
start
;
}
}
/**
* Gets increment value.
*
* @param session The session to calculate the value.
* @return increment value.
*/
public
Long
getIncrement
(
Session
session
)
{
public
Long
getIncrement
(
Session
session
)
{
return
getLong
(
session
,
increment
);
return
getLong
(
session
,
increment
);
}
}
/**
* Sets increment value expression.
*
* @param increment INCREMENT BY value expression.
*/
public
void
setIncrement
(
Expression
increment
)
{
public
void
setIncrement
(
Expression
increment
)
{
this
.
increment
=
increment
;
this
.
increment
=
increment
;
}
}
/**
* Gets max value.
*
* @param sequence the sequence to get default max value.
* @param session The session to calculate the value.
* @return max value when the MAXVALUE expression is set, otherwise returns default max value.
*/
public
Long
getMaxValue
(
Sequence
sequence
,
Session
session
)
{
public
Long
getMaxValue
(
Sequence
sequence
,
Session
session
)
{
if
(
maxValue
==
ValueExpression
.
getNull
()
&&
sequence
!=
null
)
{
if
(
maxValue
==
ValueExpression
.
getNull
()
&&
sequence
!=
null
)
{
return
Sequence
.
getDefaultMaxValue
(
getCurrentStart
(
sequence
,
session
),
return
Sequence
.
getDefaultMaxValue
(
getCurrentStart
(
sequence
,
session
),
...
@@ -63,10 +92,22 @@ public class SequenceOptions {
...
@@ -63,10 +92,22 @@ public class SequenceOptions {
return
getLong
(
session
,
maxValue
);
return
getLong
(
session
,
maxValue
);
}
}
/**
* Sets max value expression.
*
* @param maxValue MAXVALUE expression.
*/
public
void
setMaxValue
(
Expression
maxValue
)
{
public
void
setMaxValue
(
Expression
maxValue
)
{
this
.
maxValue
=
maxValue
;
this
.
maxValue
=
maxValue
;
}
}
/**
* Gets min value.
*
* @param sequence the sequence to get default min value.
* @param session The session to calculate the value.
* @return max value when the MINVALUE expression is set, otherwise returns default min value.
*/
public
Long
getMinValue
(
Sequence
sequence
,
Session
session
)
{
public
Long
getMinValue
(
Sequence
sequence
,
Session
session
)
{
if
(
minValue
==
ValueExpression
.
getNull
()
&&
sequence
!=
null
)
{
if
(
minValue
==
ValueExpression
.
getNull
()
&&
sequence
!=
null
)
{
return
Sequence
.
getDefaultMinValue
(
getCurrentStart
(
sequence
,
session
),
return
Sequence
.
getDefaultMinValue
(
getCurrentStart
(
sequence
,
session
),
...
@@ -75,32 +116,57 @@ public class SequenceOptions {
...
@@ -75,32 +116,57 @@ public class SequenceOptions {
return
getLong
(
session
,
minValue
);
return
getLong
(
session
,
minValue
);
}
}
public
long
getCurrentStart
(
Sequence
sequence
,
Session
session
)
{
/**
return
start
!=
null
?
getStartValue
(
session
)
:
sequence
.
getCurrentValue
()
+
sequence
.
getIncrement
();
* Sets min value expression.
}
*
* @param minValue MINVALUE expression.
*/
public
void
setMinValue
(
Expression
minValue
)
{
public
void
setMinValue
(
Expression
minValue
)
{
this
.
minValue
=
minValue
;
this
.
minValue
=
minValue
;
}
}
/**
* Gets cycle flag.
*
* @return cycle flag value.
*/
public
Boolean
getCycle
()
{
public
Boolean
getCycle
()
{
return
cycle
;
return
cycle
;
}
}
/**
* Sets cycle flag.
*
* @param cycle flag value.
*/
public
void
setCycle
(
Boolean
cycle
)
{
public
void
setCycle
(
Boolean
cycle
)
{
this
.
cycle
=
cycle
;
this
.
cycle
=
cycle
;
}
}
/**
* Gets cache size.
*
* @param session The session to calculate the value.
* @return cache size.
*/
public
Long
getCacheSize
(
Session
session
)
{
public
Long
getCacheSize
(
Session
session
)
{
return
getLong
(
session
,
cacheSize
);
return
getLong
(
session
,
cacheSize
);
}
}
/**
* Sets cache size.
*
* @param cacheSize cache size.
*/
public
void
setCacheSize
(
Expression
cacheSize
)
{
public
void
setCacheSize
(
Expression
cacheSize
)
{
this
.
cacheSize
=
cacheSize
;
this
.
cacheSize
=
cacheSize
;
}
}
protected
boolean
isRangeSet
()
{
boolean
isRangeSet
()
{
return
start
!=
null
||
minValue
!=
null
||
maxValue
!=
null
||
increment
!=
null
;
return
start
!=
null
||
minValue
!=
null
||
maxValue
!=
null
||
increment
!=
null
;
}
}
private
long
getCurrentStart
(
Sequence
sequence
,
Session
session
)
{
return
start
!=
null
?
getStartValue
(
session
)
:
sequence
.
getCurrentValue
()
+
sequence
.
getIncrement
();
}
}
}
h2/src/main/org/h2/command/dml/AllColumnsForPlan.java
浏览文件 @
4354f8a0
...
@@ -26,7 +26,11 @@ public class AllColumnsForPlan {
...
@@ -26,7 +26,11 @@ public class AllColumnsForPlan {
this
.
filters
=
filters
;
this
.
filters
=
filters
;
}
}
/** Called by ExpressionVisitor. */
/**
* Called by ExpressionVisitor.
*
* @param newCol new column to be added.
*/
public
void
add
(
Column
newCol
)
{
public
void
add
(
Column
newCol
)
{
ArrayList
<
Column
>
cols
=
map
.
get
(
newCol
.
getTable
());
ArrayList
<
Column
>
cols
=
map
.
get
(
newCol
.
getTable
());
if
(
cols
==
null
)
{
if
(
cols
==
null
)
{
...
@@ -37,6 +41,12 @@ public class AllColumnsForPlan {
...
@@ -37,6 +41,12 @@ public class AllColumnsForPlan {
cols
.
add
(
newCol
);
cols
.
add
(
newCol
);
}
}
/**
* Used by index to calculate the cost of a scan.
*
* @param table the table.
* @return all table's referenced columns.
*/
public
ArrayList
<
Column
>
get
(
Table
table
)
{
public
ArrayList
<
Column
>
get
(
Table
table
)
{
if
(
map
==
null
)
{
if
(
map
==
null
)
{
map
=
new
HashMap
<>();
map
=
new
HashMap
<>();
...
...
h2/src/main/org/h2/command/dml/MergeUsing.java
浏览文件 @
4354f8a0
...
@@ -36,10 +36,19 @@ import org.h2.value.Value;
...
@@ -36,10 +36,19 @@ import org.h2.value.Value;
*/
*/
public
class
MergeUsing
extends
Prepared
{
public
class
MergeUsing
extends
Prepared
{
/**
* Abstract WHEN command of the MERGE statement.
*/
public
static
abstract
class
When
{
public
static
abstract
class
When
{
/**
* The parent MERGE statement.
*/
final
MergeUsing
mergeUsing
;
final
MergeUsing
mergeUsing
;
/**
* AND condition of the command.
*/
Expression
andCondition
;
Expression
andCondition
;
When
(
MergeUsing
mergeUsing
)
{
When
(
MergeUsing
mergeUsing
)
{
...
@@ -55,12 +64,23 @@ public class MergeUsing extends Prepared {
...
@@ -55,12 +64,23 @@ public class MergeUsing extends Prepared {
this
.
andCondition
=
andCondition
;
this
.
andCondition
=
andCondition
;
}
}
/**
* Reset updated keys if needs.
*/
void
reset
()
{
void
reset
()
{
// Nothing to do
// Nothing to do
}
}
/**
* Merges rows.
*
* @return count of updated rows.
*/
abstract
int
merge
();
abstract
int
merge
();
/**
* Prepares WHEN command.
*/
void
prepare
()
{
void
prepare
()
{
if
(
andCondition
!=
null
)
{
if
(
andCondition
!=
null
)
{
andCondition
.
mapColumns
(
mergeUsing
.
sourceTableFilter
,
2
,
Expression
.
MAP_INITIAL
);
andCondition
.
mapColumns
(
mergeUsing
.
sourceTableFilter
,
2
,
Expression
.
MAP_INITIAL
);
...
@@ -68,8 +88,16 @@ public class MergeUsing extends Prepared {
...
@@ -68,8 +88,16 @@ public class MergeUsing extends Prepared {
}
}
}
}
/**
* Evaluates trigger mask (UPDATE, INSERT, DELETE).
*
* @return the trigger mask.
*/
abstract
int
evaluateTriggerMasks
();
abstract
int
evaluateTriggerMasks
();
/**
* Checks user's INSERT, UPDATE, DELETE permission in appropriate cases.
*/
abstract
void
checkRights
();
abstract
void
checkRights
();
}
}
...
@@ -224,12 +252,27 @@ public class MergeUsing extends Prepared {
...
@@ -224,12 +252,27 @@ public class MergeUsing extends Prepared {
}
}
// Merge fields
// Merge fields
/**
* Target table.
*/
Table
targetTable
;
Table
targetTable
;
/**
* Target table filter.
*/
TableFilter
targetTableFilter
;
TableFilter
targetTableFilter
;
private
Query
query
;
private
Query
query
;
// MergeUsing fields
// MergeUsing fields
/**
* Source table filter.
*/
TableFilter
sourceTableFilter
;
TableFilter
sourceTableFilter
;
/**
* ON condition expression.
*/
Expression
onCondition
;
Expression
onCondition
;
private
ArrayList
<
When
>
when
=
Utils
.
newSmallArrayList
();
private
ArrayList
<
When
>
when
=
Utils
.
newSmallArrayList
();
private
String
queryAlias
;
private
String
queryAlias
;
...
@@ -403,6 +446,11 @@ public class MergeUsing extends Prepared {
...
@@ -403,6 +446,11 @@ public class MergeUsing extends Prepared {
return
when
;
return
when
;
}
}
/**
* Adds WHEN command.
*
* @param w new WHEN command to add (update, delete or insert).
*/
public
void
addWhen
(
When
w
)
{
public
void
addWhen
(
When
w
)
{
when
.
add
(
w
);
when
.
add
(
w
);
}
}
...
...
h2/src/main/org/h2/command/dml/SelectGroups.java
浏览文件 @
4354f8a0
...
@@ -431,6 +431,9 @@ public abstract class SelectGroups {
...
@@ -431,6 +431,9 @@ public abstract class SelectGroups {
}
}
/**
/**
* Gets the query's column list, including invisible expressions
* such as order by expressions.
*
* @return Expressions.
* @return Expressions.
*/
*/
public
ArrayList
<
Expression
>
expressions
()
{
public
ArrayList
<
Expression
>
expressions
()
{
...
...
h2/src/main/org/h2/mvstore/Page.java
浏览文件 @
4354f8a0
...
@@ -414,6 +414,13 @@ public abstract class Page implements Cloneable
...
@@ -414,6 +414,13 @@ public abstract class Page implements Cloneable
return
copy
(
false
);
return
copy
(
false
);
}
}
/**
* Create a copy of this page.
*
* @param countRemoval When {@code true} the current page is removed,
* when {@code false} just copy the page.
* @return a mutable copy of this page
*/
public
final
Page
copy
(
boolean
countRemoval
)
{
public
final
Page
copy
(
boolean
countRemoval
)
{
Page
newPage
=
clone
();
Page
newPage
=
clone
();
newPage
.
pos
=
0
;
newPage
.
pos
=
0
;
...
@@ -795,10 +802,18 @@ public abstract class Page implements Cloneable
...
@@ -795,10 +802,18 @@ public abstract class Page implements Cloneable
return
r
;
return
r
;
}
}
/**
* Increase estimated memory used in persistent case.
*
* @param mem additional memory size.
*/
final
void
addMemory
(
int
mem
)
{
final
void
addMemory
(
int
mem
)
{
memory
+=
mem
;
memory
+=
mem
;
}
}
/**
* Recalculate estimated memory used in persistent case.
*/
final
void
recalculateMemory
()
{
final
void
recalculateMemory
()
{
assert
isPersistent
();
assert
isPersistent
();
memory
=
calculateMemory
();
memory
=
calculateMemory
();
...
...
h2/src/main/org/h2/result/SimpleResult.java
浏览文件 @
4354f8a0
...
@@ -17,18 +17,26 @@ import org.h2.value.Value;
...
@@ -17,18 +17,26 @@ import org.h2.value.Value;
*/
*/
public
class
SimpleResult
implements
ResultInterface
{
public
class
SimpleResult
implements
ResultInterface
{
/**
* Column info for the simple result.
*/
static
final
class
Column
{
static
final
class
Column
{
/** Column alias. */
final
String
alias
;
final
String
alias
;
/** Column name. */
final
String
columnName
;
final
String
columnName
;
/** Column type. */
final
int
columnType
;
final
int
columnType
;
/** Column precision. */
final
long
columnPrecision
;
final
long
columnPrecision
;
/** Column scale. */
final
int
columnScale
;
final
int
columnScale
;
/** Displayed size of the column. */
final
int
displaySize
;
final
int
displaySize
;
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
Column
(
String
alias
,
String
columnName
,
int
columnType
,
long
columnPrecision
,
int
columnScale
,
...
...
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
4354f8a0
...
@@ -148,6 +148,13 @@ public class Sequence extends SchemaObjectBase {
...
@@ -148,6 +148,13 @@ public class Sequence extends SchemaObjectBase {
Math
.
abs
(
increment
)
+
Long
.
MIN_VALUE
<=
maxValue
-
minValue
+
Long
.
MIN_VALUE
;
Math
.
abs
(
increment
)
+
Long
.
MIN_VALUE
<=
maxValue
-
minValue
+
Long
.
MIN_VALUE
;
}
}
/**
* Calculates default min value.
*
* @param startValue the start value of the sequence.
* @param increment the increment of the sequence value.
* @return min value.
*/
public
static
long
getDefaultMinValue
(
Long
startValue
,
long
increment
)
{
public
static
long
getDefaultMinValue
(
Long
startValue
,
long
increment
)
{
long
v
=
increment
>=
0
?
1
:
Long
.
MIN_VALUE
;
long
v
=
increment
>=
0
?
1
:
Long
.
MIN_VALUE
;
if
(
startValue
!=
null
&&
increment
>=
0
&&
startValue
<
v
)
{
if
(
startValue
!=
null
&&
increment
>=
0
&&
startValue
<
v
)
{
...
@@ -156,6 +163,13 @@ public class Sequence extends SchemaObjectBase {
...
@@ -156,6 +163,13 @@ public class Sequence extends SchemaObjectBase {
return
v
;
return
v
;
}
}
/**
* Calculates default max value.
*
* @param startValue the start value of the sequence.
* @param increment the increment of the sequence value.
* @return min value.
*/
public
static
long
getDefaultMaxValue
(
Long
startValue
,
long
increment
)
{
public
static
long
getDefaultMaxValue
(
Long
startValue
,
long
increment
)
{
long
v
=
increment
>=
0
?
Long
.
MAX_VALUE
:
-
1
;
long
v
=
increment
>=
0
?
Long
.
MAX_VALUE
:
-
1
;
if
(
startValue
!=
null
&&
increment
<
0
&&
startValue
>
v
)
{
if
(
startValue
!=
null
&&
increment
<
0
&&
startValue
>
v
)
{
...
...
h2/src/main/org/h2/security/auth/AuthenticationInfo.java
浏览文件 @
4354f8a0
...
@@ -19,7 +19,7 @@ public class AuthenticationInfo {
...
@@ -19,7 +19,7 @@ public class AuthenticationInfo {
private
String
realm
;
private
String
realm
;
/*
/*
*
* Can be used by authenticator to hold information.
* Can be used by authenticator to hold information.
*/
*/
Object
nestedIdentity
;
Object
nestedIdentity
;
...
@@ -58,7 +58,7 @@ public class AuthenticationInfo {
...
@@ -58,7 +58,7 @@ public class AuthenticationInfo {
}
}
/**
/**
* Gets nested identity.
* Gets nested identity
object that can be used by authenticator to hold information
.
*
*
* @return nested identity object.
* @return nested identity object.
*/
*/
...
...
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
4354f8a0
...
@@ -114,7 +114,6 @@ public class CompareMode implements Comparator<Value> {
...
@@ -114,7 +114,6 @@ public class CompareMode implements Comparator<Value> {
*
*
* @param name the collation name or null
* @param name the collation name or null
* @param strength the collation strength
* @param strength the collation strength
* @param binaryUnsigned whether to compare binaries as unsigned
* @param binaryUnsigned whether to compare UUIDs as unsigned
* @param binaryUnsigned whether to compare UUIDs as unsigned
* @return the compare mode
* @return the compare mode
*/
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论