Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d32a566b
提交
d32a566b
authored
3月 16, 2018
作者:
Jacek Ławrynowicz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
formatting - add braces to control statements
上级
b81fe715
显示空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
50 行增加
和
28 行删除
+50
-28
DbSchema.java
h2/src/main/org/h2/bnf/context/DbSchema.java
+2
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+4
-2
DropTable.java
h2/src/main/org/h2/command/ddl/DropTable.java
+3
-2
AggregateDataMedian.java
h2/src/main/org/h2/expression/AggregateDataMedian.java
+2
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+2
-1
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+2
-1
RangeInputStream.java
h2/src/main/org/h2/store/RangeInputStream.java
+2
-1
RangeReader.java
h2/src/main/org/h2/store/RangeReader.java
+2
-1
Server.java
h2/src/main/org/h2/tools/Server.java
+3
-2
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+2
-1
MergedResultSet.java
h2/src/main/org/h2/util/MergedResultSet.java
+4
-2
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+4
-3
DataType.java
h2/src/main/org/h2/value/DataType.java
+5
-3
ValueEnum.java
h2/src/main/org/h2/value/ValueEnum.java
+5
-2
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+6
-4
没有找到文件。
h2/src/main/org/h2/bnf/context/DbSchema.java
浏览文件 @
d32a566b
...
@@ -71,9 +71,10 @@ public class DbSchema {
...
@@ -71,9 +71,10 @@ public class DbSchema {
}
else
if
(
contents
.
isPostgreSQL
()
&&
}
else
if
(
contents
.
isPostgreSQL
()
&&
StringUtils
.
toUpperEnglish
(
name
).
startsWith
(
"PG_"
))
{
StringUtils
.
toUpperEnglish
(
name
).
startsWith
(
"PG_"
))
{
isSystem
=
true
;
isSystem
=
true
;
}
else
}
else
{
isSystem
=
contents
.
isDerby
()
&&
name
.
startsWith
(
"SYS"
);
isSystem
=
contents
.
isDerby
()
&&
name
.
startsWith
(
"SYS"
);
}
}
}
/**
/**
* @return The database content container.
* @return The database content container.
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
d32a566b
...
@@ -3569,18 +3569,20 @@ public class Parser {
...
@@ -3569,18 +3569,20 @@ public class Parser {
return
b
==
null
;
return
b
==
null
;
}
else
if
(
a
.
equals
(
b
))
{
}
else
if
(
a
.
equals
(
b
))
{
return
true
;
return
true
;
}
else
}
else
{
return
!
identifiersToUpper
&&
a
.
equalsIgnoreCase
(
b
);
return
!
identifiersToUpper
&&
a
.
equalsIgnoreCase
(
b
);
}
}
}
private
static
boolean
equalsTokenIgnoreCase
(
String
a
,
String
b
)
{
private
static
boolean
equalsTokenIgnoreCase
(
String
a
,
String
b
)
{
if
(
a
==
null
)
{
if
(
a
==
null
)
{
return
b
==
null
;
return
b
==
null
;
}
else
if
(
a
.
equals
(
b
))
{
}
else
if
(
a
.
equals
(
b
))
{
return
true
;
return
true
;
}
else
}
else
{
return
a
.
equalsIgnoreCase
(
b
);
return
a
.
equalsIgnoreCase
(
b
);
}
}
}
private
boolean
isTokenInList
(
Collection
<
String
>
upperCaseTokenList
)
{
private
boolean
isTokenInList
(
Collection
<
String
>
upperCaseTokenList
)
{
String
upperCaseCurrentToken
=
currentToken
.
toUpperCase
();
String
upperCaseCurrentToken
=
currentToken
.
toUpperCase
();
...
...
h2/src/main/org/h2/command/ddl/DropTable.java
浏览文件 @
d32a566b
...
@@ -95,8 +95,9 @@ public class DropTable extends SchemaCommand {
...
@@ -95,8 +95,9 @@ public class DropTable extends SchemaCommand {
}
}
}
}
}
}
if
(
buff
.
length
()
>
0
)
if
(
buff
.
length
()
>
0
)
{
throw
DbException
.
get
(
ErrorCode
.
CANNOT_DROP_2
,
tableName
,
buff
.
toString
());
throw
DbException
.
get
(
ErrorCode
.
CANNOT_DROP_2
,
tableName
,
buff
.
toString
());
}
}
}
table
.
lock
(
session
,
true
,
true
);
table
.
lock
(
session
,
true
,
true
);
...
...
h2/src/main/org/h2/expression/AggregateDataMedian.java
浏览文件 @
d32a566b
...
@@ -119,9 +119,10 @@ class AggregateDataMedian extends AggregateData {
...
@@ -119,9 +119,10 @@ class AggregateDataMedian extends AggregateData {
count
--;
count
--;
cursor
.
next
();
cursor
.
next
();
hasNulls
=
true
;
hasNulls
=
true
;
}
else
}
else
{
break
;
break
;
}
}
}
if
(
count
==
0
)
{
if
(
count
==
0
)
{
return
ValueNull
.
INSTANCE
;
return
ValueNull
.
INSTANCE
;
}
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
d32a566b
...
@@ -1648,8 +1648,9 @@ public class Function extends Expression implements FunctionCall {
...
@@ -1648,8 +1648,9 @@ public class Function extends Expression implements FunctionCall {
break
;
break
;
case
SIGNAL:
{
case
SIGNAL:
{
String
sqlState
=
v0
.
getString
();
String
sqlState
=
v0
.
getString
();
if
(
sqlState
.
startsWith
(
"00"
)
||
!
SIGNAL_PATTERN
.
matcher
(
sqlState
).
matches
())
if
(
sqlState
.
startsWith
(
"00"
)
||
!
SIGNAL_PATTERN
.
matcher
(
sqlState
).
matches
())
{
throw
DbException
.
getInvalidValueException
(
"SQLSTATE"
,
sqlState
);
throw
DbException
.
getInvalidValueException
(
"SQLSTATE"
,
sqlState
);
}
String
msgText
=
v1
.
getString
();
String
msgText
=
v1
.
getString
();
throw
DbException
.
fromUser
(
sqlState
,
msgText
);
throw
DbException
.
fromUser
(
sqlState
,
msgText
);
}
}
...
...
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
d32a566b
...
@@ -567,8 +567,9 @@ public final class MVStore {
...
@@ -567,8 +567,9 @@ public final class MVStore {
// the following can fail for various reasons
// the following can fail for various reasons
try
{
try
{
HashMap
<
String
,
String
>
m
=
DataUtils
.
parseChecksummedMap
(
buff
);
HashMap
<
String
,
String
>
m
=
DataUtils
.
parseChecksummedMap
(
buff
);
if
(
m
==
null
)
if
(
m
==
null
)
{
continue
;
continue
;
}
int
blockSize
=
DataUtils
.
readHexInt
(
int
blockSize
=
DataUtils
.
readHexInt
(
m
,
"blockSize"
,
BLOCK_SIZE
);
m
,
"blockSize"
,
BLOCK_SIZE
);
if
(
blockSize
!=
BLOCK_SIZE
)
{
if
(
blockSize
!=
BLOCK_SIZE
)
{
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
d32a566b
...
@@ -653,8 +653,9 @@ public class PgServerThread implements Runnable {
...
@@ -653,8 +653,9 @@ public class PgServerThread implements Runnable {
case
PgServer
.
PG_TYPE_TIME
:
{
case
PgServer
.
PG_TYPE_TIME
:
{
// Strip timezone offset
// Strip timezone offset
int
idx
=
str
.
indexOf
(
'+'
);
int
idx
=
str
.
indexOf
(
'+'
);
if
(
idx
<=
0
)
if
(
idx
<=
0
)
{
idx
=
str
.
indexOf
(
'-'
);
idx
=
str
.
indexOf
(
'-'
);
}
if
(
idx
>
0
)
{
if
(
idx
>
0
)
{
str
=
str
.
substring
(
0
,
idx
);
str
=
str
.
substring
(
0
,
idx
);
}
}
...
...
h2/src/main/org/h2/store/RangeInputStream.java
浏览文件 @
d32a566b
...
@@ -49,8 +49,9 @@ public final class RangeInputStream extends FilterInputStream {
...
@@ -49,8 +49,9 @@ public final class RangeInputStream extends FilterInputStream {
@Override
@Override
public
int
read
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
{
public
int
read
(
byte
b
[],
int
off
,
int
len
)
throws
IOException
{
if
(
limit
<=
0
)
if
(
limit
<=
0
)
{
return
-
1
;
return
-
1
;
}
if
(
len
>
limit
)
{
if
(
len
>
limit
)
{
len
=
(
int
)
limit
;
len
=
(
int
)
limit
;
}
}
...
...
h2/src/main/org/h2/store/RangeReader.java
浏览文件 @
d32a566b
...
@@ -50,8 +50,9 @@ public final class RangeReader extends Reader {
...
@@ -50,8 +50,9 @@ public final class RangeReader extends Reader {
@Override
@Override
public
int
read
(
char
cbuf
[],
int
off
,
int
len
)
throws
IOException
{
public
int
read
(
char
cbuf
[],
int
off
,
int
len
)
throws
IOException
{
if
(
limit
<=
0
)
if
(
limit
<=
0
)
{
return
-
1
;
return
-
1
;
}
if
(
len
>
limit
)
{
if
(
len
>
limit
)
{
len
=
(
int
)
limit
;
len
=
(
int
)
limit
;
}
}
...
...
h2/src/main/org/h2/tools/Server.java
浏览文件 @
d32a566b
...
@@ -720,10 +720,11 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -720,10 +720,11 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
public
static
void
startWebServer
(
Connection
conn
,
boolean
ignoreProperties
)
throws
SQLException
{
public
static
void
startWebServer
(
Connection
conn
,
boolean
ignoreProperties
)
throws
SQLException
{
WebServer
webServer
=
new
WebServer
();
WebServer
webServer
=
new
WebServer
();
String
[]
args
;
String
[]
args
;
if
(
ignoreProperties
)
if
(
ignoreProperties
)
{
args
=
new
String
[]
{
"-webPort"
,
"0"
,
"-properties"
,
"null"
};
args
=
new
String
[]
{
"-webPort"
,
"0"
,
"-properties"
,
"null"
};
else
}
else
{
args
=
new
String
[]
{
"-webPort"
,
"0"
};
args
=
new
String
[]
{
"-webPort"
,
"0"
};
}
Server
web
=
new
Server
(
webServer
,
args
);
Server
web
=
new
Server
(
webServer
,
args
);
web
.
start
();
web
.
start
();
Server
server
=
new
Server
();
Server
server
=
new
Server
();
...
...
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
d32a566b
...
@@ -422,8 +422,9 @@ public class DateTimeUtils {
...
@@ -422,8 +422,9 @@ public class DateTimeUtils {
*/
*/
private
static
int
findNthIndexOf
(
String
str
,
char
chr
,
int
n
)
{
private
static
int
findNthIndexOf
(
String
str
,
char
chr
,
int
n
)
{
int
pos
=
str
.
indexOf
(
chr
);
int
pos
=
str
.
indexOf
(
chr
);
while
(--
n
>
0
&&
pos
!=
-
1
)
while
(--
n
>
0
&&
pos
!=
-
1
)
{
pos
=
str
.
indexOf
(
chr
,
pos
+
1
);
pos
=
str
.
indexOf
(
chr
,
pos
+
1
);
}
return
pos
;
return
pos
;
}
}
...
...
h2/src/main/org/h2/util/MergedResultSet.java
浏览文件 @
d32a566b
...
@@ -57,10 +57,12 @@ public final class MergedResultSet {
...
@@ -57,10 +57,12 @@ public final class MergedResultSet {
@Override
@Override
public
boolean
equals
(
Object
obj
)
{
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
if
(
this
==
obj
)
{
return
true
;
return
true
;
if
(
obj
==
null
||
getClass
()
!=
obj
.
getClass
())
}
if
(
obj
==
null
||
getClass
()
!=
obj
.
getClass
())
{
return
false
;
return
false
;
}
ColumnInfo
other
=
(
ColumnInfo
)
obj
;
ColumnInfo
other
=
(
ColumnInfo
)
obj
;
return
name
.
equals
(
other
.
name
);
return
name
.
equals
(
other
.
name
);
}
}
...
...
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
d32a566b
...
@@ -209,12 +209,13 @@ public class SourceCompiler {
...
@@ -209,12 +209,13 @@ public class SourceCompiler {
if
(
compiledScript
==
null
)
{
if
(
compiledScript
==
null
)
{
String
source
=
sources
.
get
(
packageAndClassName
);
String
source
=
sources
.
get
(
packageAndClassName
);
final
String
lang
;
final
String
lang
;
if
(
isJavascriptSource
(
source
))
if
(
isJavascriptSource
(
source
))
{
lang
=
"javascript"
;
lang
=
"javascript"
;
else
if
(
isRubySource
(
source
))
}
else
if
(
isRubySource
(
source
))
{
lang
=
"ruby"
;
lang
=
"ruby"
;
else
}
else
{
throw
new
IllegalStateException
(
"Unknown language for "
+
source
);
throw
new
IllegalStateException
(
"Unknown language for "
+
source
);
}
final
Compilable
jsEngine
=
(
Compilable
)
new
ScriptEngineManager
().
getEngineByName
(
lang
);
final
Compilable
jsEngine
=
(
Compilable
)
new
ScriptEngineManager
().
getEngineByName
(
lang
);
compiledScript
=
jsEngine
.
compile
(
source
);
compiledScript
=
jsEngine
.
compile
(
source
);
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
d32a566b
...
@@ -534,18 +534,20 @@ public class DataType {
...
@@ -534,18 +534,20 @@ public class DataType {
v
=
ValueBytes
.
getNoCopy
((
byte
[])
o
);
v
=
ValueBytes
.
getNoCopy
((
byte
[])
o
);
}
else
if
(
o
!=
null
)
{
}
else
if
(
o
!=
null
)
{
v
=
ValueUuid
.
get
((
UUID
)
o
);
v
=
ValueUuid
.
get
((
UUID
)
o
);
}
else
}
else
{
v
=
ValueNull
.
INSTANCE
;
v
=
ValueNull
.
INSTANCE
;
}
break
;
break
;
}
}
case
Value
.
UUID
:
{
case
Value
.
UUID
:
{
Object
o
=
rs
.
getObject
(
columnIndex
);
Object
o
=
rs
.
getObject
(
columnIndex
);
if
(
o
instanceof
UUID
)
{
if
(
o
instanceof
UUID
)
{
v
=
ValueUuid
.
get
((
UUID
)
o
);
v
=
ValueUuid
.
get
((
UUID
)
o
);
}
else
if
(
o
!=
null
)
}
else
if
(
o
!=
null
)
{
v
=
ValueUuid
.
get
((
byte
[])
o
);
v
=
ValueUuid
.
get
((
byte
[])
o
);
else
}
else
{
v
=
ValueNull
.
INSTANCE
;
v
=
ValueNull
.
INSTANCE
;
}
break
;
break
;
}
}
case
Value
.
BOOLEAN
:
{
case
Value
.
BOOLEAN
:
{
...
...
h2/src/main/org/h2/value/ValueEnum.java
浏览文件 @
d32a566b
...
@@ -78,9 +78,10 @@ public class ValueEnum extends ValueEnumBase {
...
@@ -78,9 +78,10 @@ public class ValueEnum extends ValueEnumBase {
final
String
cleanLabel
=
sanitize
(
value
);
final
String
cleanLabel
=
sanitize
(
value
);
for
(
int
i
=
0
;
i
<
enumerators
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
enumerators
.
length
;
i
++)
{
if
(
cleanLabel
.
equals
(
sanitize
(
enumerators
[
i
])))
if
(
cleanLabel
.
equals
(
sanitize
(
enumerators
[
i
])))
{
return
new
ValueEnum
(
enumerators
,
i
);
return
new
ValueEnum
(
enumerators
,
i
);
}
}
}
throw
DbException
.
get
(
ErrorCode
.
GENERAL_ERROR_1
,
"Unexpected error"
);
throw
DbException
.
get
(
ErrorCode
.
GENERAL_ERROR_1
,
"Unexpected error"
);
}
}
...
@@ -106,7 +107,9 @@ public class ValueEnum extends ValueEnumBase {
...
@@ -106,7 +107,9 @@ public class ValueEnum extends ValueEnumBase {
}
}
private
static
String
[]
sanitize
(
final
String
[]
enumerators
)
{
private
static
String
[]
sanitize
(
final
String
[]
enumerators
)
{
if
(
enumerators
==
null
||
enumerators
.
length
==
0
)
return
null
;
if
(
enumerators
==
null
||
enumerators
.
length
==
0
)
{
return
null
;
}
final
String
[]
clean
=
new
String
[
enumerators
.
length
];
final
String
[]
clean
=
new
String
[
enumerators
.
length
];
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
d32a566b
...
@@ -69,10 +69,11 @@ public class ValueLob extends Value {
...
@@ -69,10 +69,11 @@ public class ValueLob extends Value {
* @return the smaller input stream
* @return the smaller input stream
*/
*/
static
InputStream
rangeInputStream
(
InputStream
inputStream
,
long
oneBasedOffset
,
long
length
,
long
dataSize
)
{
static
InputStream
rangeInputStream
(
InputStream
inputStream
,
long
oneBasedOffset
,
long
length
,
long
dataSize
)
{
if
(
dataSize
>
0
)
if
(
dataSize
>
0
)
{
rangeCheck
(
oneBasedOffset
-
1
,
length
,
dataSize
);
rangeCheck
(
oneBasedOffset
-
1
,
length
,
dataSize
);
else
}
else
{
rangeCheckUnknown
(
oneBasedOffset
-
1
,
length
);
rangeCheckUnknown
(
oneBasedOffset
-
1
,
length
);
}
try
{
try
{
return
new
RangeInputStream
(
inputStream
,
oneBasedOffset
-
1
,
length
);
return
new
RangeInputStream
(
inputStream
,
oneBasedOffset
-
1
,
length
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -90,10 +91,11 @@ public class ValueLob extends Value {
...
@@ -90,10 +91,11 @@ public class ValueLob extends Value {
* @return the smaller input stream
* @return the smaller input stream
*/
*/
static
Reader
rangeReader
(
Reader
reader
,
long
oneBasedOffset
,
long
length
,
long
dataSize
)
{
static
Reader
rangeReader
(
Reader
reader
,
long
oneBasedOffset
,
long
length
,
long
dataSize
)
{
if
(
dataSize
>
0
)
if
(
dataSize
>
0
)
{
rangeCheck
(
oneBasedOffset
-
1
,
length
,
dataSize
);
rangeCheck
(
oneBasedOffset
-
1
,
length
,
dataSize
);
else
}
else
{
rangeCheckUnknown
(
oneBasedOffset
-
1
,
length
);
rangeCheckUnknown
(
oneBasedOffset
-
1
,
length
);
}
try
{
try
{
return
new
RangeReader
(
reader
,
oneBasedOffset
-
1
,
length
);
return
new
RangeReader
(
reader
,
oneBasedOffset
-
1
,
length
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论