Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
80058982
提交
80058982
authored
3月 28, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support INSERT INTO TEST SET ID = 1, NAME = 'World' (MySQL compatibility).
上级
769aafc5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
1426 行增加
和
1363 行删除
+1426
-1363
help.csv
h2/src/docsrc/help/help.csv
+5
-3
changelog.html
h2/src/docsrc/html/changelog.html
+3
-2
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+460
-445
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+461
-446
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+451
-446
Parser.java
h2/src/main/org/h2/command/Parser.java
+36
-14
help.csv
h2/src/main/org/h2/res/help.csv
+5
-3
TableView.java
h2/src/main/org/h2/table/TableView.java
+2
-1
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+3
-3
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
80058982
...
...
@@ -42,8 +42,10 @@ SELECT * FROM (SELECT ID, COUNT(*) FROM TEST
"
"Commands (DML)","INSERT","
INSERT INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select }
INSERT INTO tableName
{ [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select } } |
{ SET { columnName = { DEFAULT | expression } } [,...] }
","
Inserts a new row / new rows into a table.
...
...
@@ -56,7 +58,7 @@ INSERT INTO TEST VALUES(1, 'Hello')
"Commands (DML)","UPDATE","
UPDATE tableName [ [ AS ] newTableAlias ]
SET { columnName= { DEFAULT | expression } } [,...]
SET { columnName
= { DEFAULT | expression } } [,...]
[ WHERE expression ]
","
Updates data in a table.
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
80058982
...
...
@@ -18,8 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 304: The condition [NOT] IN (SELECT ...) could throw the exception "Unexpected code path" if the subquery contained ORDER BY.
</li><li>
ALTER TABLE ALTER ADD / REMOVE /ALTER COLUMN dropped some dependent objects
<ul><li>
Support INSERT INTO TEST SET ID = 1, NAME = 'World' (MySQL compatibility).
</li><li>
Issue 304: The condition [NOT] IN (SELECT ...) could throw the exception "Unexpected code path" if the subquery contained ORDER BY.
</li><li>
ALTER TABLE ALTER ADD / REMOVE /ALTER COLUMN dropped some dependent objects
(access rights, triggers) of views that depend on the modified table.
</li><li>
CREATE OR REPLACE VIEW dropped some dependent objects (access rights, triggers)
if the view already existed before.
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
80058982
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
80058982
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
80058982
This source diff could not be displayed because it is too large. You can
view the blob
instead.
h2/src/main/org/h2/command/Parser.java
浏览文件 @
80058982
...
...
@@ -769,13 +769,7 @@ public class Parser {
HashSet
<
Column
>
set
=
New
.
hashSet
();
if
(!
readIf
(
")"
))
{
do
{
String
id
=
readColumnIdentifier
();
Column
column
;
if
(
database
.
getSettings
().
rowId
&&
Column
.
ROWID
.
equals
(
id
))
{
column
=
table
.
getRowIdColumn
();
}
else
{
column
=
table
.
getColumn
(
id
);
}
Column
column
=
parseColumn
(
table
);
if
(!
set
.
add
(
column
))
{
throw
DbException
.
get
(
ErrorCode
.
DUPLICATE_COLUMN_NAME_1
,
column
.
getSQL
());
}
...
...
@@ -785,6 +779,14 @@ public class Parser {
return
columns
.
toArray
(
new
Column
[
columns
.
size
()]);
}
private
Column
parseColumn
(
Table
table
)
{
String
id
=
readColumnIdentifier
();
if
(
database
.
getSettings
().
rowId
&&
Column
.
ROWID
.
equals
(
id
))
{
return
table
.
getRowIdColumn
();
}
return
table
.
getColumn
(
id
);
}
private
boolean
readIfMore
()
{
if
(
readIf
(
","
))
{
return
!
readIf
(
")"
);
...
...
@@ -940,13 +942,14 @@ public class Parser {
read
(
"INTO"
);
Table
table
=
readTableOrView
();
command
.
setTable
(
table
);
Column
[]
columns
=
null
;
if
(
readIf
(
"("
))
{
if
(
isSelect
())
{
command
.
setQuery
(
parseSelect
());
read
(
")"
);
return
command
;
}
Column
[]
columns
=
parseColumnList
(
table
);
columns
=
parseColumnList
(
table
);
command
.
setColumns
(
columns
);
}
if
(
readIf
(
"DIRECT"
))
{
...
...
@@ -975,6 +978,25 @@ public class Parser {
command
.
addRow
(
values
.
toArray
(
new
Expression
[
values
.
size
()]));
// the following condition will allow (..),; and (..);
}
while
(
readIf
(
","
)
&&
readIf
(
"("
));
}
else
if
(
readIf
(
"SET"
))
{
if
(
columns
!=
null
)
{
throw
getSyntaxError
();
}
ArrayList
<
Column
>
columnList
=
New
.
arrayList
();
ArrayList
<
Expression
>
values
=
New
.
arrayList
();
do
{
columnList
.
add
(
parseColumn
(
table
));
read
(
"="
);
Expression
expression
;
if
(
readIf
(
"DEFAULT"
))
{
expression
=
ValueExpression
.
getDefault
();
}
else
{
expression
=
readExpression
();
}
values
.
add
(
expression
);
}
while
(
readIf
(
","
));
command
.
setColumns
(
columnList
.
toArray
(
new
Column
[
columnList
.
size
()]));
command
.
addRow
(
values
.
toArray
(
new
Expression
[
values
.
size
()]));
}
else
{
command
.
setQuery
(
parseSelect
());
}
...
...
@@ -2126,7 +2148,7 @@ public class Parser {
case
Function
.
CAST
:
{
function
.
setParameter
(
0
,
readExpression
());
read
(
"AS"
);
Column
type
=
parseColumn
(
null
);
Column
type
=
parseColumn
WithType
(
null
);
function
.
setDataType
(
type
);
read
(
")"
);
break
;
...
...
@@ -2134,7 +2156,7 @@ public class Parser {
case
Function
.
CONVERT
:
{
function
.
setParameter
(
0
,
readExpression
());
read
(
","
);
Column
type
=
parseColumn
(
null
);
Column
type
=
parseColumn
WithType
(
null
);
function
.
setDataType
(
type
);
read
(
")"
);
break
;
...
...
@@ -2223,7 +2245,7 @@ public class Parser {
ArrayList
<
Column
>
columns
=
New
.
arrayList
();
do
{
String
columnName
=
readAliasIdentifier
();
Column
column
=
parseColumn
(
columnName
);
Column
column
=
parseColumn
WithType
(
columnName
);
columns
.
add
(
column
);
read
(
"="
);
function
.
setParameter
(
i
,
readExpression
());
...
...
@@ -2584,7 +2606,7 @@ public class Parser {
JavaFunction
func
=
new
JavaFunction
(
f
,
args
);
r
=
func
;
}
else
{
Column
col
=
parseColumn
(
null
);
Column
col
=
parseColumn
WithType
(
null
);
Function
function
=
Function
.
getFunction
(
database
,
"CAST"
);
function
.
setDataType
(
col
);
function
.
setParameter
(
0
,
r
);
...
...
@@ -3451,7 +3473,7 @@ public class Parser {
parseAutoIncrement
(
column
);
column
.
setPrimaryKey
(
true
);
}
else
{
column
=
parseColumn
(
columnName
);
column
=
parseColumn
WithType
(
columnName
);
}
if
(
readIf
(
"NOT"
))
{
read
(
"NULL"
);
...
...
@@ -3549,7 +3571,7 @@ public class Parser {
return
null
;
}
private
Column
parseColumn
(
String
columnName
)
{
private
Column
parseColumn
WithType
(
String
columnName
)
{
String
original
=
currentToken
;
boolean
regular
=
false
;
if
(
readIf
(
"LONG"
))
{
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
80058982
...
...
@@ -13,13 +13,15 @@ FROM tableExpression [,...] [ WHERE expression ]
","
Selects data from a table or multiple tables."
"Commands (DML)","INSERT","
INSERT INTO tableName [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select }
INSERT INTO tableName
{ [ ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | [ DIRECT ] [ SORTED ] select } } |
{ SET { columnName = { DEFAULT | expression } } [,...] }
","
Inserts a new row / new rows into a table."
"Commands (DML)","UPDATE","
UPDATE tableName [ [ AS ] newTableAlias ]
SET { columnName= { DEFAULT | expression } } [,...]
SET { columnName
= { DEFAULT | expression } } [,...]
[ WHERE expression ]
","
Updates data in a table."
...
...
h2/src/main/org/h2/table/TableView.java
浏览文件 @
80058982
...
...
@@ -104,7 +104,8 @@ public class TableView extends Table {
*
* @param session the session
* @param force if exceptions should be ignored
* @return the exception if re-compiling this or any dependent view failed (only when force is disabled)
* @return the exception if re-compiling this or any dependent view failed
* (only when force is disabled)
*/
public
DbException
recompile
(
Session
session
,
boolean
force
)
{
try
{
...
...
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
80058982
...
...
@@ -1928,13 +1928,13 @@ drop table d;
create table test(id int, c char(5), v varchar(5));
> ok
insert into test
values(1, 'a', 'a')
;
insert into test
set id = 1, c = 'a', v = 'a'
;
> update count: 1
insert into test
values(2, 'a ', 'a ')
;
insert into test
set id = 2, c = 'a ', v = 'a '
;
> update count: 1
insert into test
values(3, 'abcde ', 'abcde')
;
insert into test
set id = 3, c = 'abcde ', v = 'abcde'
;
> update count: 1
select distinct length(c) from test order by length(c);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论