Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
645494c4
提交
645494c4
authored
10月 13, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Smaller changes (mainly for Android).
上级
6969ad47
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
176 行增加
和
141 行删除
+176
-141
Parser.java
h2/src/main/org/h2/command/Parser.java
+9
-11
Prepared.java
h2/src/main/org/h2/command/Prepared.java
+5
-3
Merge.java
h2/src/main/org/h2/command/dml/Merge.java
+2
-2
Query.java
h2/src/main/org/h2/command/dml/Query.java
+15
-11
Select.java
h2/src/main/org/h2/command/dml/Select.java
+49
-42
Session.java
h2/src/main/org/h2/engine/Session.java
+2
-1
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+6
-4
ConditionIn.java
h2/src/main/org/h2/expression/ConditionIn.java
+3
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+1
-1
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+1
-1
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+7
-5
RowList.java
h2/src/main/org/h2/result/RowList.java
+1
-1
SHA256.java
h2/src/main/org/h2/security/SHA256.java
+1
-1
PageLog.java
h2/src/main/org/h2/store/PageLog.java
+3
-2
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+1
-1
Table.java
h2/src/main/org/h2/table/Table.java
+34
-26
Csv.java
h2/src/main/org/h2/tools/Csv.java
+4
-3
CacheLRU.java
h2/src/main/org/h2/util/CacheLRU.java
+3
-2
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+24
-17
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-1
ValueUuid.java
h2/src/main/org/h2/value/ValueUuid.java
+1
-1
TestRunscript.java
h2/src/test/org/h2/test/db/TestRunscript.java
+3
-3
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
645494c4
...
@@ -429,7 +429,7 @@ public class Parser {
...
@@ -429,7 +429,7 @@ public class Parser {
throw
getSyntaxError
();
throw
getSyntaxError
();
}
}
if
(
indexedParameterList
!=
null
)
{
if
(
indexedParameterList
!=
null
)
{
for
(
int
i
=
0
;
i
<
indexedParameterList
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
indexedParameterList
.
size
();
i
<
size
;
i
++)
{
if
(
indexedParameterList
.
get
(
i
)
==
null
)
{
if
(
indexedParameterList
.
get
(
i
)
==
null
)
{
indexedParameterList
.
set
(
i
,
new
Parameter
(
i
));
indexedParameterList
.
set
(
i
,
new
Parameter
(
i
));
}
}
...
@@ -844,10 +844,12 @@ public class Parser {
...
@@ -844,10 +844,12 @@ public class Parser {
private
Prepared
prepare
(
Session
s
,
String
sql
,
ArrayList
<
Value
>
paramValues
)
{
private
Prepared
prepare
(
Session
s
,
String
sql
,
ArrayList
<
Value
>
paramValues
)
{
Prepared
prep
=
s
.
prepare
(
sql
);
Prepared
prep
=
s
.
prepare
(
sql
);
ArrayList
<
Parameter
>
params
=
prep
.
getParameters
();
ArrayList
<
Parameter
>
params
=
prep
.
getParameters
();
for
(
int
i
=
0
;
params
!=
null
&&
i
<
params
.
size
();
i
++)
{
if
(
params
!=
null
)
{
for
(
int
i
=
0
,
size
=
params
.
size
();
i
<
size
;
i
++)
{
Parameter
p
=
params
.
get
(
i
);
Parameter
p
=
params
.
get
(
i
);
p
.
setValue
(
paramValues
.
get
(
i
));
p
.
setValue
(
paramValues
.
get
(
i
));
}
}
}
return
prep
;
return
prep
;
}
}
...
@@ -955,11 +957,7 @@ public class Parser {
...
@@ -955,11 +957,7 @@ public class Parser {
if
(
isSelect
())
{
if
(
isSelect
())
{
Query
query
=
parseSelectUnion
();
Query
query
=
parseSelectUnion
();
read
(
")"
);
read
(
")"
);
ArrayList
<
Parameter
>
params
=
New
.
arrayList
();
query
.
setParameterList
(
New
.
arrayList
(
parameters
));
for
(
int
i
=
0
;
i
<
parameters
.
size
();
i
++)
{
params
.
add
(
parameters
.
get
(
i
));
}
query
.
setParameterList
(
params
);
query
.
init
();
query
.
init
();
Session
s
;
Session
s
;
if
(
createView
!=
null
)
{
if
(
createView
!=
null
)
{
...
@@ -1404,7 +1402,7 @@ public class Parser {
...
@@ -1404,7 +1402,7 @@ public class Parser {
int
paramIndex
=
parameters
.
size
();
int
paramIndex
=
parameters
.
size
();
Query
command
=
parseSelectUnion
();
Query
command
=
parseSelectUnion
();
ArrayList
<
Parameter
>
params
=
New
.
arrayList
();
ArrayList
<
Parameter
>
params
=
New
.
arrayList
();
for
(
int
i
=
paramIndex
;
i
<
parameters
.
size
()
;
i
++)
{
for
(
int
i
=
paramIndex
,
size
=
parameters
.
size
();
i
<
size
;
i
++)
{
params
.
add
(
parameters
.
get
(
i
));
params
.
add
(
parameters
.
get
(
i
));
}
}
command
.
setParameterList
(
params
);
command
.
setParameterList
(
params
);
...
@@ -5053,7 +5051,7 @@ public class Parser {
...
@@ -5053,7 +5051,7 @@ public class Parser {
if
((!
Character
.
isLetter
(
c
)
&&
c
!=
'_'
)
||
Character
.
isLowerCase
(
c
))
{
if
((!
Character
.
isLetter
(
c
)
&&
c
!=
'_'
)
||
Character
.
isLowerCase
(
c
))
{
return
StringUtils
.
quoteIdentifier
(
s
);
return
StringUtils
.
quoteIdentifier
(
s
);
}
}
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
1
,
length
=
s
.
length
();
i
<
length
;
i
++)
{
c
=
s
.
charAt
(
i
);
c
=
s
.
charAt
(
i
);
if
((!
Character
.
isLetterOrDigit
(
c
)
&&
c
!=
'_'
)
||
Character
.
isLowerCase
(
c
))
{
if
((!
Character
.
isLetterOrDigit
(
c
)
&&
c
!=
'_'
)
||
Character
.
isLowerCase
(
c
))
{
return
StringUtils
.
quoteIdentifier
(
s
);
return
StringUtils
.
quoteIdentifier
(
s
);
...
...
h2/src/main/org/h2/command/Prepared.java
浏览文件 @
645494c4
...
@@ -156,11 +156,13 @@ public abstract class Prepared {
...
@@ -156,11 +156,13 @@ public abstract class Prepared {
* @throws SQLException if any parameter has not been set
* @throws SQLException if any parameter has not been set
*/
*/
protected
void
checkParameters
()
{
protected
void
checkParameters
()
{
for
(
int
i
=
0
;
parameters
!=
null
&&
i
<
parameters
.
size
();
i
++)
{
if
(
parameters
!=
null
)
{
for
(
int
i
=
0
,
size
=
parameters
.
size
();
i
<
size
;
i
++)
{
Parameter
param
=
parameters
.
get
(
i
);
Parameter
param
=
parameters
.
get
(
i
);
param
.
checkSet
();
param
.
checkSet
();
}
}
}
}
}
/**
/**
* Set the command.
* Set the command.
...
...
h2/src/main/org/h2/command/dml/Merge.java
浏览文件 @
645494c4
...
@@ -85,11 +85,11 @@ public class Merge extends Prepared {
...
@@ -85,11 +85,11 @@ public class Merge extends Prepared {
session
.
setLastIdentity
(
ValueLong
.
get
(
0
));
session
.
setLastIdentity
(
ValueLong
.
get
(
0
));
if
(
list
.
size
()
>
0
)
{
if
(
list
.
size
()
>
0
)
{
count
=
0
;
count
=
0
;
for
(
int
x
=
0
;
x
<
list
.
size
()
;
x
++)
{
for
(
int
x
=
0
,
size
=
list
.
size
();
x
<
size
;
x
++)
{
setCurrentRowNumber
(
x
+
1
);
setCurrentRowNumber
(
x
+
1
);
Expression
[]
expr
=
list
.
get
(
x
);
Expression
[]
expr
=
list
.
get
(
x
);
Row
newRow
=
table
.
getTemplateRow
();
Row
newRow
=
table
.
getTemplateRow
();
for
(
int
i
=
0
;
i
<
columns
.
length
;
i
++)
{
for
(
int
i
=
0
,
len
=
columns
.
length
;
i
<
len
;
i
++)
{
Column
c
=
columns
[
i
];
Column
c
=
columns
[
i
];
int
index
=
c
.
getColumnId
();
int
index
=
c
.
getColumnId
();
Expression
e
=
expr
[
i
];
Expression
e
=
expr
[
i
];
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
645494c4
...
@@ -214,8 +214,9 @@ public abstract class Query extends Prepared {
...
@@ -214,8 +214,9 @@ public abstract class Query extends Prepared {
if
(
list
==
null
)
{
if
(
list
==
null
)
{
list
=
New
.
arrayList
();
list
=
New
.
arrayList
();
}
}
Value
[]
params
=
new
Value
[
list
.
size
()];
int
size
=
list
.
size
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Value
[]
params
=
new
Value
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Value
v
=
list
.
get
(
i
).
getParamValue
();
Value
v
=
list
.
get
(
i
).
getParamValue
();
params
[
i
]
=
v
;
params
[
i
]
=
v
;
}
}
...
@@ -330,7 +331,8 @@ public abstract class Query extends Prepared {
...
@@ -330,7 +331,8 @@ public abstract class Query extends Prepared {
}
}
}
else
{
}
else
{
String
s
=
e
.
getSQL
();
String
s
=
e
.
getSQL
();
for
(
int
j
=
0
;
expressionSQL
!=
null
&&
j
<
expressionSQL
.
size
();
j
++)
{
if
(
expressionSQL
!=
null
)
{
for
(
int
j
=
0
,
size
=
expressionSQL
.
size
();
j
<
size
;
j
++)
{
String
s2
=
expressionSQL
.
get
(
j
);
String
s2
=
expressionSQL
.
get
(
j
);
if
(
s2
.
equals
(
s
))
{
if
(
s2
.
equals
(
s
))
{
idx
=
j
;
idx
=
j
;
...
@@ -339,6 +341,7 @@ public abstract class Query extends Prepared {
...
@@ -339,6 +341,7 @@ public abstract class Query extends Prepared {
}
}
}
}
}
}
}
if
(!
isAlias
)
{
if
(!
isAlias
)
{
if
(
mustBeInResult
)
{
if
(
mustBeInResult
)
{
throw
DbException
.
get
(
ErrorCode
.
ORDER_BY_NOT_IN_RESULT
,
e
.
getSQL
());
throw
DbException
.
get
(
ErrorCode
.
ORDER_BY_NOT_IN_RESULT
,
e
.
getSQL
());
...
@@ -360,9 +363,10 @@ public abstract class Query extends Prepared {
...
@@ -360,9 +363,10 @@ public abstract class Query extends Prepared {
* @return the {@link SortOrder} object
* @return the {@link SortOrder} object
*/
*/
public
SortOrder
prepareOrder
(
ArrayList
<
SelectOrderBy
>
orderList
,
int
expressionCount
)
{
public
SortOrder
prepareOrder
(
ArrayList
<
SelectOrderBy
>
orderList
,
int
expressionCount
)
{
int
[]
index
=
new
int
[
orderList
.
size
()];
int
size
=
orderList
.
size
();
int
[]
sortType
=
new
int
[
orderList
.
size
()];
int
[]
index
=
new
int
[
size
];
for
(
int
i
=
0
;
i
<
orderList
.
size
();
i
++)
{
int
[]
sortType
=
new
int
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
SelectOrderBy
o
=
orderList
.
get
(
i
);
SelectOrderBy
o
=
orderList
.
get
(
i
);
int
idx
;
int
idx
;
boolean
reverse
=
false
;
boolean
reverse
=
false
;
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
645494c4
...
@@ -238,7 +238,8 @@ public class Select extends Query {
...
@@ -238,7 +238,8 @@ public class Select extends Query {
return
null
;
return
null
;
}
}
ArrayList
<
Index
>
indexes
=
topTableFilter
.
getTable
().
getIndexes
();
ArrayList
<
Index
>
indexes
=
topTableFilter
.
getTable
().
getIndexes
();
for
(
int
i
=
0
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
if
(
indexes
!=
null
)
{
for
(
int
i
=
0
,
size
=
indexes
.
size
();
i
<
size
;
i
++)
{
Index
index
=
indexes
.
get
(
i
);
Index
index
=
indexes
.
get
(
i
);
if
(
index
.
getIndexType
().
isScan
())
{
if
(
index
.
getIndexType
().
isScan
())
{
continue
;
continue
;
...
@@ -247,6 +248,7 @@ public class Select extends Query {
...
@@ -247,6 +248,7 @@ public class Select extends Query {
return
index
;
return
index
;
}
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -256,7 +258,7 @@ public class Select extends Query {
...
@@ -256,7 +258,7 @@ public class Select extends Query {
// also check that the first columns in the index are grouped
// also check that the first columns in the index are grouped
boolean
[]
grouped
=
new
boolean
[
indexColumns
.
length
];
boolean
[]
grouped
=
new
boolean
[
indexColumns
.
length
];
outerLoop:
outerLoop:
for
(
int
i
=
0
;
i
<
expressions
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
expressions
.
size
();
i
<
size
;
i
++)
{
if
(!
groupByExpression
[
i
])
{
if
(!
groupByExpression
[
i
])
{
continue
;
continue
;
}
}
...
@@ -407,7 +409,8 @@ public class Select extends Query {
...
@@ -407,7 +409,8 @@ public class Select extends Query {
return
topTableFilter
.
getTable
().
getScanIndex
(
session
);
return
topTableFilter
.
getTable
().
getScanIndex
(
session
);
}
}
ArrayList
<
Index
>
list
=
topTableFilter
.
getTable
().
getIndexes
();
ArrayList
<
Index
>
list
=
topTableFilter
.
getTable
().
getIndexes
();
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
size
();
i
++)
{
if
(
list
!=
null
)
{
for
(
int
i
=
0
,
size
=
list
.
size
();
i
<
size
;
i
++)
{
Index
index
=
list
.
get
(
i
);
Index
index
=
list
.
get
(
i
);
if
(
index
.
getCreateSQL
()
==
null
)
{
if
(
index
.
getCreateSQL
()
==
null
)
{
// can't use the scan index
// can't use the scan index
...
@@ -441,6 +444,7 @@ public class Select extends Query {
...
@@ -441,6 +444,7 @@ public class Select extends Query {
return
index
;
return
index
;
}
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -617,6 +621,7 @@ public class Select extends Query {
...
@@ -617,6 +621,7 @@ public class Select extends Query {
}
}
private
void
expandColumnList
()
{
private
void
expandColumnList
()
{
// the expressions may change within the loop
for
(
int
i
=
0
;
i
<
expressions
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
expressions
.
size
();
i
++)
{
Expression
expr
=
expressions
.
get
(
i
);
Expression
expr
=
expressions
.
get
(
i
);
if
(!
expr
.
isWildcard
())
{
if
(!
expr
.
isWildcard
())
{
...
@@ -696,12 +701,14 @@ public class Select extends Query {
...
@@ -696,12 +701,14 @@ public class Select extends Query {
// then 'HAVING' expressions,
// then 'HAVING' expressions,
// and 'GROUP BY' expressions at the end
// and 'GROUP BY' expressions at the end
if
(
group
!=
null
)
{
if
(
group
!=
null
)
{
groupIndex
=
new
int
[
group
.
size
()];
int
size
=
group
.
size
();
for
(
int
i
=
0
;
i
<
group
.
size
();
i
++)
{
int
expSize
=
expressionSQL
.
size
();
groupIndex
=
new
int
[
size
];
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Expression
expr
=
group
.
get
(
i
);
Expression
expr
=
group
.
get
(
i
);
String
sql
=
expr
.
getSQL
();
String
sql
=
expr
.
getSQL
();
int
found
=
-
1
;
int
found
=
-
1
;
for
(
int
j
=
0
;
j
<
exp
ressionSQL
.
size
()
;
j
++)
{
for
(
int
j
=
0
;
j
<
exp
Size
;
j
++)
{
String
s2
=
expressionSQL
.
get
(
j
);
String
s2
=
expressionSQL
.
get
(
j
);
if
(
s2
.
equals
(
sql
))
{
if
(
s2
.
equals
(
sql
))
{
found
=
j
;
found
=
j
;
...
@@ -710,7 +717,7 @@ public class Select extends Query {
...
@@ -710,7 +717,7 @@ public class Select extends Query {
}
}
if
(
found
<
0
)
{
if
(
found
<
0
)
{
// special case: GROUP BY a column alias
// special case: GROUP BY a column alias
for
(
int
j
=
0
;
j
<
exp
ressionSQL
.
size
()
;
j
++)
{
for
(
int
j
=
0
;
j
<
exp
Size
;
j
++)
{
Expression
e
=
expressions
.
get
(
j
);
Expression
e
=
expressions
.
get
(
j
);
if
(
sql
.
equals
(
e
.
getAlias
()))
{
if
(
sql
.
equals
(
e
.
getAlias
()))
{
found
=
j
;
found
=
j
;
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
645494c4
...
@@ -631,6 +631,7 @@ public class Session extends SessionWithState {
...
@@ -631,6 +631,7 @@ public class Session extends SessionWithState {
// MVCC: keep shared locks (insert / update / delete)
// MVCC: keep shared locks (insert / update / delete)
return
;
return
;
}
}
// locks is modified in the loop
for
(
int
i
=
0
;
i
<
locks
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
locks
.
size
();
i
++)
{
Table
t
=
locks
.
get
(
i
);
Table
t
=
locks
.
get
(
i
);
if
(!
t
.
isLockedExclusively
())
{
if
(!
t
.
isLockedExclusively
())
{
...
@@ -661,7 +662,7 @@ public class Session extends SessionWithState {
...
@@ -661,7 +662,7 @@ public class Session extends SessionWithState {
if
(
locks
.
size
()
>
0
)
{
if
(
locks
.
size
()
>
0
)
{
synchronized
(
database
)
{
synchronized
(
database
)
{
// don't use the enhance for loop to safe memory
// don't use the enhance for loop to safe memory
for
(
int
i
=
0
;
i
<
locks
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
locks
.
size
();
i
<
size
;
i
++)
{
Table
t
=
locks
.
get
(
i
);
Table
t
=
locks
.
get
(
i
);
t
.
unlock
(
this
);
t
.
unlock
(
this
);
}
}
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
645494c4
...
@@ -548,12 +548,14 @@ public class Aggregate extends Expression {
...
@@ -548,12 +548,14 @@ public class Aggregate extends Expression {
if
(
separator
!=
null
&&
!
separator
.
isEverything
(
visitor
))
{
if
(
separator
!=
null
&&
!
separator
.
isEverything
(
visitor
))
{
return
false
;
return
false
;
}
}
for
(
int
i
=
0
;
orderList
!=
null
&&
i
<
orderList
.
size
();
i
++)
{
if
(
orderList
!=
null
)
{
for
(
int
i
=
0
,
size
=
orderList
.
size
();
i
<
size
;
i
++)
{
SelectOrderBy
o
=
orderList
.
get
(
i
);
SelectOrderBy
o
=
orderList
.
get
(
i
);
if
(!
o
.
expression
.
isEverything
(
visitor
))
{
if
(!
o
.
expression
.
isEverything
(
visitor
))
{
return
false
;
return
false
;
}
}
}
}
}
return
true
;
return
true
;
}
}
...
...
h2/src/main/org/h2/expression/ConditionIn.java
浏览文件 @
645494c4
...
@@ -81,7 +81,8 @@ public class ConditionIn extends Condition {
...
@@ -81,7 +81,8 @@ public class ConditionIn extends Condition {
return
left
;
return
left
;
}
}
boolean
allValuesConstant
=
true
;
boolean
allValuesConstant
=
true
;
for
(
int
i
=
0
;
i
<
valueList
.
size
();
i
++)
{
int
size
=
valueList
.
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Expression
e
=
valueList
.
get
(
i
);
Expression
e
=
valueList
.
get
(
i
);
e
=
e
.
optimize
(
session
);
e
=
e
.
optimize
(
session
);
if
(
allValuesConstant
&&
!
e
.
isConstant
())
{
if
(
allValuesConstant
&&
!
e
.
isConstant
())
{
...
@@ -92,7 +93,7 @@ public class ConditionIn extends Condition {
...
@@ -92,7 +93,7 @@ public class ConditionIn extends Condition {
if
(
constant
&&
allValuesConstant
)
{
if
(
constant
&&
allValuesConstant
)
{
return
ValueExpression
.
get
(
getValue
(
session
));
return
ValueExpression
.
get
(
getValue
(
session
));
}
}
if
(
valueList
.
size
()
==
1
)
{
if
(
size
==
1
)
{
Expression
right
=
valueList
.
get
(
0
);
Expression
right
=
valueList
.
get
(
0
);
Expression
expr
=
new
Comparison
(
session
,
Comparison
.
EQUAL
,
left
,
right
);
Expression
expr
=
new
Comparison
(
session
,
Comparison
.
EQUAL
,
left
,
right
);
expr
=
expr
.
optimize
(
session
);
expr
=
expr
.
optimize
(
session
);
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
645494c4
...
@@ -146,7 +146,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -146,7 +146,7 @@ public class Function extends Expression implements FunctionCall {
// SOUNDEX_INDEX
// SOUNDEX_INDEX
String
index
=
"7AEIOUY8HW1BFPV2CGJKQSXZ3DT4L5MN6R"
;
String
index
=
"7AEIOUY8HW1BFPV2CGJKQSXZ3DT4L5MN6R"
;
char
number
=
0
;
char
number
=
0
;
for
(
int
i
=
0
;
i
<
index
.
length
()
;
i
++)
{
for
(
int
i
=
0
,
length
=
index
.
length
();
i
<
length
;
i
++)
{
char
c
=
index
.
charAt
(
i
);
char
c
=
index
.
charAt
(
i
);
if
(
c
<
'9'
)
{
if
(
c
<
'9'
)
{
number
=
c
;
number
=
c
;
...
...
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
645494c4
...
@@ -73,7 +73,7 @@ public class IndexCursor implements Cursor {
...
@@ -73,7 +73,7 @@ public class IndexCursor implements Cursor {
inResult
=
null
;
inResult
=
null
;
inResultTested
=
null
;
inResultTested
=
null
;
// don't use enhanced for loop to avoid creating objects
// don't use enhanced for loop to avoid creating objects
for
(
int
i
=
0
;
i
<
indexConditions
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
indexConditions
.
size
();
i
<
size
;
i
++)
{
IndexCondition
condition
=
indexConditions
.
get
(
i
);
IndexCondition
condition
=
indexConditions
.
get
(
i
);
if
(
condition
.
isAlwaysFalse
())
{
if
(
condition
.
isAlwaysFalse
())
{
alwaysFalse
=
true
;
alwaysFalse
=
true
;
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
645494c4
...
@@ -195,12 +195,14 @@ public class ViewIndex extends BaseIndex {
...
@@ -195,12 +195,14 @@ public class ViewIndex extends BaseIndex {
return
new
ViewCursor
(
table
,
result
);
return
new
ViewCursor
(
table
,
result
);
}
}
ArrayList
<
Parameter
>
paramList
=
query
.
getParameters
();
ArrayList
<
Parameter
>
paramList
=
query
.
getParameters
();
for
(
int
i
=
0
;
originalParameters
!=
null
&&
i
<
originalParameters
.
size
();
i
++)
{
if
(
originalParameters
!=
null
)
{
for
(
int
i
=
0
,
size
=
originalParameters
.
size
();
i
<
size
;
i
++)
{
Parameter
orig
=
originalParameters
.
get
(
i
);
Parameter
orig
=
originalParameters
.
get
(
i
);
int
idx
=
orig
.
getIndex
();
int
idx
=
orig
.
getIndex
();
Value
value
=
orig
.
getValue
(
session
);
Value
value
=
orig
.
getValue
(
session
);
setParameter
(
paramList
,
idx
,
value
);
setParameter
(
paramList
,
idx
,
value
);
}
}
}
int
len
;
int
len
;
if
(
first
!=
null
)
{
if
(
first
!=
null
)
{
len
=
first
.
getColumnCount
();
len
=
first
.
getColumnCount
();
...
...
h2/src/main/org/h2/result/RowList.java
浏览文件 @
645494c4
...
@@ -92,7 +92,7 @@ public class RowList {
...
@@ -92,7 +92,7 @@ public class RowList {
}
}
Data
buff
=
rowBuff
;
Data
buff
=
rowBuff
;
initBuffer
(
buff
);
initBuffer
(
buff
);
for
(
int
i
=
0
;
i
<
list
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
list
.
size
();
i
<
size
;
i
++)
{
if
(
i
>
0
&&
buff
.
length
()
>
Constants
.
IO_BUFFER_SIZE
)
{
if
(
i
>
0
&&
buff
.
length
()
>
Constants
.
IO_BUFFER_SIZE
)
{
flushBuffer
(
buff
);
flushBuffer
(
buff
);
initBuffer
(
buff
);
initBuffer
(
buff
);
...
...
h2/src/main/org/h2/security/SHA256.java
浏览文件 @
645494c4
...
@@ -64,7 +64,7 @@ public class SHA256 {
...
@@ -64,7 +64,7 @@ public class SHA256 {
String
user
=
userName
+
"@"
;
String
user
=
userName
+
"@"
;
byte
[]
buff
=
new
byte
[
2
*
(
user
.
length
()
+
password
.
length
)];
byte
[]
buff
=
new
byte
[
2
*
(
user
.
length
()
+
password
.
length
)];
int
n
=
0
;
int
n
=
0
;
for
(
int
i
=
0
;
i
<
user
.
length
()
;
i
++)
{
for
(
int
i
=
0
,
length
=
user
.
length
();
i
<
length
;
i
++)
{
char
c
=
user
.
charAt
(
i
);
char
c
=
user
.
charAt
(
i
);
buff
[
n
++]
=
(
byte
)
(
c
>>
8
);
buff
[
n
++]
=
(
byte
)
(
c
>>
8
);
buff
[
n
++]
=
(
byte
)
c
;
buff
[
n
++]
=
(
byte
)
c
;
...
...
h2/src/main/org/h2/store/PageLog.java
浏览文件 @
645494c4
...
@@ -517,8 +517,9 @@ public class PageLog {
...
@@ -517,8 +517,9 @@ public class PageLog {
}
}
Data
buffer
=
getBuffer
();
Data
buffer
=
getBuffer
();
buffer
.
writeByte
((
byte
)
FREE_LOG
);
buffer
.
writeByte
((
byte
)
FREE_LOG
);
buffer
.
writeVarInt
(
pages
.
size
());
int
size
=
pages
.
size
();
for
(
int
i
=
0
;
i
<
pages
.
size
();
i
++)
{
buffer
.
writeVarInt
(
size
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
buffer
.
writeVarInt
(
pages
.
get
(
i
));
buffer
.
writeVarInt
(
pages
.
get
(
i
));
}
}
write
(
buffer
);
write
(
buffer
);
...
...
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
645494c4
...
@@ -111,7 +111,7 @@ public class RegularTable extends TableBase {
...
@@ -111,7 +111,7 @@ public class RegularTable extends TableBase {
row
.
setSessionId
(
session
.
getId
());
row
.
setSessionId
(
session
.
getId
());
}
}
try
{
try
{
for
(
;
i
<
indexes
.
size
()
;
i
++)
{
for
(
int
size
=
indexes
.
size
();
i
<
size
;
i
++)
{
Index
index
=
indexes
.
get
(
i
);
Index
index
=
indexes
.
get
(
i
);
index
.
add
(
session
,
row
);
index
.
add
(
session
,
row
);
checkRowCount
(
session
,
index
,
1
);
checkRowCount
(
session
,
index
,
1
);
...
...
h2/src/main/org/h2/table/Table.java
浏览文件 @
645494c4
...
@@ -565,7 +565,8 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -565,7 +565,8 @@ public abstract class Table extends SchemaObjectBase {
item
.
setIndex
(
getScanIndex
(
session
));
item
.
setIndex
(
getScanIndex
(
session
));
item
.
cost
=
item
.
getIndex
().
getCost
(
session
,
null
);
item
.
cost
=
item
.
getIndex
().
getCost
(
session
,
null
);
ArrayList
<
Index
>
indexes
=
getIndexes
();
ArrayList
<
Index
>
indexes
=
getIndexes
();
for
(
int
i
=
1
;
indexes
!=
null
&&
masks
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
if
(
indexes
!=
null
&&
masks
!=
null
)
{
for
(
int
i
=
1
,
size
=
indexes
.
size
();
i
<
size
;
i
++)
{
Index
index
=
indexes
.
get
(
i
);
Index
index
=
indexes
.
get
(
i
);
double
cost
=
index
.
getCost
(
session
,
masks
);
double
cost
=
index
.
getCost
(
session
,
masks
);
if
(
cost
<
item
.
cost
)
{
if
(
cost
<
item
.
cost
)
{
...
@@ -573,6 +574,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -573,6 +574,7 @@ public abstract class Table extends SchemaObjectBase {
item
.
setIndex
(
index
);
item
.
setIndex
(
index
);
}
}
}
}
}
return
item
;
return
item
;
}
}
...
@@ -583,12 +585,14 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -583,12 +585,14 @@ public abstract class Table extends SchemaObjectBase {
*/
*/
public
Index
findPrimaryKey
()
{
public
Index
findPrimaryKey
()
{
ArrayList
<
Index
>
indexes
=
getIndexes
();
ArrayList
<
Index
>
indexes
=
getIndexes
();
for
(
int
i
=
0
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
if
(
indexes
!=
null
)
{
for
(
int
i
=
0
,
size
=
indexes
.
size
();
i
<
size
;
i
++)
{
Index
idx
=
indexes
.
get
(
i
);
Index
idx
=
indexes
.
get
(
i
);
if
(
idx
.
getIndexType
().
isPrimaryKey
())
{
if
(
idx
.
getIndexType
().
isPrimaryKey
())
{
return
idx
;
return
idx
;
}
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -797,7 +801,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -797,7 +801,7 @@ public abstract class Table extends SchemaObjectBase {
private
void
fireConstraints
(
Session
session
,
Row
oldRow
,
Row
newRow
,
boolean
before
)
{
private
void
fireConstraints
(
Session
session
,
Row
oldRow
,
Row
newRow
,
boolean
before
)
{
if
(
constraints
!=
null
)
{
if
(
constraints
!=
null
)
{
// don't use enhanced for loop to avoid creating objects
// don't use enhanced for loop to avoid creating objects
for
(
int
i
=
0
;
i
<
constraints
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
constraints
.
size
();
i
<
size
;
i
++)
{
Constraint
constraint
=
constraints
.
get
(
i
);
Constraint
constraint
=
constraints
.
get
(
i
);
if
(
constraint
.
isBefore
()
==
before
)
{
if
(
constraint
.
isBefore
()
==
before
)
{
constraint
.
checkRow
(
session
,
this
,
oldRow
,
newRow
);
constraint
.
checkRow
(
session
,
this
,
oldRow
,
newRow
);
...
@@ -856,11 +860,12 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -856,11 +860,12 @@ public abstract class Table extends SchemaObjectBase {
public
void
setCheckForeignKeyConstraints
(
Session
session
,
boolean
enabled
,
boolean
checkExisting
)
public
void
setCheckForeignKeyConstraints
(
Session
session
,
boolean
enabled
,
boolean
checkExisting
)
{
{
if
(
enabled
&&
checkExisting
)
{
if
(
enabled
&&
checkExisting
)
{
for
(
int
i
=
0
;
constraints
!=
null
&&
i
<
constraints
.
size
();
i
++
)
{
if
(
constraints
!=
null
)
{
Constraint
c
=
constraints
.
get
(
i
);
for
(
Constraint
c
:
constraints
)
{
c
.
checkExistingData
(
session
);
c
.
checkExistingData
(
session
);
}
}
}
}
}
checkForeignKeyConstraints
=
enabled
;
checkForeignKeyConstraints
=
enabled
;
}
}
...
@@ -878,7 +883,8 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -878,7 +883,8 @@ public abstract class Table extends SchemaObjectBase {
*/
*/
public
Index
getIndexForColumn
(
Column
column
,
boolean
first
)
{
public
Index
getIndexForColumn
(
Column
column
,
boolean
first
)
{
ArrayList
<
Index
>
indexes
=
getIndexes
();
ArrayList
<
Index
>
indexes
=
getIndexes
();
for
(
int
i
=
1
;
indexes
!=
null
&&
i
<
indexes
.
size
();
i
++)
{
if
(
indexes
!=
null
)
{
for
(
int
i
=
1
,
size
=
indexes
.
size
();
i
<
size
;
i
++)
{
Index
index
=
indexes
.
get
(
i
);
Index
index
=
indexes
.
get
(
i
);
if
(
index
.
canGetFirstOrLast
())
{
if
(
index
.
canGetFirstOrLast
())
{
int
idx
=
index
.
getColumnIndex
(
column
);
int
idx
=
index
.
getColumnIndex
(
column
);
...
@@ -887,6 +893,7 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -887,6 +893,7 @@ public abstract class Table extends SchemaObjectBase {
}
}
}
}
}
}
}
return
null
;
return
null
;
}
}
...
@@ -915,14 +922,15 @@ public abstract class Table extends SchemaObjectBase {
...
@@ -915,14 +922,15 @@ public abstract class Table extends SchemaObjectBase {
*/
*/
public
void
removeIndexOrTransferOwnership
(
Session
session
,
Index
index
)
{
public
void
removeIndexOrTransferOwnership
(
Session
session
,
Index
index
)
{
boolean
stillNeeded
=
false
;
boolean
stillNeeded
=
false
;
for
(
int
i
=
0
;
constraints
!=
null
&&
i
<
constraints
.
size
();
i
++
)
{
if
(
constraints
!=
null
)
{
Constraint
cons
=
constraints
.
get
(
i
);
for
(
Constraint
cons
:
constraints
)
{
if
(
cons
.
usesIndex
(
index
))
{
if
(
cons
.
usesIndex
(
index
))
{
cons
.
setIndexOwner
(
index
);
cons
.
setIndexOwner
(
index
);
database
.
update
(
session
,
cons
);
database
.
update
(
session
,
cons
);
stillNeeded
=
true
;
stillNeeded
=
true
;
}
}
}
}
}
if
(!
stillNeeded
)
{
if
(!
stillNeeded
)
{
database
.
removeSchemaObject
(
session
,
index
);
database
.
removeSchemaObject
(
session
,
index
);
}
}
...
...
h2/src/main/org/h2/tools/Csv.java
浏览文件 @
645494c4
...
@@ -289,8 +289,9 @@ public class Csv implements SimpleRowSource {
...
@@ -289,8 +289,9 @@ public class Csv implements SimpleRowSource {
return
data
;
return
data
;
}
}
}
}
StringBuilder
buff
=
new
StringBuilder
(
data
.
length
());
int
length
=
data
.
length
();
for
(
int
i
=
0
;
i
<
data
.
length
();
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
ch
=
data
.
charAt
(
i
);
char
ch
=
data
.
charAt
(
i
);
if
(
ch
==
fieldDelimiter
||
ch
==
escapeCharacter
)
{
if
(
ch
==
fieldDelimiter
||
ch
==
escapeCharacter
)
{
buff
.
append
(
escapeCharacter
);
buff
.
append
(
escapeCharacter
);
...
@@ -357,7 +358,7 @@ public class Csv implements SimpleRowSource {
...
@@ -357,7 +358,7 @@ public class Csv implements SimpleRowSource {
}
}
private
boolean
isSimpleColumnName
(
String
columnName
)
{
private
boolean
isSimpleColumnName
(
String
columnName
)
{
for
(
int
i
=
0
;
i
<
columnName
.
length
()
;
i
++)
{
for
(
int
i
=
0
,
length
=
columnName
.
length
();
i
<
length
;
i
++)
{
char
ch
=
columnName
.
charAt
(
i
);
char
ch
=
columnName
.
charAt
(
i
);
if
(
i
==
0
)
{
if
(
i
==
0
)
{
if
(
ch
!=
'_'
&&
!
Character
.
isLetter
(
ch
))
{
if
(
ch
!=
'_'
&&
!
Character
.
isLetter
(
ch
))
{
...
...
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
645494c4
...
@@ -173,18 +173,19 @@ public class CacheLRU implements Cache {
...
@@ -173,18 +173,19 @@ public class CacheLRU implements Cache {
}
}
Collections
.
sort
(
changed
);
Collections
.
sort
(
changed
);
int
max
=
maxMemory
;
int
max
=
maxMemory
;
int
size
=
changed
.
size
();
try
{
try
{
// temporary disable size checking,
// temporary disable size checking,
// to avoid stack overflow
// to avoid stack overflow
maxMemory
=
Integer
.
MAX_VALUE
;
maxMemory
=
Integer
.
MAX_VALUE
;
for
(
i
=
0
;
i
<
changed
.
size
()
;
i
++)
{
for
(
i
=
0
;
i
<
size
;
i
++)
{
CacheObject
rec
=
changed
.
get
(
i
);
CacheObject
rec
=
changed
.
get
(
i
);
writer
.
writeBack
(
rec
);
writer
.
writeBack
(
rec
);
}
}
}
finally
{
}
finally
{
maxMemory
=
max
;
maxMemory
=
max
;
}
}
for
(
i
=
0
;
i
<
changed
.
size
()
;
i
++)
{
for
(
i
=
0
;
i
<
size
;
i
++)
{
CacheObject
rec
=
changed
.
get
(
i
);
CacheObject
rec
=
changed
.
get
(
i
);
remove
(
rec
.
getPos
());
remove
(
rec
.
getPos
());
if
(
SysProperties
.
CHECK
)
{
if
(
SysProperties
.
CHECK
)
{
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
645494c4
...
@@ -108,9 +108,10 @@ public class StringUtils {
...
@@ -108,9 +108,10 @@ public class StringUtils {
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
"NULL"
;
return
"NULL"
;
}
}
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
()
+
2
);
int
length
=
s
.
length
();
StringBuilder
buff
=
new
StringBuilder
(
length
+
2
);
buff
.
append
(
'\''
);
buff
.
append
(
'\''
);
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
if
(
c
==
'\''
)
{
if
(
c
==
'\''
)
{
buff
.
append
(
c
);
buff
.
append
(
c
);
...
@@ -134,8 +135,9 @@ public class StringUtils {
...
@@ -134,8 +135,9 @@ public class StringUtils {
* @return the Java representation
* @return the Java representation
*/
*/
public
static
String
javaEncode
(
String
s
)
{
public
static
String
javaEncode
(
String
s
)
{
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
());
int
length
=
s
.
length
();
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
switch
(
c
)
{
switch
(
c
)
{
// case '\b':
// case '\b':
...
@@ -213,8 +215,9 @@ public class StringUtils {
...
@@ -213,8 +215,9 @@ public class StringUtils {
* @return the string
* @return the string
*/
*/
public
static
String
javaDecode
(
String
s
)
{
public
static
String
javaDecode
(
String
s
)
{
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
());
int
length
=
s
.
length
();
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
if
(
c
==
'"'
)
{
if
(
c
==
'"'
)
{
break
;
break
;
...
@@ -449,9 +452,10 @@ public class StringUtils {
...
@@ -449,9 +452,10 @@ public class StringUtils {
* @return the decoded string
* @return the decoded string
*/
*/
public
static
String
urlDecode
(
String
encoded
)
{
public
static
String
urlDecode
(
String
encoded
)
{
byte
[]
buff
=
new
byte
[
encoded
.
length
()];
int
length
=
encoded
.
length
();
byte
[]
buff
=
new
byte
[
length
];
int
j
=
0
;
int
j
=
0
;
for
(
int
i
=
0
;
i
<
encoded
.
length
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
ch
=
encoded
.
charAt
(
i
);
char
ch
=
encoded
.
charAt
(
i
);
if
(
ch
==
'+'
)
{
if
(
ch
==
'+'
)
{
buff
[
j
++]
=
' '
;
buff
[
j
++]
=
' '
;
...
@@ -485,18 +489,19 @@ public class StringUtils {
...
@@ -485,18 +489,19 @@ public class StringUtils {
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
null
;
return
null
;
}
}
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
new
String
[
0
];
return
new
String
[
0
];
}
}
ArrayList
<
String
>
list
=
New
.
arrayList
();
ArrayList
<
String
>
list
=
New
.
arrayList
();
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
()
);
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
if
(
c
==
separatorChar
)
{
if
(
c
==
separatorChar
)
{
String
e
=
buff
.
toString
();
String
e
=
buff
.
toString
();
list
.
add
(
trim
?
e
.
trim
()
:
e
);
list
.
add
(
trim
?
e
.
trim
()
:
e
);
buff
.
setLength
(
0
);
buff
.
setLength
(
0
);
}
else
if
(
c
==
'\\'
&&
i
<
s
.
length
()
-
1
)
{
}
else
if
(
c
==
'\\'
&&
i
<
length
-
1
)
{
buff
.
append
(
s
.
charAt
(++
i
));
buff
.
append
(
s
.
charAt
(++
i
));
}
else
{
}
else
{
buff
.
append
(
c
);
buff
.
append
(
c
);
...
@@ -525,7 +530,7 @@ public class StringUtils {
...
@@ -525,7 +530,7 @@ public class StringUtils {
if
(
s
==
null
)
{
if
(
s
==
null
)
{
s
=
""
;
s
=
""
;
}
}
for
(
int
j
=
0
;
j
<
s
.
length
()
;
j
++)
{
for
(
int
j
=
0
,
length
=
s
.
length
();
j
<
length
;
j
++)
{
char
c
=
s
.
charAt
(
j
);
char
c
=
s
.
charAt
(
j
);
if
(
c
==
'\\'
||
c
==
separatorChar
)
{
if
(
c
==
'\\'
||
c
==
separatorChar
)
{
buff
.
append
(
'\\'
);
buff
.
append
(
'\\'
);
...
@@ -656,8 +661,9 @@ public class StringUtils {
...
@@ -656,8 +661,9 @@ public class StringUtils {
* @return the escaped text
* @return the escaped text
*/
*/
public
static
String
xmlText
(
String
text
)
{
public
static
String
xmlText
(
String
text
)
{
StringBuilder
buff
=
new
StringBuilder
(
text
.
length
());
int
length
=
text
.
length
();
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
ch
=
text
.
charAt
(
i
);
char
ch
=
text
.
charAt
(
i
);
switch
(
ch
)
{
switch
(
ch
)
{
case
'<'
:
case
'<'
:
...
@@ -745,9 +751,10 @@ public class StringUtils {
...
@@ -745,9 +751,10 @@ public class StringUtils {
* @return the double quoted text
* @return the double quoted text
*/
*/
public
static
String
quoteIdentifier
(
String
s
)
{
public
static
String
quoteIdentifier
(
String
s
)
{
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
()
+
2
);
int
length
=
s
.
length
();
StringBuilder
buff
=
new
StringBuilder
(
length
+
2
);
buff
.
append
(
'\"'
);
buff
.
append
(
'\"'
);
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
if
(
c
==
'"'
)
{
if
(
c
==
'"'
)
{
buff
.
append
(
c
);
buff
.
append
(
c
);
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
645494c4
...
@@ -351,7 +351,7 @@ public class DataType {
...
@@ -351,7 +351,7 @@ public class DataType {
new
String
[]{
"RESULT_SET"
},
new
String
[]{
"RESULT_SET"
},
400
400
);
);
for
(
int
i
=
0
;
i
<
TYPES_BY_VALUE_TYPE
.
size
()
;
i
++)
{
for
(
int
i
=
0
,
size
=
TYPES_BY_VALUE_TYPE
.
size
();
i
<
size
;
i
++)
{
DataType
dt
=
TYPES_BY_VALUE_TYPE
.
get
(
i
);
DataType
dt
=
TYPES_BY_VALUE_TYPE
.
get
(
i
);
if
(
dt
==
null
)
{
if
(
dt
==
null
)
{
DbException
.
throwInternalError
(
"unmapped type "
+
i
);
DbException
.
throwInternalError
(
"unmapped type "
+
i
);
...
...
h2/src/main/org/h2/value/ValueUuid.java
浏览文件 @
645494c4
...
@@ -90,7 +90,7 @@ public class ValueUuid extends Value {
...
@@ -90,7 +90,7 @@ public class ValueUuid extends Value {
*/
*/
public
static
ValueUuid
get
(
String
s
)
{
public
static
ValueUuid
get
(
String
s
)
{
long
low
=
0
,
high
=
0
;
long
low
=
0
,
high
=
0
;
for
(
int
i
=
0
,
j
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
0
,
j
=
0
,
length
=
s
.
length
();
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
char
c
=
s
.
charAt
(
i
);
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
if
(
c
>=
'0'
&&
c
<=
'9'
)
{
low
=
(
low
<<
4
)
|
(
c
-
'0'
);
low
=
(
low
<<
4
)
|
(
c
-
'0'
);
...
...
h2/src/test/org/h2/test/db/TestRunscript.java
浏览文件 @
645494c4
...
@@ -43,11 +43,11 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -43,11 +43,11 @@ public class TestRunscript extends TestBase implements Trigger {
Connection
conn
;
Connection
conn
;
conn
=
getConnection
(
"runscript"
);
conn
=
getConnection
(
"runscript"
);
final
Statement
stat
=
conn
.
createStatement
();
final
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key) as select x from system_range(1,
1
0000)"
);
stat
.
execute
(
"create table test(id int primary key) as select x from system_range(1,
2
0000)"
);
stat
.
execute
(
"script simple drop to '"
+
getBaseDir
()+
"/backup.sql'"
);
stat
.
execute
(
"script simple drop to '"
+
getBaseDir
()+
"/backup.sql'"
);
stat
.
execute
(
"set throttle 1000"
);
stat
.
execute
(
"set throttle 1000"
);
// need to wait a bit (throttle is only used every 50 ms)
// need to wait a bit (throttle is only used every 50 ms)
Thread
.
sleep
(
1
00
);
Thread
.
sleep
(
2
00
);
final
String
dir
=
getBaseDir
();
final
String
dir
=
getBaseDir
();
final
SQLException
[]
ex
=
new
SQLException
[
1
];
final
SQLException
[]
ex
=
new
SQLException
[
1
];
Thread
thread
;
Thread
thread
;
...
@@ -62,7 +62,7 @@ public class TestRunscript extends TestBase implements Trigger {
...
@@ -62,7 +62,7 @@ public class TestRunscript extends TestBase implements Trigger {
}
}
};
};
thread
.
start
();
thread
.
start
();
Thread
.
sleep
(
1
00
);
Thread
.
sleep
(
2
00
);
stat
.
cancel
();
stat
.
cancel
();
thread
.
join
();
thread
.
join
();
e
=
ex
[
0
];
e
=
ex
[
0
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论