Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6e12ebd9
提交
6e12ebd9
authored
12月 12, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Parse more units of LOB precision from the SQL Standard
上级
17fac4b5
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
110 行增加
和
18 行删除
+110
-18
help.csv
h2/src/docsrc/help/help.csv
+6
-2
Parser.java
h2/src/main/org/h2/command/Parser.java
+43
-15
blob.sql
h2/src/test/org/h2/test/scripts/datatypes/blob.sql
+30
-0
clob.sql
h2/src/test/org/h2/test/scripts/datatypes/clob.sql
+30
-0
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-1
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
6e12ebd9
...
@@ -3118,7 +3118,7 @@ CHAR(10)
...
@@ -3118,7 +3118,7 @@ CHAR(10)
"Data Types","BLOB Type","
"Data Types","BLOB Type","
{ BLOB | BINARY LARGE OBJECT
{ BLOB | BINARY LARGE OBJECT
| TINYBLOB | MEDIUMBLOB | LONGBLOB | IMAGE | OID }
| TINYBLOB | MEDIUMBLOB | LONGBLOB | IMAGE | OID }
[ ( precisionInt ) ]
[ ( precisionInt
[K|M|G|T|P]
) ]
","
","
Like BINARY, but intended for very large values such as files or images. Unlike
Like BINARY, but intended for very large values such as files or images. Unlike
when using BINARY, large objects are not kept fully in-memory. Use
when using BINARY, large objects are not kept fully in-memory. Use
...
@@ -3128,12 +3128,13 @@ Advanced / Large Objects.
...
@@ -3128,12 +3128,13 @@ Advanced / Large Objects.
Mapped to ""java.sql.Blob"" (""java.io.InputStream"" is also supported).
Mapped to ""java.sql.Blob"" (""java.io.InputStream"" is also supported).
","
","
BLOB
BLOB
BLOB(10K)
"
"
"Data Types","CLOB Type","
"Data Types","CLOB Type","
{ CLOB | CHARACTER LARGE OBJECT
{ CLOB | CHARACTER LARGE OBJECT
| TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT | NTEXT | NCLOB }
| TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT | NTEXT | NCLOB }
[ ( precisionInt ) ]
[ ( precisionInt
[K|M|G|T|P] [CHARACTERS|OCTETS]
) ]
","
","
CLOB is like VARCHAR, but intended for very large values. Unlike when using
CLOB is like VARCHAR, but intended for very large values. Unlike when using
VARCHAR, large CLOB objects are not kept fully in-memory; instead, they are streamed.
VARCHAR, large CLOB objects are not kept fully in-memory; instead, they are streamed.
...
@@ -3145,9 +3146,12 @@ VARCHAR should be used for text with relatively short average size (for example
...
@@ -3145,9 +3146,12 @@ VARCHAR should be used for text with relatively short average size (for example
shorter than 200 characters). Short CLOB values are stored inline, but there is
shorter than 200 characters). Short CLOB values are stored inline, but there is
an overhead compared to VARCHAR.
an overhead compared to VARCHAR.
Precision, if any, should be specified in characters, CHARACTERS and OCTETS units have no effect in H2.
Mapped to ""java.sql.Clob"" (""java.io.Reader"" is also supported).
Mapped to ""java.sql.Clob"" (""java.io.Reader"" is also supported).
","
","
CLOB
CLOB
CLOB(10K)
"
"
"Data Types","UUID Type","
"Data Types","UUID Type","
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
6e12ebd9
...
@@ -5310,22 +5310,8 @@ public class Parser {
...
@@ -5310,22 +5310,8 @@ public class Parser {
}
}
}
else
if
(
readIf
(
OPEN_PAREN
))
{
}
else
if
(
readIf
(
OPEN_PAREN
))
{
if
(!
readIf
(
"MAX"
))
{
if
(!
readIf
(
"MAX"
))
{
long
p
=
readNonNegativeLong
();
long
p
=
readPrecision
();
if
(
readIf
(
"K"
))
{
p
*=
1024
;
}
else
if
(
readIf
(
"M"
))
{
p
*=
1024
*
1024
;
}
else
if
(
readIf
(
"G"
))
{
p
*=
1024
*
1024
*
1024
;
}
if
(
p
>
Long
.
MAX_VALUE
)
{
p
=
Long
.
MAX_VALUE
;
}
original
+=
"("
+
p
;
original
+=
"("
+
p
;
// Oracle syntax
if
(!
readIf
(
"CHAR"
))
{
readIf
(
"BYTE"
);
}
if
(
dataType
.
supportsScale
)
{
if
(
dataType
.
supportsScale
)
{
if
(
readIf
(
COMMA
))
{
if
(
readIf
(
COMMA
))
{
scale
=
readInt
();
scale
=
readInt
();
...
@@ -5443,6 +5429,48 @@ public class Parser {
...
@@ -5443,6 +5429,48 @@ public class Parser {
return
column
;
return
column
;
}
}
private
long
readPrecision
()
{
long
p
=
readNonNegativeLong
();
if
(
currentTokenType
==
IDENTIFIER
&&
!
currentTokenQuoted
&&
currentToken
.
length
()
==
1
)
{
long
mul
;
char
ch
=
currentToken
.
charAt
(
0
);
switch
(
identifiersToUpper
?
ch
:
Character
.
toUpperCase
(
ch
))
{
case
'K'
:
mul
=
1L
<<
10
;
break
;
case
'M'
:
mul
=
1L
<<
20
;
break
;
case
'G'
:
mul
=
1L
<<
30
;
break
;
case
'T'
:
mul
=
1L
<<
40
;
break
;
case
'P'
:
mul
=
1L
<<
50
;
break
;
default
:
throw
getSyntaxError
();
}
if
(
p
>
Long
.
MAX_VALUE
/
mul
)
{
throw
DbException
.
getInvalidValueException
(
"precision"
,
p
+
currentToken
);
}
p
*=
mul
;
read
();
}
if
(
currentTokenType
==
IDENTIFIER
&&
!
currentTokenQuoted
)
{
// Standard char length units
if
(!
readIf
(
"CHARACTERS"
)
&&
!
readIf
(
"OCTETS"
)
&&
// Oracle syntax
!
readIf
(
"CHAR"
))
{
// Oracle syntax
readIf
(
"BYTE"
);
}
}
return
p
;
}
private
Prepared
parseCreate
()
{
private
Prepared
parseCreate
()
{
boolean
orReplace
=
false
;
boolean
orReplace
=
false
;
if
(
readIf
(
"OR"
))
{
if
(
readIf
(
"OR"
))
{
...
...
h2/src/test/org/h2/test/scripts/datatypes/blob.sql
浏览文件 @
6e12ebd9
...
@@ -21,3 +21,33 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO
...
@@ -21,3 +21,33 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
CREATE
TABLE
TEST
(
B0
BLOB
(
10
),
B1
BLOB
(
10
K
),
B2
BLOB
(
10
M
),
B3
BLOB
(
10
G
),
B4
BLOB
(
10
T
),
B5
BLOB
(
10
P
));
>
ok
SELECT
COLUMN_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
COLUMN_TYPE
>
----------- -----------------------
>
B0
BLOB
(
10
)
>
B1
BLOB
(
10240
)
>
B2
BLOB
(
10485760
)
>
B3
BLOB
(
10737418240
)
>
B4
BLOB
(
10995116277760
)
>
B5
BLOB
(
11258999068426240
)
>
rows
(
ordered
):
6
INSERT
INTO
TEST
(
B0
)
VALUES
(
'0102030405060708091011'
);
>
exception
VALUE_TOO_LONG_2
INSERT
INTO
TEST
(
B0
)
VALUES
(
'01020304050607080910'
);
>
update
count
:
1
SELECT
B0
FROM
TEST
;
>>
01020304050607080910
DROP
TABLE
TEST
;
>
ok
CREATE
TABLE
TEST
(
B
BLOB
(
8192
P
));
>
exception
INVALID_VALUE_2
h2/src/test/org/h2/test/scripts/datatypes/clob.sql
浏览文件 @
6e12ebd9
...
@@ -23,3 +23,33 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO
...
@@ -23,3 +23,33 @@ SELECT COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.CO
DROP
TABLE
TEST
;
DROP
TABLE
TEST
;
>
ok
>
ok
CREATE
TABLE
TEST
(
C0
CLOB
(
10
),
C1
CLOB
(
10
K
),
C2
CLOB
(
10
M
CHARACTERS
),
C3
CLOB
(
10
G
OCTETS
),
C4
CLOB
(
10
T
),
C5
CLOB
(
10
P
));
>
ok
SELECT
COLUMN_NAME
,
COLUMN_TYPE
FROM
INFORMATION_SCHEMA
.
COLUMNS
WHERE
TABLE_NAME
=
'TEST'
ORDER
BY
ORDINAL_POSITION
;
>
COLUMN_NAME
COLUMN_TYPE
>
----------- -----------------------
>
C0
CLOB
(
10
)
>
C1
CLOB
(
10240
)
>
C2
CLOB
(
10485760
)
>
C3
CLOB
(
10737418240
)
>
C4
CLOB
(
10995116277760
)
>
C5
CLOB
(
11258999068426240
)
>
rows
(
ordered
):
6
INSERT
INTO
TEST
(
C0
)
VALUES
(
'12345678901'
);
>
exception
VALUE_TOO_LONG_2
INSERT
INTO
TEST
(
C0
)
VALUES
(
'1234567890'
);
>
update
count
:
1
SELECT
C0
FROM
TEST
;
>>
1234567890
DROP
TABLE
TEST
;
>
ok
CREATE
TABLE
TEST
(
C
CLOB
(
8192
P
));
>
exception
INVALID_VALUE_2
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
6e12ebd9
...
@@ -804,4 +804,4 @@ qualification opportunity jumping exploited unacceptable vrs duplicated
...
@@ -804,4 +804,4 @@ qualification opportunity jumping exploited unacceptable vrs duplicated
queryparser tokenized freeze factorings recompilation unenclosed rfe dsync
queryparser tokenized freeze factorings recompilation unenclosed rfe dsync
econd irst bcef ordinality nord unnest
econd irst bcef ordinality nord unnest
analyst occupation distributive josaph aor engineer sajeewa isuru randil kevin doctor businessman artist ashan
analyst occupation distributive josaph aor engineer sajeewa isuru randil kevin doctor businessman artist ashan
corrupts splitted disruption unintentional
corrupts splitted disruption unintentional
octets
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论