Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
cb8d121f
提交
cb8d121f
authored
5月 24, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CURRENT_TIMESTAMP() and so on now return the same value within a transaction.
上级
d5418c20
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
36 行增加
和
12 行删除
+36
-12
help.csv
h2/src/docsrc/help/help.csv
+3
-0
changelog.html
h2/src/docsrc/html/changelog.html
+6
-5
Session.java
h2/src/main/org/h2/engine/Session.java
+9
-0
Function.java
h2/src/main/org/h2/expression/Function.java
+10
-5
help.csv
h2/src/main/org/h2/res/help.csv
+6
-2
testSimple.in.txt
h2/src/test/org/h2/test/testSimple.in.txt
+2
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
cb8d121f
...
...
@@ -3109,6 +3109,7 @@ CALL XMLTEXT('test')
{ CURRENT_DATE [ () ] | CURDATE() | SYSDATE | TODAY }
","
Returns the current date.
This method always returns the same value within a transaction.
","
CURRENT_DATE()
"
...
...
@@ -3117,6 +3118,7 @@ CURRENT_DATE()
{ CURRENT_TIME [ () ] | CURTIME() }
","
Returns the current time.
This method always returns the same value within a transaction.
","
CURRENT_TIME()
"
...
...
@@ -3126,6 +3128,7 @@ CURRENT_TIME()
","
Returns the current timestamp.
The precision parameter for nanoseconds precision is optional.
This method always returns the same value within a transaction.
","
CURRENT_TIMESTAMP()
"
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
cb8d121f
...
...
@@ -17,7 +17,8 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The statement CALL no longer converts an ARRAY return value to a list of values.
<ul><li>
CURRENT_TIMESTAMP() and so on now return the same value within a transaction.
</li><li>
The statement CALL no longer converts an ARRAY return value to a list of values.
Now an ARRAY is returned.
</li><li>
VALUES is now supported as a standalone command and as a table source:
SELECT * FROM (VALUES(1, 'Hello'), (2, 'World')) AS V;
...
...
@@ -25,7 +26,7 @@ Change Log
Most SQL_TSI_ constants are now supported for for TIMESTAMPADD and TIMESTAMPDIFF
(all except SQL_TSI_QUARTER and SQL_TSI_FRAC_SECOND).
</li><li>
Issue 313: NullPointerException in select query with a subquery or view.
</li><li>
Native fulltext search: the characters '
<
',
'
>
', and '\' are now also whitespace
</li><li>
Native fulltext search: the characters '
<
', '
>
', and '\' are now also whitespace
characters. Also, the list of whitespace characters can be changed using
FullText.setWhitespaceChars(conn, ...)
</li><li>
When reading from the classpath (for example read_file('classpath:logo.png')),
...
...
@@ -79,7 +80,7 @@ Change Log
</li><li>
Improved error message for syntax error: the list of expected tokens was sometimes not set correctly.
</li><li>
Database file growth can now be limited using the database setting PAGE_STORE_MAX_GROWTH.
Slower growth may slow down operation, but speed up closing database.
</li><li>
A read only database with writ
e
able linked tables could lead to a DATABASE_IS_READ_ONLY (90097) error.
</li><li>
A read only database with writable linked tables could lead to a DATABASE_IS_READ_ONLY (90097) error.
This is fixed now.
</li></ul>
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
cb8d121f
...
...
@@ -92,6 +92,7 @@ public class Session extends SessionWithState {
private
volatile
long
cancelAt
;
private
boolean
closed
;
private
long
sessionStart
=
System
.
currentTimeMillis
();
private
long
transactionStart
;
private
long
currentCommandStart
;
private
HashMap
<
String
,
Value
>
variables
;
private
HashSet
<
ResultInterface
>
temporaryResults
;
...
...
@@ -454,6 +455,7 @@ public class Session extends SessionWithState {
public
void
commit
(
boolean
ddl
)
{
checkCommitRollback
();
currentTransactionName
=
null
;
transactionStart
=
0
;
if
(
containsUncommitted
())
{
// need to commit even if rollback is not possible
// (create/drop table and so on)
...
...
@@ -1070,6 +1072,13 @@ public class Session extends SessionWithState {
return
sessionStart
;
}
public
long
getTransactionStart
()
{
if
(
transactionStart
==
0
)
{
transactionStart
=
System
.
currentTimeMillis
();
}
return
transactionStart
;
}
public
Table
[]
getLocks
()
{
// copy the data without synchronizing
ArrayList
<
Table
>
copy
=
New
.
arrayList
();
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
cb8d121f
...
...
@@ -677,18 +677,23 @@ public class Function extends Expression implements FunctionCall {
result
=
ValueInt
.
get
(
DateTimeUtils
.
getIsoDayOfWeek
(
v0
.
getDateNoCopy
()));
break
;
case
CURDATE:
case
CURRENT_DATE:
case
CURRENT_DATE:
{
long
now
=
session
.
getTransactionStart
();
// need to normalize
result
=
ValueDate
.
get
(
new
Date
(
System
.
currentTimeMillis
()
));
result
=
ValueDate
.
get
(
new
Date
(
now
));
break
;
}
case
CURTIME:
case
CURRENT_TIME:
case
CURRENT_TIME:
{
long
now
=
session
.
getTransactionStart
();
// need to normalize
result
=
ValueTime
.
get
(
new
Time
(
System
.
currentTimeMillis
()
));
result
=
ValueTime
.
get
(
new
Time
(
now
));
break
;
}
case
NOW:
case
CURRENT_TIMESTAMP:
{
ValueTimestamp
vt
=
ValueTimestamp
.
getNoCopy
(
new
Timestamp
(
System
.
currentTimeMillis
()));
long
now
=
session
.
getTransactionStart
();
ValueTimestamp
vt
=
ValueTimestamp
.
getNoCopy
(
new
Timestamp
(
now
));
if
(
v0
!=
null
)
{
Mode
mode
=
database
.
getMode
();
vt
=
(
ValueTimestamp
)
vt
.
convertScale
(
mode
.
convertOnlyToSmallerScale
,
v0
.
getInt
());
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
cb8d121f
...
...
@@ -655,11 +655,15 @@ factor [ { { + | - } factor } [...] ]
","
A value or a numeric sum."
"Other Grammar","Table Expression","
{ [ schemaName. ] tableName | ( select ) } [ [ AS ] newTableAlias ]
{ [ schemaName. ] tableName | ( select )
| valuesExpression
} [ [ AS ] newTableAlias ]
[ { { LEFT | RIGHT } [ OUTER ] | [ INNER ] | CROSS | NATURAL }
JOIN tableExpression [ ON expression ] ]
","
Joins a table."
"Other Grammar","Values Expression","
VALUES { ( expression [,...] ) } [,...]
","
A list of rows that can be used like a table."
"Other Grammar","Term","
value
| columnName
...
...
@@ -1148,7 +1152,7 @@ Returns the current time."
","
Returns the current timestamp."
"Functions (Time and Date)","DATEADD","
DATEADD
(unitString, addInt, timestamp)
{ DATEADD| TIMESTAMPADD }
(unitString, addInt, timestamp)
","
Adds units to a timestamp."
"Functions (Time and Date)","DATEDIFF","
...
...
h2/src/test/org/h2/test/testSimple.in.txt
浏览文件 @
cb8d121f
select count(distinct now()) c from system_range(1, 100), system_range(1, 1000);
> 1;
select {fn TIMESTAMPADD(SQL_TSI_DAY, 1, {ts '2011-10-20 20:30:40.001'})};
> 2011-10-21 20:30:40.001;
select {fn TIMESTAMPADD(SQL_TSI_SECOND, 1, cast('2011-10-20 20:30:40.001' as timestamp))};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论