Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
46cdafb3
提交
46cdafb3
authored
7月 09, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
4656d167
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
32 个修改的文件
包含
460 行增加
和
406 行删除
+460
-406
history.html
h2/src/docsrc/html/history.html
+15
-108
console.odg
h2/src/docsrc/images/console.odg
+0
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+127
-64
AlterIndexRename.java
h2/src/main/org/h2/command/ddl/AlterIndexRename.java
+5
-4
AlterTableAddConstraint.java
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
+2
-1
DeallocateProcedure.java
h2/src/main/org/h2/command/ddl/DeallocateProcedure.java
+4
-0
PrepareProcedure.java
h2/src/main/org/h2/command/ddl/PrepareProcedure.java
+4
-0
TruncateTable.java
h2/src/main/org/h2/command/ddl/TruncateTable.java
+7
-9
ExecuteProcedure.java
h2/src/main/org/h2/command/dml/ExecuteProcedure.java
+4
-0
Set.java
h2/src/main/org/h2/command/dml/Set.java
+9
-0
SetTypes.java
h2/src/main/org/h2/command/dml/SetTypes.java
+2
-1
Procedure.java
h2/src/main/org/h2/engine/Procedure.java
+4
-0
Session.java
h2/src/main/org/h2/engine/Session.java
+11
-1
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+13
-13
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+1
-19
pg_catalog.sql
h2/src/main/org/h2/server/pg/pg_catalog.sql
+159
-152
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+3
-3
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+10
-10
Cache2Q.java
h2/src/main/org/h2/util/Cache2Q.java
+1
-1
CacheLRU.java
h2/src/main/org/h2/util/CacheLRU.java
+1
-1
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+5
-5
ObjectArray.java
h2/src/main/org/h2/util/ObjectArray.java
+1
-1
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+0
-2
ValueResultSet.java
h2/src/main/org/h2/value/ValueResultSet.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+10
-0
TestBigResult.java
h2/src/test/org/h2/test/db/TestBigResult.java
+4
-4
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-2
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+24
-1
test.in.txt
h2/src/test/org/h2/test/test.in.txt
+17
-0
WebServlet.java
h2/src/tools/org/h2/server/web/WebServlet.java
+2
-2
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+11
-0
没有找到文件。
h2/src/docsrc/html/history.html
浏览文件 @
46cdafb3
差异被折叠。
点击展开。
h2/src/docsrc/images/console.odg
浏览文件 @
46cdafb3
No preview for this file type
h2/src/main/org/h2/command/Parser.java
浏览文件 @
46cdafb3
差异被折叠。
点击展开。
h2/src/main/org/h2/command/ddl/AlterIndexRename.java
浏览文件 @
46cdafb3
...
@@ -13,13 +13,13 @@ import org.h2.index.Index;
...
@@ -13,13 +13,13 @@ import org.h2.index.Index;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.schema.Schema
;
import
org.h2.schema.Schema
;
public
class
AlterIndexRename
extends
Schema
Command
{
public
class
AlterIndexRename
extends
Define
Command
{
private
Index
oldIndex
;
private
Index
oldIndex
;
private
String
newIndexName
;
private
String
newIndexName
;
public
AlterIndexRename
(
Session
session
,
Schema
schema
)
{
public
AlterIndexRename
(
Session
session
)
{
super
(
session
,
schema
);
super
(
session
);
}
}
public
void
setOldIndex
(
Index
index
)
{
public
void
setOldIndex
(
Index
index
)
{
...
@@ -33,7 +33,8 @@ public class AlterIndexRename extends SchemaCommand {
...
@@ -33,7 +33,8 @@ public class AlterIndexRename extends SchemaCommand {
public
int
update
()
throws
SQLException
{
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
session
.
commit
(
true
);
Database
db
=
session
.
getDatabase
();
Database
db
=
session
.
getDatabase
();
if
(
getSchema
().
findIndex
(
newIndexName
)
!=
null
||
newIndexName
.
equals
(
oldIndex
.
getName
()))
{
Schema
schema
=
oldIndex
.
getSchema
();
if
(
schema
.
findIndex
(
newIndexName
)
!=
null
||
newIndexName
.
equals
(
oldIndex
.
getName
()))
{
throw
Message
.
getSQLException
(
Message
.
INDEX_ALREADY_EXISTS_1
,
newIndexName
);
throw
Message
.
getSQLException
(
Message
.
INDEX_ALREADY_EXISTS_1
,
newIndexName
);
}
}
session
.
getUser
().
checkRight
(
oldIndex
.
getTable
(),
Right
.
ALL
);
session
.
getUser
().
checkRight
(
oldIndex
.
getTable
(),
Right
.
ALL
);
...
...
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
浏览文件 @
46cdafb3
...
@@ -37,6 +37,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
...
@@ -37,6 +37,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
private
int
type
;
private
int
type
;
private
String
constraintName
;
private
String
constraintName
;
private
String
tableName
;
private
String
tableName
;
private
Table
table
;
private
String
[]
columnNames
;
private
String
[]
columnNames
;
private
int
deleteAction
;
private
int
deleteAction
;
private
int
updateAction
;
private
int
updateAction
;
...
@@ -61,12 +62,12 @@ public class AlterTableAddConstraint extends SchemaCommand {
...
@@ -61,12 +62,12 @@ public class AlterTableAddConstraint extends SchemaCommand {
public
int
update
()
throws
SQLException
{
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
session
.
commit
(
true
);
Database
db
=
session
.
getDatabase
();
Database
db
=
session
.
getDatabase
();
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
if
(
getSchema
().
findConstraint
(
constraintName
)!=
null
)
{
if
(
getSchema
().
findConstraint
(
constraintName
)!=
null
)
{
throw
Message
.
getSQLException
(
Message
.
CONSTRAINT_ALREADY_EXISTS_1
,
throw
Message
.
getSQLException
(
Message
.
CONSTRAINT_ALREADY_EXISTS_1
,
constraintName
);
constraintName
);
}
}
Constraint
constraint
;
Constraint
constraint
;
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
table
.
lock
(
session
,
true
);
table
.
lock
(
session
,
true
);
switch
(
type
)
{
switch
(
type
)
{
...
...
h2/src/main/org/h2/command/ddl/DeallocateProcedure.java
浏览文件 @
46cdafb3
/*
* 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
.
command
.
ddl
;
package
org
.
h2
.
command
.
ddl
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
...
h2/src/main/org/h2/command/ddl/PrepareProcedure.java
浏览文件 @
46cdafb3
/*
* 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
.
command
.
ddl
;
package
org
.
h2
.
command
.
ddl
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
...
h2/src/main/org/h2/command/ddl/TruncateTable.java
浏览文件 @
46cdafb3
...
@@ -9,26 +9,24 @@ import java.sql.SQLException;
...
@@ -9,26 +9,24 @@ import java.sql.SQLException;
import
org.h2.engine.Right
;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
import
org.h2.schema.Schema
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
public
class
TruncateTable
extends
Schema
Command
{
public
class
TruncateTable
extends
Define
Command
{
private
String
tableNam
e
;
private
Table
tabl
e
;
public
TruncateTable
(
Session
session
,
Schema
schema
)
{
public
TruncateTable
(
Session
session
)
{
super
(
session
,
schema
);
super
(
session
);
}
}
public
void
setTable
Name
(
String
tableNam
e
)
{
public
void
setTable
(
Table
tabl
e
)
{
this
.
table
Name
=
tableNam
e
;
this
.
table
=
tabl
e
;
}
}
public
int
update
()
throws
SQLException
{
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
session
.
commit
(
true
);
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
if
(!
table
.
canTruncate
())
{
if
(!
table
.
canTruncate
())
{
throw
Message
.
getSQLException
(
Message
.
CANNOT_TRUNCATE_1
,
table
Name
);
throw
Message
.
getSQLException
(
Message
.
CANNOT_TRUNCATE_1
,
table
.
getSQL
()
);
}
else
{
}
else
{
session
.
getUser
().
checkRight
(
table
,
Right
.
DELETE
);
session
.
getUser
().
checkRight
(
table
,
Right
.
DELETE
);
table
.
lock
(
session
,
true
);
table
.
lock
(
session
,
true
);
...
...
h2/src/main/org/h2/command/dml/ExecuteProcedure.java
浏览文件 @
46cdafb3
/*
* 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
.
command
.
dml
;
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
46cdafb3
...
@@ -36,6 +36,7 @@ public class Set extends Prepared {
...
@@ -36,6 +36,7 @@ public class Set extends Prepared {
private
int
type
;
private
int
type
;
private
Expression
expression
;
private
Expression
expression
;
private
String
stringValue
;
private
String
stringValue
;
private
String
[]
stringValueList
;
public
Set
(
Session
session
,
int
type
)
{
public
Set
(
Session
session
,
int
type
)
{
super
(
session
);
super
(
session
);
...
@@ -240,6 +241,10 @@ public class Set extends Prepared {
...
@@ -240,6 +241,10 @@ public class Set extends Prepared {
database
.
setOptimizeReuseResults
(
getIntValue
()
!=
0
);
database
.
setOptimizeReuseResults
(
getIntValue
()
!=
0
);
break
;
break
;
}
}
case
SetTypes
.
SCHEMA_SEARCH_PATH
:
{
session
.
setSchemaSearchPath
(
stringValueList
);
break
;
}
default
:
default
:
throw
Message
.
getInternalError
(
"type="
+
type
);
throw
Message
.
getInternalError
(
"type="
+
type
);
}
}
...
@@ -297,4 +302,8 @@ public class Set extends Prepared {
...
@@ -297,4 +302,8 @@ public class Set extends Prepared {
return
null
;
return
null
;
}
}
public
void
setStringArray
(
String
[]
list
)
{
this
.
stringValueList
=
list
;
}
}
}
h2/src/main/org/h2/command/dml/SetTypes.java
浏览文件 @
46cdafb3
...
@@ -16,7 +16,7 @@ public class SetTypes {
...
@@ -16,7 +16,7 @@ public class SetTypes {
public
static
final
int
MAX_MEMORY_ROWS
=
16
,
LOCK_MODE
=
17
,
DB_CLOSE_DELAY
=
18
;
public
static
final
int
MAX_MEMORY_ROWS
=
16
,
LOCK_MODE
=
17
,
DB_CLOSE_DELAY
=
18
;
public
static
final
int
LOG
=
19
,
THROTTLE
=
20
,
MAX_MEMORY_UNDO
=
21
,
MAX_LENGTH_INPLACE_LOB
=
22
;
public
static
final
int
LOG
=
19
,
THROTTLE
=
20
,
MAX_MEMORY_UNDO
=
21
,
MAX_LENGTH_INPLACE_LOB
=
22
;
public
static
final
int
COMPRESS_LOB
=
23
,
ALLOW_LITERALS
=
24
,
MULTI_THREADED
=
25
,
SCHEMA
=
26
;
public
static
final
int
COMPRESS_LOB
=
23
,
ALLOW_LITERALS
=
24
,
MULTI_THREADED
=
25
,
SCHEMA
=
26
;
public
static
final
int
OPTIMIZE_REUSE_RESULTS
=
27
;
public
static
final
int
OPTIMIZE_REUSE_RESULTS
=
27
,
SCHEMA_SEARCH_PATH
=
28
;
private
static
ObjectArray
types
=
new
ObjectArray
();
private
static
ObjectArray
types
=
new
ObjectArray
();
static
{
static
{
...
@@ -47,6 +47,7 @@ public class SetTypes {
...
@@ -47,6 +47,7 @@ public class SetTypes {
setType
(
MULTI_THREADED
,
"MULTI_THREADED"
);
setType
(
MULTI_THREADED
,
"MULTI_THREADED"
);
setType
(
SCHEMA
,
"SCHEMA"
);
setType
(
SCHEMA
,
"SCHEMA"
);
setType
(
OPTIMIZE_REUSE_RESULTS
,
"OPTIMIZE_REUSE_RESULTS"
);
setType
(
OPTIMIZE_REUSE_RESULTS
,
"OPTIMIZE_REUSE_RESULTS"
);
setType
(
SCHEMA_SEARCH_PATH
,
"SCHEMA_SEARCH_PATH"
);
}
}
private
static
void
setType
(
int
type
,
String
name
)
{
private
static
void
setType
(
int
type
,
String
name
)
{
...
...
h2/src/main/org/h2/engine/Procedure.java
浏览文件 @
46cdafb3
/*
* 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
.
engine
;
package
org
.
h2
.
engine
;
import
org.h2.command.Prepared
;
import
org.h2.command.Prepared
;
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
46cdafb3
...
@@ -55,6 +55,7 @@ public class Session implements SessionInterface {
...
@@ -55,6 +55,7 @@ public class Session implements SessionInterface {
private
Command
currentCommand
;
private
Command
currentCommand
;
private
boolean
allowLiterals
;
private
boolean
allowLiterals
;
private
String
currentSchemaName
;
private
String
currentSchemaName
;
private
String
[]
schemaSearchPath
;
private
String
traceModuleName
;
private
String
traceModuleName
;
private
HashSet
unlinkSet
;
private
HashSet
unlinkSet
;
private
int
tempViewIndex
;
private
int
tempViewIndex
;
...
@@ -62,7 +63,7 @@ public class Session implements SessionInterface {
...
@@ -62,7 +63,7 @@ public class Session implements SessionInterface {
public
Session
()
{
public
Session
()
{
}
}
public
Table
findLocalTempTable
(
String
name
)
{
public
Table
findLocalTempTable
(
String
name
)
{
Table
t
=
null
;
Table
t
=
null
;
if
(
t
==
null
&&
localTempTables
!=
null
)
{
if
(
t
==
null
&&
localTempTables
!=
null
)
{
...
@@ -503,4 +504,13 @@ public class Session implements SessionInterface {
...
@@ -503,4 +504,13 @@ public class Session implements SessionInterface {
}
}
return
(
Procedure
)
procedures
.
get
(
name
);
return
(
Procedure
)
procedures
.
get
(
name
);
}
}
public
void
setSchemaSearchPath
(
String
[]
schemas
)
{
this
.
schemaSearchPath
=
schemas
;
}
public
String
[]
getSchemaSearchPath
()
{
return
schemaSearchPath
;
}
}
}
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
46cdafb3
...
@@ -2494,7 +2494,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2494,7 +2494,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
debugCodeCall
(
"beforeFirst"
);
debugCodeCall
(
"beforeFirst"
);
checkClosed
();
checkClosed
();
if
(
result
.
getRowId
()
>=
0
)
{
if
(
result
.
getRowId
()
>=
0
)
{
resetResult
();
resetResult
();
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -2529,10 +2529,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2529,10 +2529,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
debugCodeCall
(
"first"
);
debugCodeCall
(
"first"
);
checkClosed
();
checkClosed
();
if
(
result
.
getRowId
()
<
0
)
{
if
(
result
.
getRowId
()
<
0
)
{
return
nextRow
();
return
nextRow
();
}
else
{
}
else
{
resetResult
();
resetResult
();
return
nextRow
();
return
nextRow
();
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
throw
logAndConvert
(
e
);
...
@@ -2900,18 +2900,18 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2900,18 +2900,18 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
private
boolean
nextRow
()
throws
SQLException
{
private
boolean
nextRow
()
throws
SQLException
{
boolean
next
=
result
.
next
();
boolean
next
=
result
.
next
();
if
(!
next
&&
!
scrollable
)
{
if
(!
next
&&
!
scrollable
)
{
result
.
close
();
result
.
close
();
}
}
return
next
;
return
next
;
}
}
private
void
resetResult
()
throws
SQLException
{
private
void
resetResult
()
throws
SQLException
{
if
(!
scrollable
)
{
if
(!
scrollable
)
{
throw
Message
.
getSQLException
(
Message
.
RESULT_SET_NOT_SCROLLABLE
);
throw
Message
.
getSQLException
(
Message
.
RESULT_SET_NOT_SCROLLABLE
);
}
}
result
.
reset
();
result
.
reset
();
}
}
/**
/**
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
46cdafb3
...
@@ -364,26 +364,8 @@ public class PgServerThread implements Runnable {
...
@@ -364,26 +364,8 @@ public class PgServerThread implements Runnable {
}
else
if
(
s
.
startsWith
(
"BEGIN"
))
{
}
else
if
(
s
.
startsWith
(
"BEGIN"
))
{
s
=
"set DATESTYLE ISO"
;
s
=
"set DATESTYLE ISO"
;
}
}
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_database"
,
"FROM pg_catalog.pg_database"
);
int
todoNeedToSupportInParser
;
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_user"
,
"FROM pg_catalog.pg_user"
);
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_settings"
,
"FROM pg_catalog.pg_settings"
);
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_database"
,
"FROM pg_catalog.pg_database"
);
s
=
StringUtils
.
replaceAll
(
s
,
"JOIN pg_tablespace"
,
"JOIN pg_catalog.pg_tablespace"
);
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_tablespace"
,
"FROM pg_catalog.pg_tablespace"
);
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_class"
,
"FROM pg_catalog.pg_class"
);
s
=
StringUtils
.
replaceAll
(
s
,
"from pg_class"
,
"from pg_catalog.pg_class"
);
s
=
StringUtils
.
replaceAll
(
s
,
", pg_namespace"
,
", pg_catalog.pg_namespace"
);
s
=
StringUtils
.
replaceAll
(
s
,
"JOIN pg_namespace"
,
"JOIN pg_catalog.pg_namespace"
);
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_authid"
,
"FROM pg_catalog.pg_authid"
);
s
=
StringUtils
.
replaceAll
(
s
,
"from pg_type"
,
"from pg_catalog.pg_type"
);
s
=
StringUtils
.
replaceAll
(
s
,
"join pg_attrdef"
,
"join pg_catalog.pg_attrdef"
);
s
=
StringUtils
.
replaceAll
(
s
,
"i.indkey[ia.attnum-1]"
,
"0"
);
s
=
StringUtils
.
replaceAll
(
s
,
"i.indkey[ia.attnum-1]"
,
"0"
);
s
=
StringUtils
.
replaceAll
(
s
,
"current_user"
,
"USER()"
);
s
=
StringUtils
.
replaceAll
(
s
,
"E'"
,
"'"
);
// VALUES (E'2'[*], E'Test')
if
(
s
.
indexOf
(
'$'
)
>
0
)
{
int
todoDontReplaceInQuoted
;
s
=
s
.
replace
(
'$'
,
'?'
);
}
return
s
;
return
s
;
}
}
...
...
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
46cdafb3
差异被折叠。
点击展开。
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
46cdafb3
...
@@ -248,9 +248,9 @@ public class WebServer implements Service {
...
@@ -248,9 +248,9 @@ public class WebServer implements Service {
// System.out.println(s);
// System.out.println(s);
}
}
public
void
traceError
(
Exception
e
)
{
public
void
traceError
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
public
boolean
supportsLanguage
(
String
language
)
{
public
boolean
supportsLanguage
(
String
language
)
{
return
languages
.
contains
(
language
);
return
languages
.
contains
(
language
);
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
46cdafb3
...
@@ -160,7 +160,7 @@ class WebThread extends Thread {
...
@@ -160,7 +160,7 @@ class WebThread extends Thread {
try
{
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
}
}
message
=
"HTTP/1.1 200 OK\n"
;
message
=
"HTTP/1.1 200 OK\n"
;
...
@@ -1517,16 +1517,16 @@ class WebThread extends Thread {
...
@@ -1517,16 +1517,16 @@ class WebThread extends Thread {
return
NetUtils
.
isLoopbackAddress
(
socket
);
return
NetUtils
.
isLoopbackAddress
(
socket
);
}
}
public
String
getMimeType
()
{
public
String
getMimeType
()
{
return
mimeType
;
return
mimeType
;
}
}
public
boolean
getCache
()
{
public
boolean
getCache
()
{
return
cache
;
return
cache
;
}
}
public
WebSession
getSession
()
{
public
WebSession
getSession
()
{
return
session
;
return
session
;
}
}
}
}
h2/src/main/org/h2/util/Cache2Q.java
浏览文件 @
46cdafb3
...
@@ -36,7 +36,7 @@ public class Cache2Q implements Cache {
...
@@ -36,7 +36,7 @@ public class Cache2Q implements Cache {
}
}
private
void
resize
(
int
maxSize
)
{
private
void
resize
(
int
maxSize
)
{
this
.
maxSize
=
maxSize
;
this
.
maxSize
=
maxSize
;
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
mask
=
len
-
1
;
this
.
mask
=
len
-
1
;
MathUtils
.
checkPowerOf2
(
len
);
MathUtils
.
checkPowerOf2
(
len
);
...
...
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
46cdafb3
...
@@ -34,7 +34,7 @@ public class CacheLRU implements Cache {
...
@@ -34,7 +34,7 @@ public class CacheLRU implements Cache {
}
}
private
void
resize
(
int
maxSize
)
{
private
void
resize
(
int
maxSize
)
{
this
.
maxSize
=
maxSize
;
this
.
maxSize
=
maxSize
;
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
mask
=
len
-
1
;
this
.
mask
=
len
-
1
;
MathUtils
.
checkPowerOf2
(
len
);
MathUtils
.
checkPowerOf2
(
len
);
...
...
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
46cdafb3
...
@@ -27,11 +27,11 @@ public class MathUtils {
...
@@ -27,11 +27,11 @@ public class MathUtils {
}
}
public
static
int
nextPowerOf2
(
int
x
)
{
public
static
int
nextPowerOf2
(
int
x
)
{
int
i
=
1
;
int
i
=
1
;
while
(
i
<
x
&&
i
<
(
Integer
.
MAX_VALUE
/
2
))
{
while
(
i
<
x
&&
i
<
(
Integer
.
MAX_VALUE
/
2
))
{
i
+=
i
;
i
+=
i
;
}
}
return
(
int
)
i
;
return
(
int
)
i
;
}
}
public
static
long
scaleUp50Percent
(
long
start
,
long
min
,
long
blockSize
)
{
public
static
long
scaleUp50Percent
(
long
start
,
long
min
,
long
blockSize
)
{
...
...
h2/src/main/org/h2/util/ObjectArray.java
浏览文件 @
46cdafb3
...
@@ -26,7 +26,7 @@ public class ObjectArray {
...
@@ -26,7 +26,7 @@ public class ObjectArray {
public
ObjectArray
(
int
size
)
{
public
ObjectArray
(
int
size
)
{
data
=
new
Object
[
size
>
1
?
size
:
1
];
data
=
new
Object
[
size
>
1
?
size
:
1
];
}
}
public
ObjectArray
(
Object
[]
data
)
{
public
ObjectArray
(
Object
[]
data
)
{
this
.
data
=
data
;
this
.
data
=
data
;
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
46cdafb3
...
@@ -113,7 +113,7 @@ public class DataType {
...
@@ -113,7 +113,7 @@ public class DataType {
);
);
add
(
Value
.
LONG
,
Types
.
BIGINT
,
"Long"
,
add
(
Value
.
LONG
,
Types
.
BIGINT
,
"Long"
,
createDecimal
(
ValueLong
.
PRECISION
,
ValueLong
.
PRECISION
,
0
,
false
,
true
),
createDecimal
(
ValueLong
.
PRECISION
,
ValueLong
.
PRECISION
,
0
,
false
,
true
),
new
String
[]{
"IDENTITY"
}
new
String
[]{
"IDENTITY"
,
"SERIAL"
}
);
);
add
(
Value
.
DECIMAL
,
Types
.
DECIMAL
,
"BigDecimal"
,
add
(
Value
.
DECIMAL
,
Types
.
DECIMAL
,
"BigDecimal"
,
createDecimal
(
Integer
.
MAX_VALUE
,
ValueDecimal
.
DEFAULT_PRECISION
,
ValueDecimal
.
DEFAULT_SCALE
,
true
,
false
),
createDecimal
(
Integer
.
MAX_VALUE
,
ValueDecimal
.
DEFAULT_PRECISION
,
ValueDecimal
.
DEFAULT_SCALE
,
true
,
false
),
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
46cdafb3
...
@@ -555,8 +555,6 @@ public class ValueLob extends Value {
...
@@ -555,8 +555,6 @@ public class ValueLob extends Value {
String
[]
list
=
FileUtils
.
listFiles
(
dir
);
String
[]
list
=
FileUtils
.
listFiles
(
dir
);
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
String
name
=
list
[
i
];
String
name
=
list
[
i
];
int
testing
;
// if(name.startsWith(prefix+ "." + tableId + ".") && name.endsWith(".lob.db")) {
if
(
name
.
startsWith
(
prefix
+
"."
+
tableId
+
"."
)
&&
name
.
endsWith
(
".lob.db"
))
{
if
(
name
.
startsWith
(
prefix
+
"."
+
tableId
+
"."
)
&&
name
.
endsWith
(
".lob.db"
))
{
deleteFile
(
handler
,
name
);
deleteFile
(
handler
,
name
);
}
}
...
...
h2/src/main/org/h2/value/ValueResultSet.java
浏览文件 @
46cdafb3
...
@@ -17,7 +17,7 @@ public class ValueResultSet extends Value {
...
@@ -17,7 +17,7 @@ public class ValueResultSet extends Value {
private
final
ResultSet
result
;
private
final
ResultSet
result
;
private
ValueResultSet
(
ResultSet
rs
)
{
private
ValueResultSet
(
ResultSet
rs
)
{
this
.
result
=
rs
;
this
.
result
=
rs
;
}
}
public
static
ValueResultSet
get
(
ResultSet
rs
)
throws
SQLException
{
public
static
ValueResultSet
get
(
ResultSet
rs
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
46cdafb3
...
@@ -94,6 +94,16 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
...
@@ -94,6 +94,16 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/*
/*
-- SET client_encoding = 'UTF8';
-- SET check_function_bodies = false;
-- SET client_min_messages = warning;
-- CREATE PROCEDURAL LANGUAGE plperl;
-- CREATE PROCEDURAL LANGUAGE plpgsql;
--SET search_path = public, pg_catalog;
--SET default_tablespace = '';
--SET default_with_oids = false;
--id serial NOT NULL,
pg_catalog with views
pg_catalog with views
oid (object identifier)
oid (object identifier)
...
...
h2/src/test/org/h2/test/db/TestBigResult.java
浏览文件 @
46cdafb3
...
@@ -27,18 +27,18 @@ public class TestBigResult extends TestBase {
...
@@ -27,18 +27,18 @@ public class TestBigResult extends TestBase {
stat
.
execute
(
"SET MAX_MEMORY_ROWS 2"
);
stat
.
execute
(
"SET MAX_MEMORY_ROWS 2"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM SYSTEM_RANGE(1, 100)"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM SYSTEM_RANGE(1, 100)"
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
// ignore
// ignore
}
}
// rs.close();
// rs.close();
conn
.
close
();
conn
.
close
();
deleteDb
(
"bigResult"
);
deleteDb
(
"bigResult"
);
ArrayList
files
=
FileLister
.
getDatabaseFiles
(
BASE_DIR
,
"bigResult"
,
true
);
ArrayList
files
=
FileLister
.
getDatabaseFiles
(
BASE_DIR
,
"bigResult"
,
true
);
if
(
files
.
size
()
>
0
)
{
if
(
files
.
size
()
>
0
)
{
error
(
"file not deleted: "
+
files
.
get
(
0
));
error
(
"file not deleted: "
+
files
.
get
(
0
));
}
}
}
}
private
void
testLimitBufferedResult
()
throws
Exception
{
private
void
testLimitBufferedResult
()
throws
Exception
{
deleteDb
(
"bigResult"
);
deleteDb
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
46cdafb3
...
@@ -188,8 +188,8 @@ public class TestFunctions extends TestBase {
...
@@ -188,8 +188,8 @@ public class TestFunctions extends TestBase {
}
}
public
static
ResultSet
select
(
Connection
conn
,
String
sql
)
throws
SQLException
{
public
static
ResultSet
select
(
Connection
conn
,
String
sql
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
return
stat
.
executeQuery
(
sql
);
return
stat
.
executeQuery
(
sql
);
}
}
public
static
ResultSet
selectMaxId
(
Connection
conn
)
throws
SQLException
{
public
static
ResultSet
selectMaxId
(
Connection
conn
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
46cdafb3
...
@@ -35,6 +35,7 @@ public class TestLob extends TestBase {
...
@@ -35,6 +35,7 @@ public class TestLob extends TestBase {
if
(
config
.
memory
)
{
if
(
config
.
memory
)
{
return
;
return
;
}
}
testLobDrop
();
testLobNoClose
();
testLobNoClose
();
testLobTransactions
(
10
);
testLobTransactions
(
10
);
testLobTransactions
(
10000
);
testLobTransactions
(
10000
);
...
@@ -54,6 +55,28 @@ public class TestLob extends TestBase {
...
@@ -54,6 +55,28 @@ public class TestLob extends TestBase {
testJavaObject
();
testJavaObject
();
}
}
private
void
testLobDrop
()
throws
Exception
{
if
(
config
.
logMode
==
0
||
config
.
networked
)
{
return
;
}
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
Statement
stat
=
conn
.
createStatement
();
for
(
int
i
=
0
;
i
<
500
;
i
++)
{
stat
.
execute
(
"CREATE TABLE T"
+
i
+
"(ID INT, C CLOB)"
);
}
stat
.
execute
(
"CREATE TABLE TEST(ID INT, C CLOB)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1, SPACE(10000))"
);
for
(
int
i
=
0
;
i
<
500
;
i
++)
{
stat
.
execute
(
"DROP TABLE T"
+
i
);
}
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
while
(
rs
.
next
())
{
rs
.
getString
(
"C"
);
}
conn
.
close
();
}
private
void
testLobNoClose
()
throws
Exception
{
private
void
testLobNoClose
()
throws
Exception
{
if
(
config
.
logMode
==
0
||
config
.
networked
)
{
if
(
config
.
logMode
==
0
||
config
.
networked
)
{
return
;
return
;
...
@@ -90,7 +113,7 @@ public class TestLob extends TestBase {
...
@@ -90,7 +113,7 @@ public class TestLob extends TestBase {
if
(
config
.
logMode
==
0
)
{
if
(
config
.
logMode
==
0
)
{
return
;
return
;
}
}
// Constants.LOB_CLOSE_BETWEEN_READS = true;
// Constants.LOB_CLOSE_BETWEEN_READS = true;
deleteDb
(
"lob"
);
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
Connection
conn
=
reconnect
(
null
);
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
46cdafb3
--- special grammar and test cases ---------------------------------------------------------------------------------------------
--- special grammar and test cases ---------------------------------------------------------------------------------------------
set autocommit off;
> ok
set search_path = public, information_schema;
> ok
select table_name from tables where 1=0;
> TABLE_NAME
> ----------
> rows: 0
set search_path = public;
> ok
set autocommit on;
> ok
create table script.public.x(a int);
create table script.public.x(a int);
> ok
> ok
...
...
h2/src/tools/org/h2/server/web/WebServlet.java
浏览文件 @
46cdafb3
...
@@ -127,7 +127,7 @@ public class WebServlet extends HttpServlet {
...
@@ -127,7 +127,7 @@ public class WebServlet extends HttpServlet {
try
{
try
{
bytes
=
StringUtils
.
utf8Encode
(
"File not found: "
+
file
);
bytes
=
StringUtils
.
utf8Encode
(
"File not found: "
+
file
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
}
else
{
}
else
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
...
@@ -136,7 +136,7 @@ public class WebServlet extends HttpServlet {
...
@@ -136,7 +136,7 @@ public class WebServlet extends HttpServlet {
try
{
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
}
}
resp
.
setContentType
(
mimeType
);
resp
.
setContentType
(
mimeType
);
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
46cdafb3
...
@@ -484,3 +484,14 @@ chdh biz inventec
...
@@ -484,3 +484,14 @@ chdh biz inventec
enclosing mostly dtp scrolls cars splitting replay incomplete automate
enclosing mostly dtp scrolls cars splitting replay incomplete automate
shorten
shorten
attrdef resut reltuples indrelid tuple adrelid rolconfig relnamespace attname rolpassword atttypid
represented rolname indisprimary tablespace proname rolconnlimit currtid indexdef rolcreatedb
indexrelid datdba datname adnum tgnargs attnum relam userbyid typbasetype attlen rolcanlogin
rolinherit adsrc usecreatedb superuser indexprs tgfoid indisunique spcname cleartext relpages
usesuper pgdocs tginitdeferred objoid datestyle indisclustered usename datconfig tgargs resize
tgconstrrelid classoid relhasoids pretty portals rolcatupdate rolsuper spcowner typname cet typlen
latin tgconstrname datallowconn atttypmod dattablespace attrelid ctid timestamptz atthasdef
nspname objsubid typnamespace rolcreaterole tgrelid spclocation relhasrules dont indkey postmaster
relkind autovacuum datlastsysoid attisdropped amname datacl deallocate tgdeferrable stats
spcacl relname rolvaliduntil attnotnull authid aclitem
plpgsql interrupting spring oids plperl regex
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论