Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7ac143fd
提交
7ac143fd
authored
18 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
2748b4f5
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
140 行增加
和
43 行删除
+140
-43
AppServer.java
h2/src/main/org/h2/server/web/AppServer.java
+2
-0
AppThread.java
h2/src/main/org/h2/server/web/AppThread.java
+1
-5
_text_pt_pt.properties
h2/src/main/org/h2/server/web/res/_text_pt_pt.properties
+1
-1
DataHandler.java
h2/src/main/org/h2/store/DataHandler.java
+0
-1
FileLister.java
h2/src/main/org/h2/store/FileLister.java
+7
-0
FileStore.java
h2/src/main/org/h2/store/FileStore.java
+8
-2
Column.java
h2/src/main/org/h2/table/Column.java
+3
-0
FunctionTable.java
h2/src/main/org/h2/table/FunctionTable.java
+4
-0
LinkSchema.java
h2/src/main/org/h2/table/LinkSchema.java
+65
-0
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+4
-0
RangeTable.java
h2/src/main/org/h2/table/RangeTable.java
+4
-0
Table.java
h2/src/main/org/h2/table/Table.java
+17
-0
TableData.java
h2/src/main/org/h2/table/TableData.java
+4
-17
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+5
-7
TableView.java
h2/src/main/org/h2/table/TableView.java
+15
-10
没有找到文件。
h2/src/main/org/h2/server/web/AppServer.java
浏览文件 @
7ac143fd
...
...
@@ -17,6 +17,7 @@ import java.util.Properties;
import
org.h2.engine.Constants
;
import
org.h2.message.TraceSystem
;
import
org.h2.util.FileUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.MathUtils
;
public
class
AppServer
{
...
...
@@ -208,6 +209,7 @@ public class AppServer {
user
=
user
.
trim
();
password
=
password
.
trim
();
org
.
h2
.
Driver
.
load
();
JdbcUtils
.
getConnection
(
driver
,
url
,
user
,
password
);
Class
.
forName
(
driver
);
// try {
// Driver dr = (Driver) urlClassLoader.loadClass(driver).newInstance();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/AppThread.java
浏览文件 @
7ac143fd
...
...
@@ -508,11 +508,7 @@ public class AppThread extends WebServerThread {
session
.
put
(
"user"
,
user
);
try
{
Connection
conn
=
server
.
getAppServer
().
getConnection
(
driver
,
url
,
user
,
password
);
try
{
conn
.
close
();
}
catch
(
SQLException
e2
)
{
// TODO log error
}
JdbcUtils
.
closeSilently
(
conn
);
session
.
put
(
"error"
,
"${text.login.testSuccessful}"
);
return
"index.jsp"
;
}
catch
(
Exception
e
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/res/_text_pt_pt.properties
浏览文件 @
7ac143fd
...
...
@@ -102,4 +102,4 @@ tree.indexes=Índices
tree.nonUnique
=
Não único
tree.sequences
=
Sequências
tree.unique
=
Único
tree.users
=
Utilizadoreses
\ No newline at end of file
tree.users
=
Utilizadoreses
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/DataHandler.java
浏览文件 @
7ac143fd
...
...
@@ -19,7 +19,6 @@ public interface DataHandler {
void
handleInvalidChecksum
()
throws
SQLException
;
int
compareTypeSave
(
Value
a
,
Value
b
)
throws
SQLException
;
int
getMaxLengthInplaceLob
();
String
getLobCompressionAlgorithm
(
int
type
);
// only temporarily, until LOB_FILES_IN_DIRECTORIES is enabled
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileLister.java
浏览文件 @
7ac143fd
...
...
@@ -16,6 +16,13 @@ import org.h2.util.FileUtils;
public
class
FileLister
{
public
static
String
getDatabaseNameFromFileName
(
String
fileName
)
{
if
(
fileName
.
endsWith
(
Constants
.
SUFFIX_DATA_FILE
))
{
return
fileName
.
substring
(
0
,
fileName
.
length
()
-
Constants
.
SUFFIX_DATA_FILE
.
length
());
}
return
null
;
}
/**
* Get the list of database files.
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileStore.java
浏览文件 @
7ac143fd
...
...
@@ -24,10 +24,10 @@ public class FileStore {
protected
String
name
;
protected
DataHandler
handler
;
private
byte
[]
magic
;
private
RandomAccessFile
file
;
private
long
filePos
;
private
Reference
autoDeleteReference
;
private
boolean
checkedWriting
=
true
;
public
static
FileStore
open
(
DataHandler
handler
,
String
name
,
byte
[]
magic
)
throws
SQLException
{
return
open
(
handler
,
name
,
magic
,
null
,
null
,
0
);
...
...
@@ -79,9 +79,13 @@ public class FileStore {
protected
void
initKey
(
byte
[]
salt
)
{
// do nothing
}
public
void
setCheckedWriting
(
boolean
value
)
{
this
.
checkedWriting
=
value
;
}
protected
void
checkWritingAllowed
()
throws
SQLException
{
if
(
handler
!=
null
)
{
if
(
handler
!=
null
&&
checkedWriting
)
{
handler
.
checkWritingAllowed
();
}
}
...
...
@@ -97,12 +101,14 @@ public class FileStore {
byte
[]
salt
;
if
(
length
()
<
HEADER_LENGTH
)
{
// write unencrypted
checkedWriting
=
false
;
writeDirect
(
magic
,
0
,
len
);
salt
=
generateSalt
();
writeDirect
(
salt
,
0
,
len
);
initKey
(
salt
);
// write (maybe) encrypted
write
(
magic
,
0
,
len
);
checkedWriting
=
true
;
}
else
{
// write unencrypted
seek
(
0
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Column.java
浏览文件 @
7ac143fd
...
...
@@ -79,6 +79,9 @@ public class Column {
newColumn
.
convertNullToDefault
=
convertNullToDefault
;
newColumn
.
sequence
=
sequence
;
newColumn
.
comment
=
comment
;
newColumn
.
isComputed
=
isComputed
;
newColumn
.
selectivity
=
selectivity
;
newColumn
.
primaryKey
=
primaryKey
;
return
newColumn
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/FunctionTable.java
浏览文件 @
7ac143fd
...
...
@@ -119,6 +119,10 @@ public class FunctionTable extends Table {
public
String
getCreateSQL
()
{
return
null
;
}
public
String
getDropSQL
()
{
return
null
;
}
public
void
checkRename
()
throws
SQLException
{
throw
Message
.
getUnsupportedException
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/LinkSchema.java
0 → 100644
浏览文件 @
7ac143fd
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
table
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Types
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
public
class
LinkSchema
{
public
static
ResultSet
linkSchema
(
Connection
conn
,
String
targetSchema
,
String
driver
,
String
url
,
String
user
,
String
password
,
String
sourceSchema
)
throws
SQLException
{
Connection
c2
=
null
;
Statement
stat
=
null
;
ResultSet
rs
=
null
;
SimpleResultSet
result
=
new
SimpleResultSet
();
result
.
addColumn
(
"TABLE_NAME"
,
Types
.
VARCHAR
,
255
,
0
);
try
{
c2
=
JdbcUtils
.
getConnection
(
driver
,
url
,
user
,
password
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE SCHEMA IF NOT EXISTS "
+
StringUtils
.
quoteIdentifier
(
targetSchema
));
rs
=
c2
.
getMetaData
().
getTables
(
null
,
sourceSchema
,
null
,
null
);
while
(
rs
.
next
())
{
String
table
=
rs
.
getString
(
"TABLE_NAME"
);
StringBuffer
buff
=
new
StringBuffer
();
buff
.
append
(
"DROP TABLE IF EXISTS "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
targetSchema
));
buff
.
append
(
'.'
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
));
String
sql
=
buff
.
toString
();
stat
.
execute
(
sql
);
buff
=
new
StringBuffer
();
buff
.
append
(
"CREATE LINKED TABLE "
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
targetSchema
));
buff
.
append
(
'.'
);
buff
.
append
(
StringUtils
.
quoteIdentifier
(
table
));
buff
.
append
(
'('
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
driver
));
buff
.
append
(
", "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
url
));
buff
.
append
(
", "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
user
));
buff
.
append
(
", "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
password
));
buff
.
append
(
", "
);
buff
.
append
(
StringUtils
.
quoteStringSQL
(
table
));
buff
.
append
(
')'
);
sql
=
buff
.
toString
();
stat
.
execute
(
sql
);
result
.
addRow
(
new
String
[]{
table
});
}
}
finally
{
JdbcUtils
.
closeSilently
(
rs
);
JdbcUtils
.
closeSilently
(
c2
);
JdbcUtils
.
closeSilently
(
stat
);
}
return
result
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
7ac143fd
...
...
@@ -443,6 +443,10 @@ public class MetaTable extends Table {
return
cols
;
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQL
()
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/RangeTable.java
浏览文件 @
7ac143fd
...
...
@@ -31,6 +31,10 @@ public class RangeTable extends Table {
setColumns
(
cols
);
}
public
String
getDropSQL
()
{
return
null
;
}
public
String
getCreateSQL
()
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
7ac143fd
...
...
@@ -49,6 +49,7 @@ public abstract class Table extends SchemaObject {
private
ObjectArray
sequences
;
private
ObjectArray
views
;
private
boolean
checkForeignKeyConstraints
=
true
;
private
boolean
onCommitDrop
,
onCommitTruncate
;
public
Table
(
Schema
schema
,
int
id
,
String
name
,
boolean
persistent
)
{
super
(
schema
,
id
,
name
,
Trace
.
TABLE
);
...
...
@@ -443,5 +444,21 @@ public abstract class Table extends SchemaObject {
}
return
null
;
}
public
boolean
isOnCommitDrop
()
{
return
onCommitDrop
;
}
public
void
setOnCommitDrop
(
boolean
onCommitDrop
)
{
this
.
onCommitDrop
=
onCommitDrop
;
}
public
boolean
isOnCommitTruncate
()
{
return
onCommitTruncate
;
}
public
void
setOnCommitTruncate
(
boolean
onCommitTruncate
)
{
this
.
onCommitTruncate
=
onCommitTruncate
;
}
}
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableData.java
浏览文件 @
7ac143fd
...
...
@@ -43,7 +43,6 @@ public class TableData extends Table implements RecordReader {
private
HashSet
lockShared
=
new
HashSet
();
private
Trace
traceLock
;
private
boolean
globalTemporary
;
private
boolean
onCommitDrop
,
onCommitTruncate
;
private
ObjectArray
indexes
=
new
ObjectArray
();
private
long
lastModificationId
;
...
...
@@ -337,6 +336,10 @@ public class TableData extends Table implements RecordReader {
traceLock
.
debug
(
session
.
getId
()+
" "
+(
exclusive
?
"xlock"
:
"slock"
)
+
" "
+
s
+
" "
+
getName
());
}
}
public
String
getDropSQL
()
{
return
"DROP TABLE IF EXISTS "
+
getSQL
();
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
...
...
@@ -460,22 +463,6 @@ public class TableData extends Table implements RecordReader {
return
globalTemporary
;
}
public
boolean
isOnCommitDrop
()
{
return
onCommitDrop
;
}
public
void
setOnCommitDrop
(
boolean
onCommitDrop
)
{
this
.
onCommitDrop
=
onCommitDrop
;
}
public
boolean
isOnCommitTruncate
()
{
return
onCommitTruncate
;
}
public
void
setOnCommitTruncate
(
boolean
onCommitTruncate
)
{
this
.
onCommitTruncate
=
onCommitTruncate
;
}
public
long
getMaxDataModificationId
()
{
return
lastModificationId
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
7ac143fd
...
...
@@ -6,7 +6,6 @@ package org.h2.table;
import
java.sql.Connection
;
import
java.sql.DatabaseMetaData
;
import
java.sql.DriverManager
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
...
...
@@ -45,12 +44,7 @@ public class TableLink extends Table {
this
.
user
=
user
;
this
.
password
=
password
;
this
.
originalTable
=
originalTable
;
try
{
database
.
loadClass
(
driver
);
}
catch
(
ClassNotFoundException
e
)
{
throw
Message
.
getSQLException
(
Message
.
CLASS_NOT_FOUND_1
,
new
String
[]{
driver
},
e
);
}
conn
=
DriverManager
.
getConnection
(
url
,
user
,
password
);
conn
=
JdbcUtils
.
getConnection
(
driver
,
url
,
user
,
password
);
DatabaseMetaData
meta
=
conn
.
getMetaData
();
boolean
storesLowerCase
=
meta
.
storesLowerCaseIdentifiers
();
ResultSet
rs
=
meta
.
getColumns
(
null
,
null
,
originalTable
,
null
);
...
...
@@ -161,6 +155,10 @@ public class TableLink extends Table {
Index
index
=
new
LinkedIndex
(
this
,
0
,
cols
,
indexType
);
indexes
.
add
(
index
);
}
public
String
getDropSQL
()
{
return
"DROP TABLE IF EXISTS "
+
getSQL
();
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableView.java
浏览文件 @
7ac143fd
...
...
@@ -34,6 +34,7 @@ public class TableView extends Table {
super
(
schema
,
id
,
name
,
false
);
this
.
querySQL
=
querySQL
;
this
.
columnNames
=
columnNames
;
this
.
recursive
=
recursive
;
index
=
new
ViewIndex
(
this
,
querySQL
,
params
,
recursive
);
initColumnsAndTables
(
session
);
}
...
...
@@ -80,16 +81,16 @@ public class TableView extends Table {
tables
=
new
ObjectArray
();
cols
=
new
Column
[
0
];
int
testing
;
//
if(recursive && columnNames != null) {
//
cols = new Column[columnNames.length];
//
for(int i=0; i<columnNames.length; i++) {
//
cols[i] = new Column(columnNames[i], Value.STRING, 255, 0);
//
}
//
index.setRecursive(true);
//
recursive = true;
//
createException = null;
//
}
int
needToTestRecursiveQueries
;
if
(
recursive
&&
columnNames
!=
null
)
{
cols
=
new
Column
[
columnNames
.
length
];
for
(
int
i
=
0
;
i
<
columnNames
.
length
;
i
++)
{
cols
[
i
]
=
new
Column
(
columnNames
[
i
],
Value
.
STRING
,
255
,
0
);
}
index
.
setRecursive
(
true
);
recursive
=
true
;
createException
=
null
;
}
}
setColumns
(
cols
);
...
...
@@ -105,6 +106,10 @@ public class TableView extends Table {
item
.
setIndex
(
index
);
return
item
;
}
public
String
getDropSQL
()
{
return
"DROP VIEW IF EXISTS "
+
getSQL
();
}
public
String
getCreateSQL
()
{
StringBuffer
buff
=
new
StringBuffer
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论