Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c70f75bd
提交
c70f75bd
authored
5月 19, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support BOOL_OR and BOOL_AND
上级
c11b7c64
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
49 行增加
和
14 行删除
+49
-14
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+45
-10
AggregateData.java
h2/src/main/org/h2/expression/AggregateData.java
+4
-4
没有找到文件。
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
c70f75bd
...
@@ -97,8 +97,20 @@ public class Aggregate extends Expression {
...
@@ -97,8 +97,20 @@ public class Aggregate extends Expression {
* The aggregate type for VAR_SAMP(expression).
* The aggregate type for VAR_SAMP(expression).
*/
*/
public
static
final
int
VAR_SAMP
=
10
;
public
static
final
int
VAR_SAMP
=
10
;
public
static
final
int
SOME
=
11
;
public
static
final
int
EVERY
=
12
;
/**
* The aggregate type for BOOL_OR(expression).
*/
public
static
final
int
BOOL_OR
=
11
;
/**
* The aggregate type for BOOL_AND(expression).
*/
public
static
final
int
BOOL_AND
=
12
;
/**
* The aggregate type for SELECTIVITY(expression).
*/
public
static
final
int
SELECTIVITY
=
13
;
public
static
final
int
SELECTIVITY
=
13
;
private
final
Database
database
;
private
final
Database
database
;
...
@@ -116,6 +128,15 @@ public class Aggregate extends Expression {
...
@@ -116,6 +128,15 @@ public class Aggregate extends Expression {
private
static
final
HashMap
AGGREGATES
=
new
HashMap
();
private
static
final
HashMap
AGGREGATES
=
new
HashMap
();
/**
* Create a new aggregate object.
*
* @param database the database
* @param type the aggregate type
* @param on the aggregated expression
* @param select the select statement
* @param distinct if distinct is used
*/
public
Aggregate
(
Database
database
,
int
type
,
Expression
on
,
Select
select
,
boolean
distinct
)
{
public
Aggregate
(
Database
database
,
int
type
,
Expression
on
,
Select
select
,
boolean
distinct
)
{
this
.
database
=
database
;
this
.
database
=
database
;
this
.
type
=
type
;
this
.
type
=
type
;
...
@@ -140,8 +161,12 @@ public class Aggregate extends Expression {
...
@@ -140,8 +161,12 @@ public class Aggregate extends Expression {
addAggregate
(
"VAR_SAMP"
,
VAR_SAMP
);
addAggregate
(
"VAR_SAMP"
,
VAR_SAMP
);
addAggregate
(
"VAR"
,
VAR_SAMP
);
addAggregate
(
"VAR"
,
VAR_SAMP
);
addAggregate
(
"VARIANCE"
,
VAR_SAMP
);
addAggregate
(
"VARIANCE"
,
VAR_SAMP
);
addAggregate
(
"SOME"
,
SOME
);
addAggregate
(
"BOOL_OR"
,
BOOL_OR
);
addAggregate
(
"EVERY"
,
EVERY
);
// HSQLDB compatibility, but conflicts with >EVERY(...)
addAggregate
(
"SOME"
,
BOOL_OR
);
addAggregate
(
"BOOL_AND"
,
BOOL_AND
);
// HSQLDB compatibility, but conflicts with >SOME(...)
addAggregate
(
"EVERY"
,
BOOL_AND
);
addAggregate
(
"SELECTIVITY"
,
SELECTIVITY
);
addAggregate
(
"SELECTIVITY"
,
SELECTIVITY
);
}
}
...
@@ -161,10 +186,20 @@ public class Aggregate extends Expression {
...
@@ -161,10 +186,20 @@ public class Aggregate extends Expression {
return
type
==
null
?
-
1
:
type
.
intValue
();
return
type
==
null
?
-
1
:
type
.
intValue
();
}
}
/**
* Set the order for GROUP_CONCAT.
*
* @param orderBy the order by list
*/
public
void
setOrder
(
ObjectArray
orderBy
)
{
public
void
setOrder
(
ObjectArray
orderBy
)
{
this
.
orderList
=
orderBy
;
this
.
orderList
=
orderBy
;
}
}
/**
* Set the separator for GROUP_CONCAT.
*
* @param separator the separator expression
*/
public
void
setSeparator
(
Expression
separator
)
{
public
void
setSeparator
(
Expression
separator
)
{
this
.
separator
=
separator
;
this
.
separator
=
separator
;
}
}
...
@@ -371,8 +406,8 @@ public class Aggregate extends Expression {
...
@@ -371,8 +406,8 @@ public class Aggregate extends Expression {
displaySize
=
ValueDouble
.
DISPLAY_SIZE
;
displaySize
=
ValueDouble
.
DISPLAY_SIZE
;
scale
=
0
;
scale
=
0
;
break
;
break
;
case
EVERY
:
case
BOOL_AND
:
case
SOME
:
case
BOOL_OR
:
dataType
=
Value
.
BOOLEAN
;
dataType
=
Value
.
BOOLEAN
;
precision
=
ValueBoolean
.
PRECISION
;
precision
=
ValueBoolean
.
PRECISION
;
displaySize
=
ValueBoolean
.
DISPLAY_SIZE
;
displaySize
=
ValueBoolean
.
DISPLAY_SIZE
;
...
@@ -470,11 +505,11 @@ public class Aggregate extends Expression {
...
@@ -470,11 +505,11 @@ public class Aggregate extends Expression {
case
VAR_SAMP:
case
VAR_SAMP:
text
=
"VAR_SAMP"
;
text
=
"VAR_SAMP"
;
break
;
break
;
case
EVERY
:
case
BOOL_AND
:
text
=
"
EVERY
"
;
text
=
"
BOOL_AND
"
;
break
;
break
;
case
SOME
:
case
BOOL_OR
:
text
=
"
SOME
"
;
text
=
"
BOOL_OR
"
;
break
;
break
;
default
:
default
:
throw
Message
.
getInternalError
(
"type="
+
type
);
throw
Message
.
getInternalError
(
"type="
+
type
);
...
...
h2/src/main/org/h2/expression/AggregateData.java
浏览文件 @
c70f75bd
...
@@ -108,7 +108,7 @@ public class AggregateData {
...
@@ -108,7 +108,7 @@ public class AggregateData {
}
}
break
;
break
;
}
}
case
Aggregate
.
EVERY
:
case
Aggregate
.
BOOL_AND
:
v
=
v
.
convertTo
(
Value
.
BOOLEAN
);
v
=
v
.
convertTo
(
Value
.
BOOLEAN
);
if
(
value
==
null
)
{
if
(
value
==
null
)
{
value
=
v
;
value
=
v
;
...
@@ -116,7 +116,7 @@ public class AggregateData {
...
@@ -116,7 +116,7 @@ public class AggregateData {
value
=
ValueBoolean
.
get
(
value
.
getBoolean
().
booleanValue
()
&&
v
.
getBoolean
().
booleanValue
());
value
=
ValueBoolean
.
get
(
value
.
getBoolean
().
booleanValue
()
&&
v
.
getBoolean
().
booleanValue
());
}
}
break
;
break
;
case
Aggregate
.
SOME
:
case
Aggregate
.
BOOL_OR
:
v
=
v
.
convertTo
(
Value
.
BOOLEAN
);
v
=
v
.
convertTo
(
Value
.
BOOLEAN
);
if
(
value
==
null
)
{
if
(
value
==
null
)
{
value
=
v
;
value
=
v
;
...
@@ -160,8 +160,8 @@ public class AggregateData {
...
@@ -160,8 +160,8 @@ public class AggregateData {
case
Aggregate
.
SUM
:
case
Aggregate
.
SUM
:
case
Aggregate
.
MIN
:
case
Aggregate
.
MIN
:
case
Aggregate
.
MAX
:
case
Aggregate
.
MAX
:
case
Aggregate
.
SOME
:
case
Aggregate
.
BOOL_OR
:
case
Aggregate
.
EVERY
:
case
Aggregate
.
BOOL_AND
:
v
=
value
;
v
=
value
;
break
;
break
;
case
Aggregate
.
AVG
:
case
Aggregate
.
AVG
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论