Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f05b10bd
Unverified
提交
f05b10bd
authored
7 年前
作者:
Evgenij Ryazanov
提交者:
GitHub
7 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1252 from katzyn/misc
Assorted minor changes
上级
4dac32b2
87aee302
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
31 行增加
和
39 行删除
+31
-39
Parser.java
h2/src/main/org/h2/command/Parser.java
+8
-14
Analyze.java
h2/src/main/org/h2/command/ddl/Analyze.java
+2
-2
Session.java
h2/src/main/org/h2/engine/Session.java
+11
-15
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+2
-3
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+2
-2
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+2
-1
RowList.java
h2/src/main/org/h2/result/RowList.java
+2
-1
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+2
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
f05b10bd
...
...
@@ -651,10 +651,9 @@ public class Parser {
for
(
int
i
=
0
;;
i
++)
{
Column
column
=
parseColumnForTable
(
"C"
+
i
,
true
);
list
.
add
(
column
);
if
(
readIf
(
")"
))
{
if
(
!
readIfMore
(
true
))
{
break
;
}
read
(
","
);
}
}
read
(
"AS"
);
...
...
@@ -3302,20 +3301,17 @@ public class Parser {
r
=
new
ExpressionList
(
new
Expression
[
0
]);
}
else
{
r
=
readExpression
();
if
(
readIf
(
","
))
{
if
(
readIf
More
(
true
))
{
ArrayList
<
Expression
>
list
=
Utils
.
newSmallArrayList
();
list
.
add
(
r
);
while
(!
readIf
(
")"
))
{
r
=
readExpression
();
list
.
add
(
r
);
if
(!
readIf
(
","
))
{
read
(
")"
);
if
(!
readIfMore
(
true
))
{
break
;
}
}
r
=
new
ExpressionList
(
list
.
toArray
(
new
Expression
[
0
]));
}
else
{
read
(
")"
);
}
}
break
;
...
...
@@ -5770,10 +5766,9 @@ public class Parser {
readIfEqualOrTo
();
Set
command
=
new
Set
(
session
,
SetTypes
.
SCHEMA_SEARCH_PATH
);
ArrayList
<
String
>
list
=
Utils
.
newSmallArrayList
();
do
{
list
.
add
(
readAliasIdentifier
());
while
(
readIf
(
","
))
{
list
.
add
(
readAliasIdentifier
());
}
}
while
(
readIf
(
","
));
command
.
setStringArray
(
list
.
toArray
(
new
String
[
0
]));
return
command
;
}
else
if
(
readIf
(
"JAVA_OBJECT_SERIALIZER"
))
{
...
...
@@ -5836,11 +5831,10 @@ public class Parser {
}
private
Set
parseSetBinaryCollation
()
{
Set
command
=
new
Set
(
session
,
SetTypes
.
BINARY_COLLATION
);
String
name
=
readAliasIdentifier
();
if
(
equalsToken
(
name
,
CompareMode
.
UNSIGNED
)
||
equalsToken
(
name
,
CompareMode
.
SIGNED
))
{
Set
command
=
new
Set
(
session
,
SetTypes
.
BINARY_COLLATION
);
command
.
setString
(
name
);
if
(
equalsToken
(
name
,
CompareMode
.
UNSIGNED
)
||
equalsToken
(
name
,
CompareMode
.
SIGNED
))
{
return
command
;
}
throw
DbException
.
getInvalidValueException
(
"BINARY_COLLATION"
,
name
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/Analyze.java
浏览文件 @
f05b10bd
...
...
@@ -17,6 +17,7 @@ import org.h2.table.Column;
import
org.h2.table.Table
;
import
org.h2.table.TableType
;
import
org.h2.util.StatementBuilder
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueInt
;
import
org.h2.value.ValueNull
;
...
...
@@ -104,8 +105,7 @@ public class Analyze extends DefineCommand {
StatementBuilder
buff
=
new
StatementBuilder
(
"SELECT "
);
for
(
Column
col
:
columns
)
{
buff
.
appendExceptFirst
(
", "
);
int
type
=
col
.
getType
();
if
(
type
==
Value
.
BLOB
||
type
==
Value
.
CLOB
)
{
if
(
DataType
.
isLargeObject
(
col
.
getType
()))
{
// can not index LOB columns, so calculating
// the selectivity is not required
buff
.
append
(
"MAX(NULL)"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
f05b10bd
...
...
@@ -7,7 +7,6 @@ package org.h2.engine;
import
java.util.ArrayDeque
;
import
java.util.ArrayList
;
import
java.util.Deque
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
...
...
@@ -50,6 +49,7 @@ import org.h2.util.ColumnNamerConfiguration;
import
org.h2.util.CurrentTimestamp
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.Utils
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
import
org.h2.value.ValueLong
;
...
...
@@ -129,8 +129,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
private
SmallLRUCache
<
String
,
Command
>
queryCache
;
private
long
modificationMetaID
=
-
1
;
private
SubQueryInfo
subQueryInfo
;
private
int
parsingView
;
private
final
Deque
<
String
>
viewNameStack
=
new
ArrayDeque
<>();
private
ArrayDeque
<
String
>
viewNameStack
;
private
int
preparingQueryExpression
;
private
volatile
SmallLRUCache
<
Object
,
ViewIndex
>
viewIndexCache
;
private
HashMap
<
Object
,
ViewIndex
>
subQueryIndexCache
;
...
...
@@ -244,26 +243,23 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
* name of the view
*/
public
void
setParsingCreateView
(
boolean
parsingView
,
String
viewName
)
{
// It can be recursive, thus implemented as counter.
this
.
parsingView
+=
parsingView
?
1
:
-
1
;
assert
this
.
parsingView
>=
0
;
if
(
viewNameStack
==
null
)
{
viewNameStack
=
new
ArrayDeque
<>(
3
)
;
}
if
(
parsingView
)
{
viewNameStack
.
push
(
viewName
);
}
else
{
assert
viewName
.
equals
(
viewNameStack
.
peek
()
);
viewNameStack
.
pop
(
);
String
name
=
viewNameStack
.
pop
(
);
assert
viewName
.
equals
(
name
);
}
}
public
String
getParsingCreateViewName
()
{
if
(
viewNameStack
.
isEmpty
())
{
return
null
;
}
return
viewNameStack
.
peek
();
return
viewNameStack
!=
null
?
viewNameStack
.
peek
()
:
null
;
}
public
boolean
isParsingCreateView
()
{
assert
parsingView
>=
0
;
return
parsingView
!=
0
;
return
viewNameStack
!=
null
&&
!
viewNameStack
.
isEmpty
();
}
/**
...
...
@@ -1701,7 +1697,7 @@ public class Session extends SessionWithState implements TransactionStore.Rollba
@Override
public
void
addTemporaryLob
(
Value
v
)
{
if
(
v
.
getType
()
!=
Value
.
CLOB
&&
v
.
getType
()
!=
Value
.
BLOB
)
{
if
(
!
DataType
.
isLargeObject
(
v
.
getType
())
)
{
return
;
}
if
(
v
.
getTableId
()
==
LobStorageFrontend
.
TABLE_RESULT
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
f05b10bd
...
...
@@ -15,6 +15,7 @@ import org.h2.message.DbException;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.value.CompareMode
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueBoolean
;
import
org.h2.value.ValueNull
;
...
...
@@ -198,9 +199,7 @@ public class CompareLike extends Condition {
// can't use an index
return
;
}
int
dataType
=
l
.
getColumn
().
getType
();
if
(
dataType
!=
Value
.
STRING
&&
dataType
!=
Value
.
STRING_IGNORECASE
&&
dataType
!=
Value
.
STRING_FIXED
)
{
if
(!
DataType
.
isStringType
(
l
.
getColumn
().
getType
()))
{
// column is not a varchar - can't use the index
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
f05b10bd
...
...
@@ -23,6 +23,7 @@ import org.h2.table.Table;
import
org.h2.table.TableFilter
;
import
org.h2.util.StatementBuilder
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueNull
;
...
...
@@ -72,8 +73,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
*/
protected
static
void
checkIndexColumnTypes
(
IndexColumn
[]
columns
)
{
for
(
IndexColumn
c
:
columns
)
{
int
type
=
c
.
column
.
getType
();
if
(
type
==
Value
.
CLOB
||
type
==
Value
.
BLOB
)
{
if
(
DataType
.
isLargeObject
(
c
.
column
.
getType
()))
{
throw
DbException
.
getUnsupportedException
(
"Index on BLOB or CLOB column: "
+
c
.
column
.
getCreateSQL
());
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/ResultTempTable.java
浏览文件 @
f05b10bd
...
...
@@ -23,6 +23,7 @@ import org.h2.table.Column;
import
org.h2.table.IndexColumn
;
import
org.h2.table.Table
;
import
org.h2.util.TempFileDeleter
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
import
org.h2.value.ValueNull
;
...
...
@@ -118,7 +119,7 @@ public class ResultTempTable implements ResultExternal {
for
(
int
i
=
0
;
i
<
expressions
.
length
;
i
++)
{
int
type
=
expressions
[
i
].
getType
();
Column
col
=
new
Column
(
COLUMN_NAME
+
i
,
type
);
if
(
type
==
Value
.
CLOB
||
type
==
Value
.
BLOB
)
{
if
(
DataType
.
isLargeObject
(
type
)
)
{
containsLob
=
true
;
}
data
.
columns
.
add
(
col
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/RowList.java
浏览文件 @
f05b10bd
...
...
@@ -13,6 +13,7 @@ import org.h2.engine.Session;
import
org.h2.store.Data
;
import
org.h2.store.FileStore
;
import
org.h2.util.Utils
;
import
org.h2.value.DataType
;
import
org.h2.value.Value
;
/**
...
...
@@ -63,7 +64,7 @@ public class RowList {
buff
.
writeByte
((
byte
)
0
);
}
else
{
buff
.
writeByte
((
byte
)
1
);
if
(
v
.
getType
()
==
Value
.
CLOB
||
v
.
getType
()
==
Value
.
BLOB
)
{
if
(
DataType
.
isLargeObject
(
v
.
getType
())
)
{
// need to keep a reference to temporary lobs,
// otherwise the temp file is deleted
if
(
v
.
getSmall
()
==
null
&&
v
.
getTableId
()
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
f05b10bd
...
...
@@ -37,6 +37,7 @@ import org.h2.store.LobStorageInterface;
import
org.h2.util.IOUtils
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.SmallMap
;
import
org.h2.value.DataType
;
import
org.h2.value.Transfer
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLobDb
;
...
...
@@ -572,7 +573,7 @@ public class TcpServerThread implements Runnable {
}
private
void
writeValue
(
Value
v
)
throws
IOException
{
if
(
v
.
getType
()
==
Value
.
CLOB
||
v
.
getType
()
==
Value
.
BLOB
)
{
if
(
DataType
.
isLargeObject
(
v
.
getType
())
)
{
if
(
v
instanceof
ValueLobDb
)
{
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
if
(
lob
.
isStored
())
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论