Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
9ec412a8
提交
9ec412a8
authored
7月 30, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The functions LENGTH, OCTET_LENGTH, and BIT_LENGTH now return BIGINT.
上级
a63e3768
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
11 行删除
+11
-11
help.csv
h2/src/docsrc/help/help.csv
+3
-3
Function.java
h2/src/main/org/h2/expression/Function.java
+8
-8
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
9ec412a8
...
...
@@ -2303,7 +2303,7 @@ Returns the ASCII value of the first character in the string.
ASCII('Hi')
"
"Functions (String)","BIT_LENGTH","
BIT_LENGTH(string):
int
BIT_LENGTH(string):
long
","
Returns the number of bits in a string. For BLOB, CLOB, BYTES and JAVA_OBJECT,
the precision is used. Each character needs 16 bits.
...
...
@@ -2312,7 +2312,7 @@ BIT_LENGTH(NAME)
"
"Functions (String)","LENGTH","
{LENGTH | CHAR_LENGTH | CHARACTER_LENGTH}(string):
int
{LENGTH | CHAR_LENGTH | CHARACTER_LENGTH}(string):
long
","
Returns the number of characters in a string. For BLOB, CLOB, BYTES and
JAVA_OBJECT, the precision is used.
...
...
@@ -2321,7 +2321,7 @@ LENGTH(NAME)
"
"Functions (String)","OCTET_LENGTH","
OCTET_LENGTH(string):
int
OCTET_LENGTH(string):
long
","
Returns the number of bytes in a string. For BLOB, CLOB, BYTES and JAVA_OBJECT,
the precision is used. Each character needs 2 bytes.
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
9ec412a8
...
...
@@ -201,7 +201,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionNotDeterministic
(
"SYS_GUID"
,
RANDOM_UUID
,
0
,
Value
.
UUID
);
// string
addFunction
(
"ASCII"
,
ASCII
,
1
,
Value
.
INT
);
addFunction
(
"BIT_LENGTH"
,
BIT_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"BIT_LENGTH"
,
BIT_LENGTH
,
1
,
Value
.
LONG
);
addFunction
(
"CHAR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHR"
,
CHAR
,
1
,
Value
.
STRING
);
addFunction
(
"CHAR_LENGTH"
,
CHAR_LENGTH
,
1
,
Value
.
INT
);
...
...
@@ -213,14 +213,14 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull
(
"INSERT"
,
INSERT
,
4
,
Value
.
STRING
);
addFunction
(
"LCASE"
,
LCASE
,
1
,
Value
.
STRING
);
addFunction
(
"LEFT"
,
LEFT
,
2
,
Value
.
STRING
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"LENGTH"
,
LENGTH
,
1
,
Value
.
LONG
);
// 2 or 3 arguments
addFunction
(
"LOCATE"
,
LOCATE
,
VAR_ARGS
,
Value
.
INT
);
// same as LOCATE with 2 arguments
addFunction
(
"POSITION"
,
LOCATE
,
2
,
Value
.
INT
);
addFunction
(
"INSTR"
,
INSTR
,
VAR_ARGS
,
Value
.
INT
);
addFunction
(
"LTRIM"
,
LTRIM
,
VAR_ARGS
,
Value
.
STRING
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
INT
);
addFunction
(
"OCTET_LENGTH"
,
OCTET_LENGTH
,
1
,
Value
.
LONG
);
addFunction
(
"RAWTOHEX"
,
RAWTOHEX
,
1
,
Value
.
STRING
);
addFunction
(
"REPEAT"
,
REPEAT
,
2
,
Value
.
STRING
);
addFunctionWithNull
(
"REPLACE"
,
REPLACE
,
VAR_ARGS
,
Value
.
STRING
);
...
...
@@ -524,17 +524,17 @@ public class Function extends Expression implements FunctionCall {
break
;
}
case
BIT_LENGTH:
result
=
Value
Int
.
get
(
16
*
length
(
v0
));
result
=
Value
Long
.
get
(
16
*
length
(
v0
));
break
;
case
CHAR:
result
=
ValueString
.
get
(
String
.
valueOf
((
char
)
v0
.
getInt
()));
break
;
case
CHAR_LENGTH:
case
LENGTH:
result
=
Value
Int
.
get
(
length
(
v0
));
result
=
Value
Long
.
get
(
length
(
v0
));
break
;
case
OCTET_LENGTH:
result
=
Value
Int
.
get
(
2
*
length
(
v0
));
result
=
Value
Long
.
get
(
2
*
length
(
v0
));
break
;
case
CONCAT:
{
result
=
ValueNull
.
INSTANCE
;
...
...
@@ -1157,13 +1157,13 @@ public class Function extends Expression implements FunctionCall {
return
database
.
getSchema
(
schemaName
).
getSequence
(
sequenceName
);
}
private
int
length
(
Value
v
)
{
private
long
length
(
Value
v
)
{
switch
(
v
.
getType
())
{
case
Value
.
BLOB
:
case
Value
.
CLOB
:
case
Value
.
BYTES
:
case
Value
.
JAVA_OBJECT
:
return
(
int
)
v
.
getPrecision
();
return
v
.
getPrecision
();
default
:
return
v
.
getString
().
length
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论