Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
88f5caea
提交
88f5caea
authored
8月 22, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
d103edc1
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
22 行增加
和
14 行删除
+22
-14
changelog.html
h2/src/docsrc/html/changelog.html
+2
-1
ExpressionColumn.java
h2/src/main/org/h2/expression/ExpressionColumn.java
+6
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+12
-12
testSimple.in.txt
h2/src/test/org/h2/test/testSimple.in.txt
+2
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
88f5caea
...
@@ -16,7 +16,8 @@ Change Log
...
@@ -16,7 +16,8 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The build target 'build jarSmall' now includes the embedded database.
<ul><li>
The H2 Console replaced an empty user name with a single space.
</li><li>
The build target 'build jarSmall' now includes the embedded database.
</li><li>
JdbcDataSource now keeps the password in a char array where possible.
</li><li>
JdbcDataSource now keeps the password in a char array where possible.
</li><li>
ResultSet.absolute did not always work with large result sets.
</li><li>
ResultSet.absolute did not always work with large result sets.
</li><li>
Column aliases can now be used in GROUP BY and HAVING.
</li><li>
Column aliases can now be used in GROUP BY and HAVING.
...
...
h2/src/main/org/h2/expression/ExpressionColumn.java
浏览文件 @
88f5caea
...
@@ -11,6 +11,7 @@ import java.util.HashMap;
...
@@ -11,6 +11,7 @@ import java.util.HashMap;
import
org.h2.command.Parser
;
import
org.h2.command.Parser
;
import
org.h2.command.dml.Select
;
import
org.h2.command.dml.Select
;
import
org.h2.command.dml.SelectListColumnResolver
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
...
@@ -101,7 +102,11 @@ public class ExpressionColumn extends Expression {
...
@@ -101,7 +102,11 @@ public class ExpressionColumn extends Expression {
column
=
col
;
column
=
col
;
this
.
resolver
=
resolver
;
this
.
resolver
=
resolver
;
}
else
if
(
queryLevel
==
level
&&
this
.
resolver
!=
resolver
)
{
}
else
if
(
queryLevel
==
level
&&
this
.
resolver
!=
resolver
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
AMBIGUOUS_COLUMN_NAME_1
,
columnName
);
if
(
resolver
instanceof
SelectListColumnResolver
)
{
// ignore - already mapped, that's ok
}
else
{
throw
Message
.
getSQLException
(
ErrorCode
.
AMBIGUOUS_COLUMN_NAME_1
,
columnName
);
}
}
}
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
88f5caea
...
@@ -107,7 +107,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -107,7 +107,7 @@ public class Function extends Expression implements FunctionCall {
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
protected
Expression
[]
args
;
protected
Expression
[]
args
;
private
FunctionInfo
info
;
private
FunctionInfo
info
;
private
ObjectArray
varArgs
;
private
ObjectArray
varArgs
;
private
int
dataType
,
scale
;
private
int
dataType
,
scale
;
...
@@ -192,7 +192,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -192,7 +192,7 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"CHR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
// same as CHAR_LENGTH
// same as CHAR_LENGTH
addFunction
(
"CHARACTER_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"CHARACTER_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
addFunctionWithNull
(
"CONCAT"
,
CONCAT
,
VAR_ARGS
,
Value
.
STRING
);
addFunctionWithNull
(
"CONCAT"
,
CONCAT
,
VAR_ARGS
,
Value
.
STRING
);
addFunction
(
"DIFFERENCE"
,
DIFFERENCE
,
2
,
Value
.
INT
);
addFunction
(
"DIFFERENCE"
,
DIFFERENCE
,
2
,
Value
.
INT
);
addFunction
(
"HEXTORAW"
,
HEXTORAW
,
1
,
Value
.
STRING
);
addFunction
(
"HEXTORAW"
,
HEXTORAW
,
1
,
Value
.
STRING
);
...
@@ -201,9 +201,9 @@ public class Function extends Expression implements FunctionCall {
...
@@ -201,9 +201,9 @@ public class Function extends Expression implements FunctionCall {
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
INT
);
// 2 or 3 arguments
// 2 or 3 arguments
addFunction
(
"LOCATE"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
addFunction
(
"LOCATE"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
// same as LOCATE with 2 arguments
// same as LOCATE with 2 arguments
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
addFunction
(
"INSTR"
,
INSTR
,
VAR_ARGS
,
Value
.
INT
);
addFunction
(
"INSTR"
,
INSTR
,
VAR_ARGS
,
Value
.
INT
);
addFunction
(
"LTRIM"
,
LTRIM
,
VAR_ARGS
,
Value
.
STRING
);
addFunction
(
"LTRIM"
,
LTRIM
,
VAR_ARGS
,
Value
.
STRING
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
...
@@ -301,7 +301,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -301,7 +301,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull
(
"TABLE"
,
TABLE
,
VAR_ARGS
,
Value
.
RESULT_SET
);
addFunctionWithNull
(
"TABLE"
,
TABLE
,
VAR_ARGS
,
Value
.
RESULT_SET
);
addFunctionWithNull
(
"TABLE_DISTINCT"
,
TABLE_DISTINCT
,
VAR_ARGS
,
Value
.
RESULT_SET
);
addFunctionWithNull
(
"TABLE_DISTINCT"
,
TABLE_DISTINCT
,
VAR_ARGS
,
Value
.
RESULT_SET
);
}
}
protected
Function
(
Database
database
,
FunctionInfo
info
)
{
protected
Function
(
Database
database
,
FunctionInfo
info
)
{
this
.
database
=
database
;
this
.
database
=
database
;
this
.
info
=
info
;
this
.
info
=
info
;
...
@@ -339,7 +339,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -339,7 +339,7 @@ public class Function extends Expression implements FunctionCall {
/**
/**
* Get the function info object for this function, or null if there is no
* Get the function info object for this function, or null if there is no
* such function.
* such function.
*
*
* @param name the function name
* @param name the function name
* @return the function info
* @return the function info
*/
*/
...
@@ -350,7 +350,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -350,7 +350,7 @@ public class Function extends Expression implements FunctionCall {
/**
/**
* Get an instance of the given function for this database.
* Get an instance of the given function for this database.
* If no function with this name is found, null is returned.
* If no function with this name is found, null is returned.
*
*
* @param database the database
* @param database the database
* @param name the function name
* @param name the function name
* @return the function object or null
* @return the function object or null
...
@@ -371,7 +371,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -371,7 +371,7 @@ public class Function extends Expression implements FunctionCall {
/**
/**
* Set the parameter expression at the given index.
* Set the parameter expression at the given index.
*
*
* @param index the index (0, 1,...)
* @param index the index (0, 1,...)
* @param param the expression
* @param param the expression
*/
*/
...
@@ -1453,7 +1453,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1453,7 +1453,7 @@ public class Function extends Expression implements FunctionCall {
/**
/**
* Check if the parameter count is correct.
* Check if the parameter count is correct.
*
*
* @param len the number of parameters set
* @param len the number of parameters set
* @throws SQLException if the parameter count is incorrect
* @throws SQLException if the parameter count is incorrect
*/
*/
...
@@ -1542,7 +1542,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1542,7 +1542,7 @@ public class Function extends Expression implements FunctionCall {
/**
/**
* Set the result data type of this function.
* Set the result data type of this function.
*
*
* @param dataType the data type
* @param dataType the data type
* @param precision the precision
* @param precision the precision
* @param scale the scale
* @param scale the scale
...
@@ -1653,7 +1653,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1653,7 +1653,7 @@ public class Function extends Expression implements FunctionCall {
case
SUBSTR:
{
case
SUBSTR:
{
precision
=
args
[
0
].
getPrecision
();
precision
=
args
[
0
].
getPrecision
();
if
(
args
[
1
].
isConstant
())
{
if
(
args
[
1
].
isConstant
())
{
// if only two arguments are used,
// if only two arguments are used,
// subtract offset from first argument length
// subtract offset from first argument length
precision
-=
args
[
1
].
getValue
(
session
).
getLong
()
-
1
;
precision
-=
args
[
1
].
getValue
(
session
).
getLong
()
-
1
;
}
}
...
@@ -1758,7 +1758,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1758,7 +1758,7 @@ public class Function extends Expression implements FunctionCall {
case
DAYNAME:
case
DAYNAME:
case
MONTHNAME:
case
MONTHNAME:
// day and month names may be long in some languages
// day and month names may be long in some languages
precision
=
20
;
precision
=
20
;
displaySize
=
(
int
)
precision
;
displaySize
=
(
int
)
precision
;
break
;
break
;
default
:
default
:
...
...
h2/src/test/org/h2/test/testSimple.in.txt
浏览文件 @
88f5caea
SELECT X FROM dual GROUP BY X HAVING X=AVG(X);
> 1;
create view test_view(id,) as select * from dual;
create view test_view(id,) as select * from dual;
drop view test_view;
drop view test_view;
create table test(id int,);
create table test(id int,);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论