Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ed6735a0
Unverified
提交
ed6735a0
authored
5月 20, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
5月 20, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1147 from katzyn/misc
Assorted minor optimizations
上级
07e67c2d
d32637cc
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
68 行增加
和
89 行删除
+68
-89
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+1
-1
Select.java
h2/src/main/org/h2/command/dml/Select.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+1
-1
FullTextSettings.java
h2/src/main/org/h2/fulltext/FullTextSettings.java
+3
-3
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+1
-2
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+1
-2
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+1
-1
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+2
-2
TcpServer.java
h2/src/main/org/h2/server/TcpServer.java
+3
-2
FilePath.java
h2/src/main/org/h2/store/fs/FilePath.java
+3
-6
SynchronizedVerifier.java
h2/src/main/org/h2/util/SynchronizedVerifier.java
+3
-8
ToDateParser.java
h2/src/main/org/h2/util/ToDateParser.java
+1
-1
ToDateTokenizer.java
h2/src/main/org/h2/util/ToDateTokenizer.java
+34
-45
CachedPreparedStatements.java
h2/src/test/org/h2/samples/CachedPreparedStatements.java
+2
-6
TriggerPassData.java
h2/src/test/org/h2/samples/TriggerPassData.java
+3
-5
TestFuzzOptimizations.java
h2/src/test/org/h2/test/synth/TestFuzzOptimizations.java
+6
-1
SQLDialect.java
h2/src/tools/org/h2/jaqu/SQLDialect.java
+2
-2
没有找到文件。
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
ed6735a0
...
@@ -415,7 +415,7 @@ public class Insert extends Prepared implements ResultTarget {
...
@@ -415,7 +415,7 @@ public class Insert extends Prepared implements ResultTarget {
for
(
Column
column
:
duplicateKeyAssignmentMap
.
keySet
())
{
for
(
Column
column
:
duplicateKeyAssignmentMap
.
keySet
())
{
buff
.
appendExceptFirst
(
", "
);
buff
.
appendExceptFirst
(
", "
);
Expression
ex
=
duplicateKeyAssignmentMap
.
get
(
column
);
Expression
ex
=
duplicateKeyAssignmentMap
.
get
(
column
);
buff
.
append
(
column
.
getSQL
()).
append
(
"="
).
append
(
ex
.
getSQL
());
buff
.
append
(
column
.
getSQL
()).
append
(
'='
).
append
(
ex
.
getSQL
());
}
}
buff
.
append
(
" WHERE "
);
buff
.
append
(
" WHERE "
);
Index
foundIndex
=
(
Index
)
de
.
getSource
();
Index
foundIndex
=
(
Index
)
de
.
getSource
();
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
ed6735a0
...
@@ -1164,7 +1164,7 @@ public class Select extends Query {
...
@@ -1164,7 +1164,7 @@ public class Select extends Query {
buff
.
appendExceptFirst
(
","
);
buff
.
appendExceptFirst
(
","
);
buff
.
append
(
c
.
getName
());
buff
.
append
(
c
.
getName
());
}
}
buff
.
append
(
") AS "
).
append
(
t
.
getSQL
()).
append
(
"\n"
);
buff
.
append
(
") AS "
).
append
(
t
.
getSQL
()).
append
(
'\n'
);
}
}
}
}
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
ed6735a0
...
@@ -2492,7 +2492,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -2492,7 +2492,7 @@ public class Function extends Expression implements FunctionCall {
StatementBuilder
buff
=
new
StatementBuilder
(
info
.
name
);
StatementBuilder
buff
=
new
StatementBuilder
(
info
.
name
);
if
(
info
.
type
==
CASE
)
{
if
(
info
.
type
==
CASE
)
{
if
(
args
[
0
]
!=
null
)
{
if
(
args
[
0
]
!=
null
)
{
buff
.
append
(
" "
).
append
(
args
[
0
].
getSQL
());
buff
.
append
(
' '
).
append
(
args
[
0
].
getSQL
());
}
}
for
(
int
i
=
1
,
len
=
args
.
length
-
1
;
i
<
len
;
i
+=
2
)
{
for
(
int
i
=
1
,
len
=
args
.
length
-
1
;
i
<
len
;
i
+=
2
)
{
buff
.
append
(
" WHEN "
).
append
(
args
[
i
].
getSQL
());
buff
.
append
(
" WHEN "
).
append
(
args
[
i
].
getSQL
());
...
...
h2/src/main/org/h2/fulltext/FullTextSettings.java
浏览文件 @
ed6735a0
...
@@ -10,11 +10,12 @@ import java.sql.PreparedStatement;
...
@@ -10,11 +10,12 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.h2.util.SoftHashMap
;
import
org.h2.util.SoftHashMap
;
/**
/**
...
@@ -45,8 +46,7 @@ final class FullTextSettings {
...
@@ -45,8 +46,7 @@ final class FullTextSettings {
/**
/**
* The set of indexes in this database.
* The set of indexes in this database.
*/
*/
private
final
Map
<
Integer
,
IndexInfo
>
indexes
=
Collections
private
final
ConcurrentHashMap
<
Integer
,
IndexInfo
>
indexes
=
new
ConcurrentHashMap
<>();
.
synchronizedMap
(
new
HashMap
<
Integer
,
IndexInfo
>());
/**
/**
* The prepared statement cache.
* The prepared statement cache.
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
ed6735a0
...
@@ -491,8 +491,7 @@ public class PageDataIndex extends PageIndex {
...
@@ -491,8 +491,7 @@ public class PageDataIndex extends PageIndex {
Iterator
<
Row
>
getDelta
()
{
Iterator
<
Row
>
getDelta
()
{
if
(
delta
==
null
)
{
if
(
delta
==
null
)
{
List
<
Row
>
e
=
Collections
.
emptyList
();
return
Collections
.
emptyIterator
();
return
e
.
iterator
();
}
}
return
delta
.
iterator
();
return
delta
.
iterator
();
}
}
...
...
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
ed6735a0
...
@@ -251,8 +251,7 @@ public class ScanIndex extends BaseIndex {
...
@@ -251,8 +251,7 @@ public class ScanIndex extends BaseIndex {
Iterator
<
Row
>
getDelta
()
{
Iterator
<
Row
>
getDelta
()
{
if
(
delta
==
null
)
{
if
(
delta
==
null
)
{
List
<
Row
>
e
=
Collections
.
emptyList
();
return
Collections
.
emptyIterator
();
return
e
.
iterator
();
}
}
return
delta
.
iterator
();
return
delta
.
iterator
();
}
}
...
...
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
ed6735a0
...
@@ -258,7 +258,7 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -258,7 +258,7 @@ public class MVPrimaryIndex extends BaseIndex {
ValueLong
v
=
(
ValueLong
)
(
first
?
map
.
firstKey
()
:
map
.
lastKey
());
ValueLong
v
=
(
ValueLong
)
(
first
?
map
.
firstKey
()
:
map
.
lastKey
());
if
(
v
==
null
)
{
if
(
v
==
null
)
{
return
new
MVStoreCursor
(
session
,
return
new
MVStoreCursor
(
session
,
Collections
.<
Entry
<
Value
,
Value
>>
empty
List
().
i
terator
());
Collections
.<
Entry
<
Value
,
Value
>>
empty
I
terator
());
}
}
Value
value
=
map
.
get
(
v
);
Value
value
=
map
.
get
(
v
);
Entry
<
Value
,
Value
>
e
=
new
AbstractMap
.
SimpleImmutableEntry
<
Value
,
Value
>(
v
,
value
);
Entry
<
Value
,
Value
>
e
=
new
AbstractMap
.
SimpleImmutableEntry
<
Value
,
Value
>(
v
,
value
);
...
...
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
ed6735a0
...
@@ -307,7 +307,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -307,7 +307,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
}
}
if
(
min
==
null
)
{
if
(
min
==
null
)
{
return
new
MVStoreCursor
(
session
,
return
new
MVStoreCursor
(
session
,
Collections
.<
Value
>
empty
List
().
i
terator
(),
null
);
Collections
.<
Value
>
empty
I
terator
(),
null
);
}
}
}
}
return
new
MVStoreCursor
(
session
,
map
.
keyIterator
(
min
),
last
);
return
new
MVStoreCursor
(
session
,
map
.
keyIterator
(
min
),
last
);
...
@@ -394,7 +394,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -394,7 +394,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
while
(
true
)
{
while
(
true
)
{
if
(
key
==
null
)
{
if
(
key
==
null
)
{
return
new
MVStoreCursor
(
session
,
return
new
MVStoreCursor
(
session
,
Collections
.<
Value
>
empty
List
().
i
terator
(),
null
);
Collections
.<
Value
>
empty
I
terator
(),
null
);
}
}
if
(((
ValueArray
)
key
).
getList
()[
0
]
!=
ValueNull
.
INSTANCE
)
{
if
(((
ValueArray
)
key
).
getList
()[
0
]
!=
ValueNull
.
INSTANCE
)
{
break
;
break
;
...
...
h2/src/main/org/h2/server/TcpServer.java
浏览文件 @
ed6735a0
...
@@ -21,6 +21,8 @@ import java.util.HashSet;
...
@@ -21,6 +21,8 @@ import java.util.HashSet;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.h2.Driver
;
import
org.h2.Driver
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
...
@@ -49,8 +51,7 @@ public class TcpServer implements Service {
...
@@ -49,8 +51,7 @@ public class TcpServer implements Service {
*/
*/
private
static
final
String
MANAGEMENT_DB_PREFIX
=
"management_db_"
;
private
static
final
String
MANAGEMENT_DB_PREFIX
=
"management_db_"
;
private
static
final
Map
<
Integer
,
TcpServer
>
SERVERS
=
private
static
final
ConcurrentHashMap
<
Integer
,
TcpServer
>
SERVERS
=
new
ConcurrentHashMap
<>();
Collections
.
synchronizedMap
(
new
HashMap
<
Integer
,
TcpServer
>());
private
int
port
;
private
int
port
;
private
boolean
portIsSet
;
private
boolean
portIsSet
;
...
...
h2/src/main/org/h2/store/fs/FilePath.java
浏览文件 @
ed6735a0
...
@@ -9,10 +9,8 @@ import java.io.IOException;
...
@@ -9,10 +9,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileChannel
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.
concurrent.ConcurrentHash
Map
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
/**
/**
...
@@ -25,7 +23,7 @@ public abstract class FilePath {
...
@@ -25,7 +23,7 @@ public abstract class FilePath {
private
static
FilePath
defaultProvider
;
private
static
FilePath
defaultProvider
;
private
static
Map
<
String
,
FilePath
>
providers
;
private
static
ConcurrentHash
Map
<
String
,
FilePath
>
providers
;
/**
/**
* The prefix for temporary files.
* The prefix for temporary files.
...
@@ -66,8 +64,7 @@ public abstract class FilePath {
...
@@ -66,8 +64,7 @@ public abstract class FilePath {
private
static
void
registerDefaultProviders
()
{
private
static
void
registerDefaultProviders
()
{
if
(
providers
==
null
||
defaultProvider
==
null
)
{
if
(
providers
==
null
||
defaultProvider
==
null
)
{
Map
<
String
,
FilePath
>
map
=
Collections
.
synchronizedMap
(
ConcurrentHashMap
<
String
,
FilePath
>
map
=
new
ConcurrentHashMap
<>();
new
HashMap
<
String
,
FilePath
>());
for
(
String
c
:
new
String
[]
{
for
(
String
c
:
new
String
[]
{
"org.h2.store.fs.FilePathDisk"
,
"org.h2.store.fs.FilePathDisk"
,
"org.h2.store.fs.FilePathMem"
,
"org.h2.store.fs.FilePathMem"
,
...
...
h2/src/main/org/h2/util/SynchronizedVerifier.java
浏览文件 @
ed6735a0
...
@@ -5,10 +5,7 @@
...
@@ -5,10 +5,7 @@
*/
*/
package
org
.
h2
.
util
;
package
org
.
h2
.
util
;
import
java.util.Collections
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.HashMap
;
import
java.util.IdentityHashMap
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicBoolean
;
/**
/**
...
@@ -17,10 +14,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
...
@@ -17,10 +14,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
public
class
SynchronizedVerifier
{
public
class
SynchronizedVerifier
{
private
static
volatile
boolean
enabled
;
private
static
volatile
boolean
enabled
;
private
static
final
Map
<
Class
<?>,
AtomicBoolean
>
DETECT
=
private
static
final
ConcurrentHashMap
<
Class
<?>,
AtomicBoolean
>
DETECT
=
new
ConcurrentHashMap
<>();
Collections
.
synchronizedMap
(
new
HashMap
<
Class
<?>,
AtomicBoolean
>());
private
static
final
ConcurrentHashMap
<
Object
,
Object
>
CURRENT
=
new
ConcurrentHashMap
<>();
private
static
final
Map
<
Object
,
Object
>
CURRENT
=
Collections
.
synchronizedMap
(
new
IdentityHashMap
<>());
/**
/**
* Enable or disable detection for a given class.
* Enable or disable detection for a given class.
...
...
h2/src/main/org/h2/util/ToDateParser.java
浏览文件 @
ed6735a0
...
@@ -265,7 +265,7 @@ public class ToDateParser {
...
@@ -265,7 +265,7 @@ public class ToDateParser {
while
(
p
.
hasToParseData
())
{
while
(
p
.
hasToParseData
())
{
List
<
ToDateTokenizer
.
FormatTokenEnum
>
tokenList
=
List
<
ToDateTokenizer
.
FormatTokenEnum
>
tokenList
=
ToDateTokenizer
.
FormatTokenEnum
.
getTokensInQuestion
(
p
.
getFormatStr
());
ToDateTokenizer
.
FormatTokenEnum
.
getTokensInQuestion
(
p
.
getFormatStr
());
if
(
tokenList
.
isEmpty
()
)
{
if
(
tokenList
==
null
)
{
p
.
removeFirstChar
();
p
.
removeFirstChar
();
continue
;
continue
;
}
}
...
...
h2/src/main/org/h2/util/ToDateTokenizer.java
浏览文件 @
ed6735a0
...
@@ -9,9 +9,7 @@ import static java.lang.String.format;
...
@@ -9,9 +9,7 @@ import static java.lang.String.format;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TimeZone
;
import
java.util.TimeZone
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -616,10 +614,9 @@ class ToDateTokenizer {
...
@@ -616,10 +614,9 @@ class ToDateTokenizer {
// where "T" and "Z" are inlined
// where "T" and "Z" are inlined
INLINE
(
PARSLET_INLINE
,
PATTERN_INLINE
);
INLINE
(
PARSLET_INLINE
,
PATTERN_INLINE
);
private
static
final
List
<
FormatTokenEnum
>
EMPTY_LIST
=
Collections
private
static
final
List
<
FormatTokenEnum
>
INLINE_LIST
=
Collections
.
singletonList
(
INLINE
);
.
emptyList
();
private
static
final
Map
<
Character
,
List
<
FormatTokenEnum
>>
CACHE
=
new
HashMap
<>(
64
)
;
private
static
List
<
FormatTokenEnum
>[]
TOKENS
;
private
final
ToDateParslet
toDateParslet
;
private
final
ToDateParslet
toDateParslet
;
private
final
Pattern
patternToUse
;
private
final
Pattern
patternToUse
;
...
@@ -648,59 +645,51 @@ class ToDateTokenizer {
...
@@ -648,59 +645,51 @@ class ToDateTokenizer {
/**
/**
* Optimization: Only return a list of {@link FormatTokenEnum} that
* Optimization: Only return a list of {@link FormatTokenEnum} that
* share the same 1st char using the 1st char of the 'to parse'
* share the same 1st char using the 1st char of the 'to parse'
* formatStr. Or return
empty list
if no match.
* formatStr. Or return
{@code null}
if no match.
*
*
* @param formatStr the format string
* @param formatStr the format string
* @return the list of tokens
* @return the list of tokens
, or {@code null}
*/
*/
static
List
<
FormatTokenEnum
>
getTokensInQuestion
(
String
formatStr
)
{
static
List
<
FormatTokenEnum
>
getTokensInQuestion
(
String
formatStr
)
{
List
<
FormatTokenEnum
>
result
=
EMPTY_LIST
;
if
(
CACHE
.
size
()
<=
0
)
{
initCache
();
}
if
(
formatStr
!=
null
&&
formatStr
.
length
()
>
0
)
{
if
(
formatStr
!=
null
&&
formatStr
.
length
()
>
0
)
{
Character
key
=
Character
.
toUpperCase
(
formatStr
.
charAt
(
0
));
char
key
=
Character
.
toUpperCase
(
formatStr
.
charAt
(
0
));
switch
(
key
)
{
if
(
key
>=
'A'
&&
key
<=
'Y'
)
{
case
'"'
:
List
<
FormatTokenEnum
>[]
tokens
=
TOKENS
;
result
=
new
ArrayList
<>();
if
(
tokens
==
null
)
{
result
.
add
(
INLINE
);
tokens
=
initTokens
();
break
;
}
default
:
return
tokens
[
key
-
'A'
];
result
=
CACHE
.
get
(
key
);
}
else
if
(
key
==
'"'
)
{
return
INLINE_LIST
;
}
}
}
}
if
(
result
==
null
)
{
return
null
;
result
=
EMPTY_LIST
;
}
return
result
;
}
}
private
static
synchronized
void
initCache
()
{
@SuppressWarnings
(
"unchecked"
)
if
(
CACHE
.
size
()
<=
0
)
{
private
static
List
<
FormatTokenEnum
>[]
initTokens
()
{
for
(
FormatTokenEnum
token
:
FormatTokenEnum
.
values
())
{
List
<
FormatTokenEnum
>[]
tokens
=
new
List
[
25
];
for
(
FormatTokenEnum
token
:
FormatTokenEnum
.
values
())
{
List
<
Character
>
tokenKeys
=
new
ArrayList
<>();
String
name
=
token
.
name
();
if
(
name
.
indexOf
(
'_'
)
>=
0
)
{
if
(
token
.
name
().
contains
(
"_"
))
{
for
(
String
tokenLets
:
name
.
split
(
"_"
))
{
String
[]
tokens
=
token
.
name
().
split
(
"_"
);
putToCache
(
tokens
,
token
,
tokenLets
);
for
(
String
tokenLets
:
tokens
)
{
tokenKeys
.
add
(
tokenLets
.
toUpperCase
().
charAt
(
0
));
}
}
else
{
tokenKeys
.
add
(
token
.
name
().
toUpperCase
().
charAt
(
0
));
}
for
(
Character
tokenKey
:
tokenKeys
)
{
List
<
FormatTokenEnum
>
l
=
CACHE
.
get
(
tokenKey
);
if
(
l
==
null
)
{
l
=
new
ArrayList
<>(
1
);
CACHE
.
put
(
tokenKey
,
l
);
}
l
.
add
(
token
);
}
}
}
else
{
putToCache
(
tokens
,
token
,
name
);
}
}
}
}
return
TOKENS
=
tokens
;
}
private
static
void
putToCache
(
List
<
FormatTokenEnum
>[]
cache
,
FormatTokenEnum
token
,
String
name
)
{
int
idx
=
Character
.
toUpperCase
(
name
.
charAt
(
0
))
-
'A'
;
List
<
FormatTokenEnum
>
l
=
cache
[
idx
];
if
(
l
==
null
)
{
l
=
new
ArrayList
<>(
1
);
cache
[
idx
]
=
l
;
}
l
.
add
(
token
);
}
}
/**
/**
...
...
h2/src/test/org/h2/samples/CachedPreparedStatements.java
浏览文件 @
ed6735a0
...
@@ -10,9 +10,7 @@ import java.sql.DriverManager;
...
@@ -10,9 +10,7 @@ import java.sql.DriverManager;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.Collections
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* This sample application shows how to cache prepared statements.
* This sample application shows how to cache prepared statements.
...
@@ -21,9 +19,7 @@ public class CachedPreparedStatements {
...
@@ -21,9 +19,7 @@ public class CachedPreparedStatements {
private
Connection
conn
;
private
Connection
conn
;
private
Statement
stat
;
private
Statement
stat
;
private
final
Map
<
String
,
PreparedStatement
>
prepared
=
private
final
ConcurrentHashMap
<
String
,
PreparedStatement
>
prepared
=
new
ConcurrentHashMap
<>();
Collections
.
synchronizedMap
(
new
HashMap
<
String
,
PreparedStatement
>());
/**
/**
* This method is called when executing this sample application from the
* This method is called when executing this sample application from the
...
...
h2/src/test/org/h2/samples/TriggerPassData.java
浏览文件 @
ed6735a0
...
@@ -10,9 +10,8 @@ import java.sql.DriverManager;
...
@@ -10,9 +10,8 @@ import java.sql.DriverManager;
import
java.sql.ResultSet
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.Collections
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.h2.api.Trigger
;
import
org.h2.api.Trigger
;
/**
/**
...
@@ -21,8 +20,7 @@ import org.h2.api.Trigger;
...
@@ -21,8 +20,7 @@ import org.h2.api.Trigger;
*/
*/
public
class
TriggerPassData
implements
Trigger
{
public
class
TriggerPassData
implements
Trigger
{
private
static
final
Map
<
String
,
TriggerPassData
>
TRIGGERS
=
private
static
final
ConcurrentHashMap
<
String
,
TriggerPassData
>
TRIGGERS
=
new
ConcurrentHashMap
<>();
Collections
.
synchronizedMap
(
new
HashMap
<
String
,
TriggerPassData
>());
private
String
triggerData
;
private
String
triggerData
;
/**
/**
...
...
h2/src/test/org/h2/test/synth/TestFuzzOptimizations.java
浏览文件 @
ed6735a0
...
@@ -117,11 +117,16 @@ public class TestFuzzOptimizations extends TestBase {
...
@@ -117,11 +117,16 @@ public class TestFuzzOptimizations extends TestBase {
}
}
executeAndCompare
(
condition
,
params
,
message
);
executeAndCompare
(
condition
,
params
,
message
);
}
}
if
(!
config
.
mvStore
)
{
if
(!
config
.
mvStore
&&
config
.
travis
)
{
/*
/*
* Travis tests have problems with automatic garbage collection, so request a GC
* Travis tests have problems with automatic garbage collection, so request a GC
* explicitly and print its results.
* explicitly and print its results.
*/
*/
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
println
((
Utils
.
getMemoryUsed
()
>>
10
)
+
" MiB used"
);
println
((
Utils
.
getMemoryUsed
()
>>
10
)
+
" MiB used"
);
}
}
}
}
...
...
h2/src/tools/org/h2/jaqu/SQLDialect.java
浏览文件 @
ed6735a0
...
@@ -98,12 +98,12 @@ public interface SQLDialect {
...
@@ -98,12 +98,12 @@ public interface SQLDialect {
buff
.
append
(
index
.
indexName
);
buff
.
append
(
index
.
indexName
);
buff
.
append
(
" ON "
);
buff
.
append
(
" ON "
);
buff
.
append
(
table
);
buff
.
append
(
table
);
buff
.
append
(
"("
);
buff
.
append
(
'('
);
for
(
String
col
:
index
.
columnNames
)
{
for
(
String
col
:
index
.
columnNames
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
col
);
buff
.
append
(
col
);
}
}
buff
.
append
(
")"
);
buff
.
append
(
')'
);
return
buff
.
toString
();
return
buff
.
toString
();
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论