Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e9bd9c7d
提交
e9bd9c7d
authored
18 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
b9e6c06e
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
59 行增加
和
23 行删除
+59
-23
Constraint.java
h2/src/main/org/h2/constraint/Constraint.java
+4
-0
Comment.java
h2/src/main/org/h2/engine/Comment.java
+4
-0
Constants.java
h2/src/main/org/h2/engine/Constants.java
+4
-3
Database.java
h2/src/main/org/h2/engine/Database.java
+8
-9
DbObject.java
h2/src/main/org/h2/engine/DbObject.java
+2
-0
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+4
-0
Right.java
h2/src/main/org/h2/engine/Right.java
+4
-0
Role.java
h2/src/main/org/h2/engine/Role.java
+4
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+10
-9
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+3
-2
Setting.java
h2/src/main/org/h2/engine/Setting.java
+4
-0
User.java
h2/src/main/org/h2/engine/User.java
+4
-0
UserDataType.java
h2/src/main/org/h2/engine/UserDataType.java
+4
-0
没有找到文件。
h2/src/main/org/h2/constraint/Constraint.java
浏览文件 @
e9bd9c7d
...
@@ -53,5 +53,9 @@ public abstract class Constraint extends SchemaObject {
...
@@ -53,5 +53,9 @@ public abstract class Constraint extends SchemaObject {
public
Table
getRefTable
()
{
public
Table
getRefTable
()
{
return
table
;
return
table
;
}
}
public
String
getDropSQL
()
{
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Comment.java
浏览文件 @
e9bd9c7d
...
@@ -56,6 +56,10 @@ public class Comment extends DbObject {
...
@@ -56,6 +56,10 @@ public class Comment extends DbObject {
return
"type"
+
type
;
return
"type"
+
type
;
}
}
}
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
e9bd9c7d
...
@@ -27,7 +27,7 @@ package org.h2.engine;
...
@@ -27,7 +27,7 @@ package org.h2.engine;
* ant codeswitch_jdk14
* ant codeswitch_jdk14
*
*
* - Change FAQ (next release planned, known bugs)
* - Change FAQ (next release planned, known bugs)
* - Check version, change build number in Constants.java and
build.xml
* - Check version, change build number in Constants.java and
ant-build.properties
* - Check code coverage
* - Check code coverage
* - No " Message.getInternalError" (must be "throw Message.getInternalError")
* - No " Message.getInternalError" (must be "throw Message.getInternalError")
* - No TODO in the docs
* - No TODO in the docs
...
@@ -66,8 +66,8 @@ package org.h2.engine;
...
@@ -66,8 +66,8 @@ package org.h2.engine;
*/
*/
public
class
Constants
{
public
class
Constants
{
public
static
final
int
BUILD_ID
=
4
4
;
public
static
final
int
BUILD_ID
=
4
5
;
private
static
final
String
BUILD
=
"2007-03-
04
"
;
private
static
final
String
BUILD
=
"2007-03-
20
"
;
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MINOR
=
0
;
public
static
final
int
VERSION_MINOR
=
0
;
...
@@ -106,6 +106,7 @@ public class Constants {
...
@@ -106,6 +106,7 @@ public class Constants {
public
static
final
int
DEFAULT_CACHE_SIZE_LINEAR_INDEX
=
1
<<
8
;
public
static
final
int
DEFAULT_CACHE_SIZE_LINEAR_INDEX
=
1
<<
8
;
public
static
final
String
SUFFIX_DB_FILE
=
".db"
;
public
static
final
String
SUFFIX_DATA_FILE
=
".data.db"
;
public
static
final
String
SUFFIX_DATA_FILE
=
".data.db"
;
public
static
final
String
SUFFIX_LOG_FILE
=
".log.db"
;
public
static
final
String
SUFFIX_LOG_FILE
=
".log.db"
;
public
static
final
String
SUFFIX_INDEX_FILE
=
".index.db"
;
public
static
final
String
SUFFIX_INDEX_FILE
=
".index.db"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
e9bd9c7d
...
@@ -45,6 +45,7 @@ import org.h2.tools.DeleteDbFiles;
...
@@ -45,6 +45,7 @@ import org.h2.tools.DeleteDbFiles;
import
org.h2.util.BitField
;
import
org.h2.util.BitField
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.CacheLRU
;
import
org.h2.util.CacheLRU
;
import
org.h2.util.ClassUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.MemoryFile
;
import
org.h2.util.MemoryFile
;
...
@@ -291,16 +292,10 @@ public class Database implements DataHandler {
...
@@ -291,16 +292,10 @@ public class Database implements DataHandler {
}
}
public
FileStore
openFile
(
String
name
,
boolean
mustExist
)
throws
SQLException
{
public
FileStore
openFile
(
String
name
,
boolean
mustExist
)
throws
SQLException
{
return
openFile
(
name
,
false
,
mustExist
);
}
public
FileStore
openFile
(
String
name
,
boolean
notEncrypted
,
boolean
mustExist
)
throws
SQLException
{
String
c
=
notEncrypted
?
null
:
cipher
;
byte
[]
h
=
notEncrypted
?
null
:
filePasswordHash
;
if
(
mustExist
&&
!
FileUtils
.
exists
(
name
))
{
if
(
mustExist
&&
!
FileUtils
.
exists
(
name
))
{
throw
Message
.
getSQLException
(
Message
.
FILE_CORRUPTED_1
,
name
);
throw
Message
.
getSQLException
(
Message
.
FILE_CORRUPTED_1
,
name
);
}
}
FileStore
store
=
FileStore
.
open
(
this
,
name
,
getMagic
(),
c
,
h
);
FileStore
store
=
FileStore
.
open
(
this
,
name
,
getMagic
(),
c
ipher
,
filePasswordHas
h
);
try
{
try
{
store
.
init
();
store
.
init
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
@@ -417,6 +412,9 @@ public class Database implements DataHandler {
...
@@ -417,6 +412,9 @@ public class Database implements DataHandler {
}
else
{
}
else
{
traceSystem
=
new
TraceSystem
(
databaseName
+
Constants
.
SUFFIX_TRACE_FILE
);
traceSystem
=
new
TraceSystem
(
databaseName
+
Constants
.
SUFFIX_TRACE_FILE
);
}
}
if
(
cipher
!=
null
)
{
traceSystem
.
setManualEnabling
(
false
);
}
traceSystem
.
setLevelFile
(
traceLevelFile
);
traceSystem
.
setLevelFile
(
traceLevelFile
);
traceSystem
.
setLevelSystemOut
(
traceLevelSystemOut
);
traceSystem
.
setLevelSystemOut
(
traceLevelSystemOut
);
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
info
(
"opening "
+
databaseName
+
" (build "
+
Constants
.
BUILD_ID
+
")"
);
traceSystem
.
getTrace
(
Trace
.
DATABASE
).
info
(
"opening "
+
databaseName
+
" (build "
+
Constants
.
BUILD_ID
+
")"
);
...
@@ -1007,7 +1005,8 @@ public class Database implements DataHandler {
...
@@ -1007,7 +1005,8 @@ public class Database implements DataHandler {
public
String
createTempFile
()
throws
SQLException
{
public
String
createTempFile
()
throws
SQLException
{
try
{
try
{
return
FileUtils
.
createTempFile
(
databaseName
,
Constants
.
SUFFIX_TEMP_FILE
,
true
);
boolean
inTempDir
=
readOnly
;
return
FileUtils
.
createTempFile
(
databaseName
,
Constants
.
SUFFIX_TEMP_FILE
,
true
,
inTempDir
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
(
e
);
}
}
...
@@ -1220,7 +1219,7 @@ public class Database implements DataHandler {
...
@@ -1220,7 +1219,7 @@ public class Database implements DataHandler {
}
}
public
Class
loadClass
(
String
className
)
throws
ClassNotFoundException
{
public
Class
loadClass
(
String
className
)
throws
ClassNotFoundException
{
return
Class
.
forName
(
className
);
return
Class
Utils
.
loadClass
(
className
);
}
}
public
void
setEventListener
(
String
className
)
throws
SQLException
{
public
void
setEventListener
(
String
className
)
throws
SQLException
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/DbObject.java
浏览文件 @
e9bd9c7d
...
@@ -108,6 +108,8 @@ public abstract class DbObject {
...
@@ -108,6 +108,8 @@ public abstract class DbObject {
public
abstract
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
);
public
abstract
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
);
public
abstract
String
getCreateSQL
();
public
abstract
String
getCreateSQL
();
public
abstract
String
getDropSQL
();
public
abstract
int
getType
();
public
abstract
int
getType
();
public
abstract
void
removeChildrenAndResources
(
Session
session
)
throws
SQLException
;
public
abstract
void
removeChildrenAndResources
(
Session
session
)
throws
SQLException
;
public
abstract
void
checkRename
()
throws
SQLException
;
public
abstract
void
checkRename
()
throws
SQLException
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
e9bd9c7d
...
@@ -105,6 +105,10 @@ public class FunctionAlias extends DbObject {
...
@@ -105,6 +105,10 @@ public class FunctionAlias extends DbObject {
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
}
}
public
String
getDropSQL
()
{
return
"DROP ALIAS IF EXISTS "
+
getSQL
();
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE ALIAS "
);
buff
.
append
(
"CREATE ALIAS "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Right.java
浏览文件 @
e9bd9c7d
...
@@ -69,6 +69,10 @@ public class Right extends DbObject {
...
@@ -69,6 +69,10 @@ public class Right extends DbObject {
return
grantee
;
return
grantee
;
}
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"GRANT "
);
buff
.
append
(
"GRANT "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Role.java
浏览文件 @
e9bd9c7d
...
@@ -24,6 +24,10 @@ public class Role extends RightOwner {
...
@@ -24,6 +24,10 @@ public class Role extends RightOwner {
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
}
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
if
(
system
)
{
if
(
system
)
{
return
null
;
return
null
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
e9bd9c7d
...
@@ -26,7 +26,6 @@ import org.h2.store.LogSystem;
...
@@ -26,7 +26,6 @@ import org.h2.store.LogSystem;
import
org.h2.store.UndoLog
;
import
org.h2.store.UndoLog
;
import
org.h2.store.UndoLogRecord
;
import
org.h2.store.UndoLogRecord
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableData
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.ObjectArray
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLong
;
import
org.h2.value.ValueLong
;
...
@@ -88,8 +87,8 @@ public class Session implements SessionInterface {
...
@@ -88,8 +87,8 @@ public class Session implements SessionInterface {
}
}
}
}
public
void
addLocalTempTable
(
Table
Data
table
)
throws
SQLException
{
public
void
addLocalTempTable
(
Table
table
)
throws
SQLException
{
cleanTempTables
();
cleanTempTables
(
false
);
if
(
localTempTables
==
null
)
{
if
(
localTempTables
==
null
)
{
localTempTables
=
new
HashMap
();
localTempTables
=
new
HashMap
();
}
}
...
@@ -195,7 +194,8 @@ public class Session implements SessionInterface {
...
@@ -195,7 +194,8 @@ public class Session implements SessionInterface {
}
}
if
(
undoLog
.
size
()
>
0
)
{
if
(
undoLog
.
size
()
>
0
)
{
undoLog
.
clear
();
undoLog
.
clear
();
cleanTempTables
();
// do not clean the temp tables if the last command was a create/drop
cleanTempTables
(
false
);
}
}
if
(
unlinkSet
!=
null
&&
unlinkSet
.
size
()
>
0
)
{
if
(
unlinkSet
!=
null
&&
unlinkSet
.
size
()
>
0
)
{
// need to flush the log file, because we can't unlink lobs if the commit record is not written
// need to flush the log file, because we can't unlink lobs if the commit record is not written
...
@@ -219,7 +219,7 @@ public class Session implements SessionInterface {
...
@@ -219,7 +219,7 @@ public class Session implements SessionInterface {
if
(
locks
.
size
()
>
0
||
needCommit
)
{
if
(
locks
.
size
()
>
0
||
needCommit
)
{
logSystem
.
commit
(
this
);
logSystem
.
commit
(
this
);
}
}
cleanTempTables
();
cleanTempTables
(
false
);
unlockAll
();
unlockAll
();
}
}
...
@@ -252,6 +252,7 @@ public class Session implements SessionInterface {
...
@@ -252,6 +252,7 @@ public class Session implements SessionInterface {
public
void
close
()
throws
SQLException
{
public
void
close
()
throws
SQLException
{
if
(
database
!=
null
)
{
if
(
database
!=
null
)
{
try
{
try
{
cleanTempTables
(
true
);
database
.
removeSession
(
this
);
database
.
removeSession
(
this
);
}
finally
{
}
finally
{
database
=
null
;
database
=
null
;
...
@@ -295,13 +296,13 @@ public class Session implements SessionInterface {
...
@@ -295,13 +296,13 @@ public class Session implements SessionInterface {
locks
.
clear
();
locks
.
clear
();
savepoints
=
null
;
savepoints
=
null
;
}
}
private
void
cleanTempTables
()
throws
SQLException
{
private
void
cleanTempTables
(
boolean
closeSession
)
throws
SQLException
{
if
(
localTempTables
!=
null
&&
localTempTables
.
size
()>
0
)
{
if
(
localTempTables
!=
null
&&
localTempTables
.
size
()>
0
)
{
ObjectArray
list
=
new
ObjectArray
(
localTempTables
.
values
());
ObjectArray
list
=
new
ObjectArray
(
localTempTables
.
values
());
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
Table
Data
table
=
(
TableData
)
list
.
get
(
i
);
Table
table
=
(
Table
)
list
.
get
(
i
);
if
(
table
.
isOnCommitDrop
())
{
if
(
closeSession
||
table
.
isOnCommitDrop
())
{
table
.
setModified
();
table
.
setModified
();
localTempTables
.
remove
(
table
.
getName
());
localTempTables
.
remove
(
table
.
getName
());
table
.
removeChildrenAndResources
(
this
);
table
.
removeChildrenAndResources
(
this
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
e9bd9c7d
...
@@ -178,7 +178,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
...
@@ -178,7 +178,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
if
(
traceLevelFile
!=
null
)
{
if
(
traceLevelFile
!=
null
)
{
int
level
=
Integer
.
parseInt
(
traceLevelFile
);
int
level
=
Integer
.
parseInt
(
traceLevelFile
);
String
prefix
=
getTraceFilePrefix
(
databaseName
);
String
prefix
=
getTraceFilePrefix
(
databaseName
);
String
file
=
FileUtils
.
createTempFile
(
prefix
,
Constants
.
SUFFIX_TRACE_FILE
,
false
);
String
file
=
FileUtils
.
createTempFile
(
prefix
,
Constants
.
SUFFIX_TRACE_FILE
,
false
,
false
);
traceSystem
.
setFileName
(
file
);
traceSystem
.
setFileName
(
file
);
traceSystem
.
setLevelFile
(
level
);
traceSystem
.
setLevelFile
(
level
);
}
}
...
@@ -323,7 +323,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
...
@@ -323,7 +323,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
public
String
createTempFile
()
throws
SQLException
{
public
String
createTempFile
()
throws
SQLException
{
try
{
try
{
return
FileUtils
.
createTempFile
(
databaseName
,
Constants
.
SUFFIX_TEMP_FILE
,
true
);
return
FileUtils
.
createTempFile
(
databaseName
,
Constants
.
SUFFIX_TEMP_FILE
,
true
,
false
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
Message
.
convert
(
e
);
throw
Message
.
convert
(
e
);
}
}
...
@@ -367,6 +367,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
...
@@ -367,6 +367,7 @@ public class SessionRemote implements SessionInterface, DataHandler {
}
else
{
}
else
{
store
=
FileStore
.
open
(
this
,
name
,
magic
,
cipher
,
fileEncryptionKey
,
0
);
store
=
FileStore
.
open
(
this
,
name
,
magic
,
cipher
,
fileEncryptionKey
,
0
);
}
}
store
.
setCheckedWriting
(
false
);
try
{
try
{
store
.
init
();
store
.
init
();
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Setting.java
浏览文件 @
e9bd9c7d
...
@@ -38,6 +38,10 @@ public class Setting extends DbObject {
...
@@ -38,6 +38,10 @@ public class Setting extends DbObject {
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
}
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"SET "
);
buff
.
append
(
"SET "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/User.java
浏览文件 @
e9bd9c7d
...
@@ -58,6 +58,10 @@ public class User extends RightOwner {
...
@@ -58,6 +58,10 @@ public class User extends RightOwner {
return
getCreateSQL
(
true
,
false
);
return
getCreateSQL
(
true
,
false
);
}
}
public
String
getDropSQL
()
{
return
null
;
}
public
void
checkRight
(
Table
table
,
int
rightMask
)
throws
SQLException
{
public
void
checkRight
(
Table
table
,
int
rightMask
)
throws
SQLException
{
if
(
rightMask
!=
Right
.
SELECT
&&
!
systemUser
)
{
if
(
rightMask
!=
Right
.
SELECT
&&
!
systemUser
)
{
database
.
checkWritingAllowed
();
database
.
checkWritingAllowed
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/UserDataType.java
浏览文件 @
e9bd9c7d
...
@@ -22,6 +22,10 @@ public class UserDataType extends DbObject {
...
@@ -22,6 +22,10 @@ public class UserDataType extends DbObject {
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
throw
Message
.
getInternalError
();
throw
Message
.
getInternalError
();
}
}
public
String
getDropSQL
()
{
return
"DROP DOMAIN IF EXISTS "
+
getSQL
();
}
public
String
getCreateSQL
()
{
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
StringBuffer
buff
=
new
StringBuffer
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论