Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c8fec1e6
提交
c8fec1e6
authored
6月 18, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Issue 479: Support for SUBSTRING without a FROM condition, patch from Andrew Franklin
上级
987315a9
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
24 行增加
和
6 行删除
+24
-6
help.csv
h2/src/docsrc/help/help.csv
+1
-1
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+19
-5
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+3
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
c8fec1e6
...
...
@@ -3155,7 +3155,7 @@ CALL UTF8TOSTRING(STRINGTOUTF8('This is a test'))
Returns a substring of a string starting at a position.
If the start index is negative, then the start index is relative to the end of the string.
The length is optional.
Also supported is: ""SUBSTRING(string
FROM start
[FOR length])"".
Also supported is: ""SUBSTRING(string
[FROM start]
[FOR length])"".
","
CALL SUBSTR('[Hello]', 2, 5);
CALL SUBSTR('Hello World', -5);
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
c8fec1e6
...
...
@@ -39,6 +39,7 @@ Change Log
</li><li>
Issue 473: PgServer missing -key option, patch from Andrew Franklin
</li><li>
Issue 471: CREATE VIEW does not check user rights, patch from Andrew Franklin
</li><li>
Issue 477: PgServer binary transmission of query params is unimplemented, patch from Andrew Franklin
</li><li>
Issue 479: Support for SUBSTRING without a FROM condition, patch from Andrew Franklin
</li></ul>
<h2>
Version 1.3.172 (2013-05-25)
</h2>
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
c8fec1e6
...
...
@@ -2243,14 +2243,28 @@ public class Parser {
break
;
}
case
Function
.
SUBSTRING
:
{
// Different variants include:
// SUBSTRING(X,1)
// SUBSTRING(X,1,1)
// SUBSTRING(X FROM 1 FOR 1) -- Postgres
// SUBSTRING(X FROM 1) -- Postgres
// SUBSTRING(X FOR 1) -- Postgres
function
.
setParameter
(
0
,
readExpression
());
if
(!
readIf
(
","
))
{
read
(
"FROM"
);
if
(
readIf
(
"FROM"
))
{
function
.
setParameter
(
1
,
readExpression
());
if
(
readIf
(
"FOR"
))
{
function
.
setParameter
(
2
,
readExpression
());
}
}
else
if
(
readIf
(
"FOR"
))
{
function
.
setParameter
(
1
,
ValueExpression
.
get
(
ValueInt
.
get
(
0
)));
function
.
setParameter
(
2
,
readExpression
());
}
else
{
read
(
","
);
function
.
setParameter
(
1
,
readExpression
());
if
(
readIf
(
"FOR"
)
||
readIf
(
","
))
{
if
(
readIf
(
","
))
{
function
.
setParameter
(
2
,
readExpression
());
}
}
read
(
")"
);
break
;
}
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
c8fec1e6
...
...
@@ -214,6 +214,9 @@ public class TestCompatibility extends TestBase {
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"SET MODE PostgreSQL"
);
testLog
(
Math
.
log10
(
10
),
stat
);
assertResult
(
"ABC"
,
stat
,
"SELECT SUBSTRING('ABCDEF' FOR 3)"
);
assertResult
(
"BCDE"
,
stat
,
"SELECT SUBSTRING('ABCDEF' FROM 2 FOR 4)"
);
}
private
void
testMySQL
()
throws
SQLException
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论