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
...
...
@@ -37,14 +37,16 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>
Version 1.0 (Current)
</h3>
<h3>
Version 1.0 / TODO (Build TODO)
</h3><ul>
<li>
CREATE TABLE AS SELECT .. UNION .. did not work. Fixed.
<li>
PostgreSQL compatibility: SET SEARCH_PATH, SERIAL, CURRENT_USER, E'text', $1.
</li><li>
In some situations, when many tables with LOB columns were modified (ALTER TABLE), large objects were deleted. Fixed.
</li><li>
CREATE TABLE AS SELECT .. UNION .. did not work. Fixed.
</li><li>
New column ID for INFORMATION_SCHEMA.INDEXES, SEQUENCES, USERS, ROLES, RIGHTS,
FUNCTION_ALIASES, SCHEMATA, VIEWS, CONSTRAINTS, CONSTANTS, DOMAINS, TRIGGERS.
FUNCTION_ALIASES, SCHEMATA, VIEWS, CONSTRAINTS, CONSTANTS, DOMAINS, TRIGGERS.
</li><li>
If large result sets (backed by a temporary file) where not closed, the file was not deleted.
Now, the default result set type is FETCH_FORWARD. This means temp files are deleted
automatically (without having to close the result set explicitly). But it also means
ResultSet.beforeFirst can only be called for scrollable result sets. To create a scrollable resu
t set,
use Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).
Now, the default result set type is FETCH_FORWARD. This means temp files are deleted
automatically (without having to close the result set explicitly). But it also means
ResultSet.beforeFirst can only be called for scrollable result sets. To create a scrollable resul
t set,
use Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).
</li><li>
PreparedStatement.getMetaData is now implemented.
</li><li>
Now PreparedStatement.setBigDecimal(..) can be called with an object of a derived class
if the system property h2.allowBigDecimalExtensions is set to true.
...
...
@@ -719,104 +721,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
C-style block comments /* */ are not parsed correctly when they contain * or /
</li></ul>
<h3>
Version 0.9 / 2006-07-14 (Build 16)
</h3><ul>
<li>
The regression tests are no longer included in the jar file. This reduces the size by about 200 KB.
</li><li>
Fixed some bugs in the CSV tool. This tool should now work for most cases, but is still not fully tested.
</li><li>
The cache size is now measured in blocks and no longer in rows. Manually setting
the cache size is no longer necessary in most cases.
</li><li>
Objects of unknown type are no longer serialized to a byte array (and deserialized when calling getObject on a byte array data type)
by default. This behavior can be changed with Constants.SERIALIZE_JAVA_OBJECTS = true
</li><li>
New column IS_GENERATED in the metadata tables SEQUENCES and INDEXES
</li><li>
Optimization: deterministic subqueries are evaluated only once.
</li><li>
An exception was thrown if a scalar subquery returned no rows. Now the NULL value is used in this case.
</li><li>
IF EXISTS / IF NOT EXISTS implemented for the remaining CREATE / DROP statements.
</li><li>
ResultSetMetaData.isNullable is now implemented.
</li><li>
LIKE ... ESCAPE: The escape character may now also be an expression.
</li><li>
Compatibility: TRIM(whitespace FROM string)
</li><li>
Compatibility: SUBSTRING(string FROM start FOR length)
</li><li>
CREATE VIEW now supports a column list: CREATE VIEW TEST_V(A, B) AS ...
</li><li>
Compatibility: 'T', 'Y', 'YES', 'F', 'N', 'NO' (case insensitive) can now also be converted to boolean.
This is allowed now: WHERE BOOLEAN_FIELD='T'=(ID>1)
</li><li>
Optimization: data conversion of constants was not optimized. This is done now.
</li><li>
Compatibility: Implemented a shortcut version to declare single column referential integrity:
CREATE TABLE TEST(ID INT PRIMARY KEY, PARENT INT REFERENCES TEST)
</li><li>
Issue #126: It is possible to create multiple primary keys for the same table.
</li><li>
Issue #125: Foreign key constraints of local temporary tables are not dropped when the table is dropped.
</li><li>
Issue #124: Adding a column didn't work when the table contains a referential integrity check.
</li><li>
Issue #123: The connection to the server is lost if an abnormal exception occurs.
Example SQL statement: select 1=(1,2)
</li><li>
The H2 Console didn't parse statements containing '-' or '/' correctly. Fixed.
Now uses the same facility to split a script into SQL statements for
the RunScript tool, for the RUNSCRIPT command and for the H2 Console.
</li><li>
DatabaseMetaData.getTypeInfo: BIGINT was returning AUTO_INCREMENT=TRUE, which is wrong. Fixed.
</li></ul>
<h3>
Version 0.9 / 2006-07-01 (Build 14)
</h3><ul>
<li>
After dropping constraints and altering a table sometimes the database could not be opened. Fixed.
</li><li>
Outer joins did not always use an index even if this was possible. Fixed.
</li><li>
Issue #122: Using OFFSET in big result sets (disk buffered result sets) did not work. Fixed.
</li><li>
Support DatabaseMetaData.getSuperTables (currently returns an empty result set in every case).
</li><li>
Database names are no longer case sensitive for the Windows operating system,
because there the files names are not case sensitive.
</li><li>
If an index is created for a constraint, this index now belong to the constraint and is removed when removing the constraint.
</li><li>
Issue #121: Using a quoted table or alias name in front of a column name (SELECT "TEST".ID FROM TEST) didn't work.
</li><li>
Issue #120: Some ALTER TABLE statements didn't work when the table was in another than the main schema. Fixed.
</li><li>
Issue #119: If a table with autoincrement column is created in another schema,
it was not possible to connect to the database again.
Now opening a database first sorts the script by object type.
</li><li>
Issue #118: ALTER TABLE RENAME COLUMN doesn't work correctly. Workaround: don't use it.
</li><li>
Cache: implemented a String cache and improved the Value cache. Now uses a weak reference
to avoid OutOfMemory due to caching values.
</li><li>
Server: changed the public API a bit to allow an application to deal easier with start problems.
Now instead of Server.startTcpServer(args) use Server.createTcpServer(args).start();
</li><li>
Issue #117: Server.start...Server sometimes returned before the server was started. Solved.
</li><li>
Issue #116: Server: reduces memory usage. Reduced number of cached objects per connection.
</li><li>
Improved trace messages, and trace now starts earlier (when opening the database).
</li><li>
Simplified translation of the Web Console (a tool to convert the translation files to UTF-8).
</li><li>
Newsfeed sample application (used to create the newsfeed and newsletter).
</li><li>
New functions: MEMORY_FREE() and MEMORY_USED().
</li></ul>
<h3>
Version 0.9 / 2005-12-13
</h3><ul>
<li>
First public release.
...
...
@@ -879,6 +783,7 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>
Priority 2
</h3>
<ul>
<li>
Support OSGi: http://oscar-osgi.sourceforge.net, http://incubator.apache.org/felix/index.html
</li><li>
Clustering: recovery needs to becomes fully automatic. Global write lock feature.
</li><li>
System table / function: cache usage
</li><li>
Connection pool manager
</li><li>
Set the database in an 'exclusive' mode (restrict to one user at a time)
...
...
@@ -963,7 +868,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
http://www.jpackage.org
</li><li>
Version column (number/sequence and timestamp based)
</li><li>
Optimize getGeneratedKey: send last identity after each execute (server).
</li><li>
Clustering: recovery needs to becomes fully automatic.
</li><li>
Date: default date is '1970-01-01' (is it 1900-01-01 in the standard / other databases?)
</li><li>
Test and document UPDATE TEST SET (ID, NAME) = (SELECT ID*10, NAME || '!' FROM TEST T WHERE T.ID=TEST.ID);
</li><li>
Better space re-use in the files after deleting data (shrink the files)
...
...
@@ -987,7 +891,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
ValueInt.convertToString and so on (remove Value.convertTo)
</li><li>
Support custom Collators
</li><li>
Document ROWNUM usage for reports: SELECT ROWNUM, * FROM (subquery)
</li><li>
Clustering: Reads should be randomly distributed or to a designated database on RAM
</li><li>
Clustering: When a database is back alive, automatically synchronize with the master
</li><li>
Standalone tool to get relevant system properties and add it to the trace output.
...
...
@@ -1029,10 +932,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
Improved full text search (supports LOBs, reader / tokenizer / filter).
</li><li>
Performance: Update in-place
</li><li>
Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess)
</li><li>
Remove finally() (almost) everywhere
</li><li>
Java static code analysis: http://pmd.sourceforge.net/
</li><li>
Java static code analysis: http://www.eclipse.org/tptp/
</li><li>
Java static code analysis: http://checkstyle.sourceforge.net/
</li><li>
Compatibility for CREATE SCHEMA AUTHORIZATION
</li><li>
Implement Clob / Blob truncate and the remaining functionality
</li><li>
Maybe close LOBs after closing connection
...
...
@@ -1126,6 +1027,12 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response
</li><li>
Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server)
</li><li>
GROUP BY and DISTINCT: support large groups (buffer to disk), do not keep large sets in memory
</li><li>
Regular expression replaceAll: REGEXP_REPLACE(expression, regex, replacement)
</li><li>
Regular expression LIKE: expression REGEXP matchExpression
</li><li>
Support native XML data type
</li><li>
Support triggers with a string property or option: SpringTrigger, OSGITrigger
</li><li>
Clustering: adding a node should be very fast and without interrupting clients (very short lock)
</li><li>
Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true
</li></ul>
<h3>
Not Planned
</h3>
...
...
h2/src/docsrc/images/console.odg
浏览文件 @
46cdafb3
No preview for this file type
h2/src/main/org/h2/command/Parser.java
浏览文件 @
46cdafb3
...
...
@@ -601,8 +601,7 @@ public class Parser {
}
private
TableFilter
readSimpleTableFilter
()
throws
SQLException
{
String
tableName
=
readIdentifierWithSchema
();
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
Table
table
=
readTableOrView
();
String
alias
=
null
;
if
(
readIf
(
"AS"
))
{
alias
=
readAliasIdentifier
();
...
...
@@ -691,8 +690,7 @@ public class Parser {
Merge
command
=
new
Merge
(
session
);
currentPrepared
=
command
;
read
(
"INTO"
);
String
tableName
=
readIdentifierWithSchema
();
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
Table
table
=
readTableOrView
();
command
.
setTable
(
table
);
if
(
readIf
(
"("
))
{
Column
[]
columns
=
parseColumnList
(
table
);
...
...
@@ -731,8 +729,7 @@ public class Parser {
Insert
command
=
new
Insert
(
session
);
currentPrepared
=
command
;
read
(
"INTO"
);
String
tableName
=
readIdentifierWithSchema
();
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
Table
table
=
readTableOrView
();
command
.
setTable
(
table
);
if
(
readIf
(
"("
))
{
Column
[]
columns
=
parseColumnList
(
table
);
...
...
@@ -793,7 +790,7 @@ public class Parser {
return
top
;
}
}
else
{
String
tableName
=
readIdentifierWithSchema
();
String
tableName
=
readIdentifierWithSchema
(
null
);
if
(
readIf
(
"("
))
{
if
(
tableName
.
equals
(
RangeTable
.
NAME
))
{
long
min
=
readLong
();
...
...
@@ -811,7 +808,7 @@ public class Parser {
}
else
if
(
tableName
.
equals
(
"DUAL"
))
{
table
=
new
RangeTable
(
mainSchema
,
1
,
1
);
}
else
{
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
table
=
readTableOrView
(
tableName
);
}
}
String
alias
=
null
;
...
...
@@ -829,9 +826,9 @@ public class Parser {
private
Prepared
parseTruncate
()
throws
SQLException
{
read
(
"TABLE"
);
String
tableName
=
readIdentifierWithSchema
();
TruncateTable
command
=
new
TruncateTable
(
session
,
getSchema
()
);
command
.
setTable
Name
(
tableNam
e
);
Table
table
=
readTableOrView
();
TruncateTable
command
=
new
TruncateTable
(
session
);
command
.
setTable
(
tabl
e
);
return
command
;
}
...
...
@@ -1904,6 +1901,8 @@ public class Parser {
}
}
else
if
(
readIf
(
"("
))
{
return
readFunction
(
name
);
}
else
if
(
"CURRENT_USER"
.
equals
(
name
))
{
return
readFunctionWithoutParameters
(
"USER"
);
}
else
if
(
"CURRENT"
.
equals
(
name
))
{
if
(
readIf
(
"TIMESTAMP"
))
{
return
readFunctionWithoutParameters
(
"CURRENT_TIMESTAMP"
);
...
...
@@ -1916,8 +1915,7 @@ public class Parser {
}
}
else
if
(
"NEXT"
.
equals
(
name
)
&&
readIf
(
"VALUE"
))
{
read
(
"FOR"
);
String
sequenceName
=
readIdentifierWithSchema
();
Sequence
sequence
=
getSchema
().
getSequence
(
sequenceName
);
Sequence
sequence
=
readSequence
();
return
new
SequenceValue
(
sequence
);
}
else
if
(
"DATE"
.
equals
(
name
)
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
STRING
)
{
String
date
=
currentValue
.
getString
();
...
...
@@ -1931,6 +1929,10 @@ public class Parser {
String
timestamp
=
currentValue
.
getString
();
read
();
return
ValueExpression
.
get
(
ValueTimestamp
.
getNoCopy
(
ValueTimestamp
.
parseTimestamp
(
timestamp
)));
}
else
if
(
"E"
.
equals
(
name
)
&&
currentTokenType
==
VALUE
&&
currentValue
.
getType
()
==
Value
.
STRING
)
{
String
text
=
currentValue
.
getString
();
read
();
return
ValueExpression
.
get
(
ValueString
.
get
(
text
));
}
else
{
return
new
ExpressionColumn
(
database
,
currentSelect
,
null
,
null
,
name
);
}
...
...
@@ -2489,6 +2491,7 @@ public class Parser {
case
'+'
:
case
'%'
:
case
'?'
:
case
'$'
:
type
=
CHAR_SPECIAL_1
;
break
;
case
'!'
:
...
...
@@ -2587,6 +2590,7 @@ public class Parser {
if
(
s
.
length
()==
1
)
{
switch
(
c0
)
{
case
'?'
:
case
'$'
:
return
PARAMETER
;
case
'+'
:
return
PLUS
;
...
...
@@ -2757,7 +2761,7 @@ public class Parser {
private
Column
parseColumnForTable
(
String
columnName
)
throws
SQLException
{
Column
column
;
if
(
readIf
(
"IDENTITY"
))
{
if
(
readIf
(
"IDENTITY"
)
||
readIf
(
"SERIAL"
)
)
{
column
=
new
Column
(
columnName
,
Value
.
LONG
,
ValueLong
.
PRECISION
,
0
);
column
.
setOriginalSQL
(
"IDENTITY"
);
long
start
=
1
,
increment
=
1
;
...
...
@@ -2828,8 +2832,7 @@ public class Parser {
column
.
setConvertNullToDefault
(
true
);
}
if
(
readIf
(
"SEQUENCE"
))
{
String
sequenceName
=
readIdentifierWithSchema
();
Sequence
sequence
=
getSchema
().
getSequence
(
sequenceName
);
Sequence
sequence
=
readSequence
();
column
.
setSequence
(
sequence
);
}
if
(
readIf
(
"SELECTIVITY"
))
{
...
...
@@ -3081,8 +3084,7 @@ public class Parser {
if
(!
isRoleBased
)
{
if
(
readIf
(
"ON"
))
{
do
{
String
tableName
=
readIdentifierWithSchema
();
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
Table
table
=
readTableOrView
();
command
.
addTable
(
table
);
}
while
(
readIf
(
","
));
}
...
...
@@ -3357,11 +3359,11 @@ public class Parser {
private
AlterIndexRename
parseAlterIndex
()
throws
SQLException
{
String
indexName
=
readIdentifierWithSchema
();
Schema
old
=
getSchema
();
AlterIndexRename
command
=
new
AlterIndexRename
(
session
,
getSchema
()
);
AlterIndexRename
command
=
new
AlterIndexRename
(
session
);
command
.
setOldIndex
(
getSchema
().
getIndex
(
indexName
));
read
(
"RENAME"
);
read
(
"TO"
);
String
newName
=
readIdentifierWithSchema
(
old
.
get
SQL
());
String
newName
=
readIdentifierWithSchema
(
old
.
get
Name
());
checkSchema
(
old
);
command
.
setNewName
(
newName
);
return
command
;
...
...
@@ -3438,28 +3440,34 @@ public class Parser {
}
throw
getSyntaxError
();
}
private
void
readIfEqualOrTo
()
throws
SQLException
{
if
(!
readIf
(
"="
))
{
readIf
(
"TO"
);
}
}
private
Prepared
parseSet
()
throws
SQLException
{
if
(
readIf
(
"AUTOCOMMIT"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
boolean
value
=
readBooleanSetting
();
int
setting
=
value
?
TransactionCommand
.
AUTOCOMMIT_TRUE
:
TransactionCommand
.
AUTOCOMMIT_FALSE
;
return
new
TransactionCommand
(
session
,
setting
);
}
else
if
(
readIf
(
"IGNORECASE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
();
boolean
value
=
readBooleanSetting
();
Set
command
=
new
Set
(
session
,
SetTypes
.
IGNORECASE
);
command
.
setInt
(
value
?
1
:
0
);
return
command
;
}
else
if
(
readIf
(
"PASSWORD"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
AlterUser
command
=
new
AlterUser
(
session
);
command
.
setType
(
AlterUser
.
SET_PASSWORD
);
command
.
setUser
(
session
.
getUser
());
command
.
setPassword
(
readString
());
return
command
;
}
else
if
(
readIf
(
"SALT"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
AlterUser
command
=
new
AlterUser
(
session
);
command
.
setType
(
AlterUser
.
SET_PASSWORD
);
command
.
setUser
(
session
.
getUser
());
...
...
@@ -3468,12 +3476,12 @@ public class Parser {
command
.
setHash
(
readString
());
return
command
;
}
else
if
(
readIf
(
"MODE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
MODE
);
command
.
setString
(
readAliasIdentifier
());
return
command
;
}
else
if
(
readIf
(
"COMPRESS_LOB"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
COMPRESS_LOB
);
if
(
currentTokenType
==
VALUE
)
{
command
.
setString
(
readString
());
...
...
@@ -3482,24 +3490,24 @@ public class Parser {
}
return
command
;
}
else
if
(
readIf
(
"DATABASE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
(
"COLLATION"
);
return
parseSetCollation
();
}
else
if
(
readIf
(
"COLLATION"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
return
parseSetCollation
();
}
else
if
(
readIf
(
"CLUSTER"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
CLUSTER
);
command
.
setString
(
readString
());
return
command
;
}
else
if
(
readIf
(
"DATABASE_EVENT_LISTENER"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
DATABASE_EVENT_LISTENER
);
command
.
setString
(
readString
());
return
command
;
}
else
if
(
readIf
(
"ALLOW_LITERALS"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
ALLOW_LITERALS
);
if
(
readIf
(
"NONE"
))
{
command
.
setInt
(
Constants
.
ALLOW_LITERALS_NONE
);
...
...
@@ -3512,7 +3520,7 @@ public class Parser {
}
return
command
;
}
else
if
(
readIf
(
"DEFAULT_TABLE_TYPE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
DEFAULT_TABLE_TYPE
);
if
(
readIf
(
"MEMORY"
))
{
command
.
setInt
(
Table
.
TYPE_MEMORY
);
...
...
@@ -3523,56 +3531,68 @@ public class Parser {
}
return
command
;
}
else
if
(
readIf
(
"CREATE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
// Derby compatibility (CREATE=TRUE in the database URL)
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"HSQLDB.DEFAULT_TABLE_TYPE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"CACHE_TYPE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"FILE_LOCK"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"STORAGE"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"DB_CLOSE_ON_EXIT"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"ACCESS_MODE_LOG"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"ASSERT"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"ACCESS_MODE_DATA"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"RECOVER"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
();
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"SCHEMA"
))
{
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
SetTypes
.
SCHEMA
);
command
.
setString
(
readAliasIdentifier
());
return
command
;
}
else
if
(
readIf
(
"DATESTYLE"
))
{
// PostgreSQL compatibility
readIf
(
"="
);
readIf
EqualOrTo
(
);
read
(
"ISO"
);
return
new
NoOperation
(
session
);
}
else
if
(
readIf
(
"SEARCH_PATH"
)
||
readIf
(
SetTypes
.
getTypeName
(
SetTypes
.
SCHEMA_SEARCH_PATH
)))
{
readIfEqualOrTo
();
Set
command
=
new
Set
(
session
,
SetTypes
.
SCHEMA_SEARCH_PATH
);
ObjectArray
list
=
new
ObjectArray
();
list
.
add
(
readAliasIdentifier
());
while
(
readIf
(
","
))
{
list
.
add
(
readAliasIdentifier
());
}
String
[]
schemaNames
=
new
String
[
list
.
size
()];
list
.
toArray
(
schemaNames
);
command
.
setStringArray
(
schemaNames
);
return
command
;
}
else
{
if
(
isToken
(
"LOGSIZE"
))
{
// HSQLDB compatibility
...
...
@@ -3581,7 +3601,7 @@ public class Parser {
int
type
=
SetTypes
.
getType
(
currentToken
);
if
(
type
>=
0
)
{
read
();
readIf
(
"="
);
readIf
EqualOrTo
(
);
Set
command
=
new
Set
(
session
,
type
);
command
.
setExpression
(
readExpression
());
return
command
;
...
...
@@ -3674,13 +3694,56 @@ public class Parser {
}
return
command
;
}
private
Table
readTableOrView
()
throws
SQLException
{
return
readTableOrView
(
readIdentifierWithSchema
(
null
));
}
private
Table
readTableOrView
(
String
tableName
)
throws
SQLException
{
// same algorithm than readSequence
if
(
schemaName
!=
null
)
{
return
getSchema
().
getTableOrView
(
session
,
tableName
);
}
Table
table
=
database
.
getSchema
(
session
.
getCurrentSchemaName
()).
findTableOrView
(
session
,
tableName
);
if
(
table
!=
null
)
{
return
table
;
}
String
[]
schemaNames
=
session
.
getSchemaSearchPath
();
for
(
int
i
=
0
;
schemaNames
!=
null
&&
i
<
schemaNames
.
length
;
i
++)
{
Schema
s
=
database
.
getSchema
(
schemaNames
[
i
]);
table
=
s
.
findTableOrView
(
session
,
tableName
);
if
(
table
!=
null
)
{
return
table
;
}
}
throw
Message
.
getSQLException
(
Message
.
TABLE_OR_VIEW_NOT_FOUND_1
,
tableName
);
}
private
Sequence
readSequence
()
throws
SQLException
{
// same algorithm than readTableOrView
String
sequenceName
=
readIdentifierWithSchema
(
null
);
if
(
schemaName
!=
null
)
{
return
getSchema
().
getSequence
(
sequenceName
);
}
Sequence
sequence
=
database
.
getSchema
(
session
.
getCurrentSchemaName
()).
findSequence
(
sequenceName
);
if
(
sequence
!=
null
)
{
return
sequence
;
}
String
[]
schemaNames
=
session
.
getSchemaSearchPath
();
for
(
int
i
=
0
;
schemaNames
!=
null
&&
i
<
schemaNames
.
length
;
i
++)
{
Schema
s
=
database
.
getSchema
(
schemaNames
[
i
]);
sequence
=
s
.
findSequence
(
sequenceName
);
if
(
sequence
!=
null
)
{
return
sequence
;
}
}
throw
Message
.
getSQLException
(
Message
.
SEQUENCE_NOT_FOUND_1
,
sequenceName
);
}
private
Prepared
parseAlterTable
()
throws
SQLException
{
String
tableName
=
readIdentifierWithSchema
();
Schema
tableSchema
=
getSchema
();
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
Table
table
=
readTableOrView
();
if
(
readIf
(
"ADD"
))
{
Prepared
command
=
parseAlterTableAddConstraintIf
(
getSchema
(),
tableName
);
Prepared
command
=
parseAlterTableAddConstraintIf
(
table
.
getName
(),
table
.
getSchema
()
);
if
(
command
!=
null
)
{
return
command
;
}
...
...
@@ -3694,34 +3757,34 @@ public class Parser {
read
(
"FALSE"
);
type
=
AlterTableAddConstraint
.
REFERENTIAL_INTEGRITY_FALSE
;
}
AlterTableAddConstraint
command
=
new
AlterTableAddConstraint
(
session
,
getSchema
());
command
.
setTableName
(
table
Name
);
AlterTableAddConstraint
command
=
new
AlterTableAddConstraint
(
session
,
table
.
getSchema
());
command
.
setTableName
(
table
.
getName
()
);
command
.
setType
(
type
);
return
command
;
}
else
if
(
readIf
(
"RENAME"
))
{
read
(
"TO"
);
String
newName
=
readIdentifierWithSchema
(
table
Schema
.
getSQL
());
checkSchema
(
table
Schema
);
String
newName
=
readIdentifierWithSchema
(
table
.
getSchema
().
getName
());
checkSchema
(
table
.
getSchema
()
);
AlterTableRename
command
=
new
AlterTableRename
(
session
,
getSchema
());
command
.
setOldTable
(
table
);
command
.
setNewTableName
(
newName
);
return
command
;
}
else
if
(
readIf
(
"DROP"
))
{
if
(
readIf
(
"CONSTRAINT"
))
{
String
constraintName
=
readIdentifierWithSchema
(
table
Schema
.
getSQL
());
checkSchema
(
table
Schema
);
String
constraintName
=
readIdentifierWithSchema
(
table
.
getSchema
().
getName
());
checkSchema
(
table
.
getSchema
()
);
AlterTableDropConstraint
command
=
new
AlterTableDropConstraint
(
session
,
getSchema
());
command
.
setConstraintName
(
constraintName
);
return
command
;
}
else
if
(
readIf
(
"PRIMARY"
))
{
read
(
"KEY"
);
Index
idx
=
table
.
getPrimaryKey
();
DropIndex
command
=
new
DropIndex
(
session
,
table
Schema
);
DropIndex
command
=
new
DropIndex
(
session
,
table
.
getSchema
()
);
command
.
setIndexName
(
idx
.
getName
());
return
command
;
}
else
{
readIf
(
"COLUMN"
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setType
(
AlterTableAlterColumn
.
DROP
);
String
columnName
=
readColumnIdentifier
();
command
.
setTable
(
table
);
...
...
@@ -3745,14 +3808,14 @@ public class Parser {
// Derby compatibility
read
(
"TYPE"
);
Column
newColumn
=
parseColumnForTable
(
columnName
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setTable
(
table
);
command
.
setType
(
AlterTableAlterColumn
.
CHANGE_TYPE
);
command
.
setOldColumn
(
column
);
command
.
setNewColumn
(
newColumn
);
return
command
;
}
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setTable
(
table
);
command
.
setOldColumn
(
column
);
if
(
readIf
(
"NULL"
))
{
...
...
@@ -3771,7 +3834,7 @@ public class Parser {
}
else
if
(
readIf
(
"RESTART"
))
{
readIf
(
"WITH"
);
long
start
=
readLong
();
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setTable
(
table
);
command
.
setType
(
AlterTableAlterColumn
.
RESTART
);
command
.
setOldColumn
(
column
);
...
...
@@ -3779,7 +3842,7 @@ public class Parser {
return
command
;
}
else
if
(
readIf
(
"SELECTIVITY"
))
{
int
selectivity
=
getPositiveInt
();
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setTable
(
table
);
command
.
setType
(
AlterTableAlterColumn
.
SELECTIVITY
);
command
.
setOldColumn
(
column
);
...
...
@@ -3787,7 +3850,7 @@ public class Parser {
return
command
;
}
else
{
Column
newColumn
=
parseColumnForTable
(
columnName
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
Schema
);
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
table
.
getSchema
()
);
command
.
setTable
(
table
);
command
.
setType
(
AlterTableAlterColumn
.
CHANGE_TYPE
);
command
.
setOldColumn
(
column
);
...
...
@@ -3832,7 +3895,7 @@ public class Parser {
}
}
private
Prepared
parseAlterTableAddConstraintIf
(
S
chema
schema
,
String
tableName
)
throws
SQLException
{
private
Prepared
parseAlterTableAddConstraintIf
(
S
tring
tableName
,
Schema
schema
)
throws
SQLException
{
String
name
=
null
,
comment
=
null
;
if
(
readIf
(
"CONSTRAINT"
))
{
name
=
readIdentifierWithSchema
(
schema
.
getName
());
...
...
@@ -3989,7 +4052,7 @@ public class Parser {
read
(
"("
);
if
(!
readIf
(
")"
))
{
do
{
Prepared
c
=
parseAlterTableAddConstraintIf
(
schema
,
tableName
);
Prepared
c
=
parseAlterTableAddConstraintIf
(
tableName
,
schema
);
if
(
c
!=
null
)
{
command
.
addConstraintCommand
(
c
);
}
else
{
...
...
h2/src/main/org/h2/command/ddl/AlterIndexRename.java
浏览文件 @
46cdafb3
...
...
@@ -13,13 +13,13 @@ import org.h2.index.Index;
import
org.h2.message.Message
;
import
org.h2.schema.Schema
;
public
class
AlterIndexRename
extends
Schema
Command
{
public
class
AlterIndexRename
extends
Define
Command
{
private
Index
oldIndex
;
private
String
newIndexName
;
public
AlterIndexRename
(
Session
session
,
Schema
schema
)
{
super
(
session
,
schema
);
public
AlterIndexRename
(
Session
session
)
{
super
(
session
);
}
public
void
setOldIndex
(
Index
index
)
{
...
...
@@ -33,7 +33,8 @@ public class AlterIndexRename extends SchemaCommand {
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
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
);
}
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 {
private
int
type
;
private
String
constraintName
;
private
String
tableName
;
private
Table
table
;
private
String
[]
columnNames
;
private
int
deleteAction
;
private
int
updateAction
;
...
...
@@ -61,12 +62,12 @@ public class AlterTableAddConstraint extends SchemaCommand {
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
Database
db
=
session
.
getDatabase
();
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
if
(
getSchema
().
findConstraint
(
constraintName
)!=
null
)
{
throw
Message
.
getSQLException
(
Message
.
CONSTRAINT_ALREADY_EXISTS_1
,
constraintName
);
}
Constraint
constraint
;
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
table
.
lock
(
session
,
true
);
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
;
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
;
import
java.sql.SQLException
;
...
...
h2/src/main/org/h2/command/ddl/TruncateTable.java
浏览文件 @
46cdafb3
...
...
@@ -9,26 +9,24 @@ import java.sql.SQLException;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.schema.Schema
;
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
)
{
super
(
session
,
schema
);
public
TruncateTable
(
Session
session
)
{
super
(
session
);
}
public
void
setTable
Name
(
String
tableNam
e
)
{
this
.
table
Name
=
tableNam
e
;
public
void
setTable
(
Table
tabl
e
)
{
this
.
table
=
tabl
e
;
}
public
int
update
()
throws
SQLException
{
session
.
commit
(
true
);
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
if
(!
table
.
canTruncate
())
{
throw
Message
.
getSQLException
(
Message
.
CANNOT_TRUNCATE_1
,
table
Name
);
throw
Message
.
getSQLException
(
Message
.
CANNOT_TRUNCATE_1
,
table
.
getSQL
()
);
}
else
{
session
.
getUser
().
checkRight
(
table
,
Right
.
DELETE
);
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
;
import
java.sql.SQLException
;
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
46cdafb3
...
...
@@ -36,6 +36,7 @@ public class Set extends Prepared {
private
int
type
;
private
Expression
expression
;
private
String
stringValue
;
private
String
[]
stringValueList
;
public
Set
(
Session
session
,
int
type
)
{
super
(
session
);
...
...
@@ -240,6 +241,10 @@ public class Set extends Prepared {
database
.
setOptimizeReuseResults
(
getIntValue
()
!=
0
);
break
;
}
case
SetTypes
.
SCHEMA_SEARCH_PATH
:
{
session
.
setSchemaSearchPath
(
stringValueList
);
break
;
}
default
:
throw
Message
.
getInternalError
(
"type="
+
type
);
}
...
...
@@ -297,4 +302,8 @@ public class Set extends Prepared {
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 {
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
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
();
static
{
...
...
@@ -47,6 +47,7 @@ public class SetTypes {
setType
(
MULTI_THREADED
,
"MULTI_THREADED"
);
setType
(
SCHEMA
,
"SCHEMA"
);
setType
(
OPTIMIZE_REUSE_RESULTS
,
"OPTIMIZE_REUSE_RESULTS"
);
setType
(
SCHEMA_SEARCH_PATH
,
"SCHEMA_SEARCH_PATH"
);
}
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
;
import
org.h2.command.Prepared
;
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
46cdafb3
...
...
@@ -55,6 +55,7 @@ public class Session implements SessionInterface {
private
Command
currentCommand
;
private
boolean
allowLiterals
;
private
String
currentSchemaName
;
private
String
[]
schemaSearchPath
;
private
String
traceModuleName
;
private
HashSet
unlinkSet
;
private
int
tempViewIndex
;
...
...
@@ -62,7 +63,7 @@ public class Session implements SessionInterface {
public
Session
()
{
}
public
Table
findLocalTempTable
(
String
name
)
{
Table
t
=
null
;
if
(
t
==
null
&&
localTempTables
!=
null
)
{
...
...
@@ -503,4 +504,13 @@ public class Session implements SessionInterface {
}
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 {
debugCodeCall
(
"beforeFirst"
);
checkClosed
();
if
(
result
.
getRowId
()
>=
0
)
{
resetResult
();
resetResult
();
}
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -2529,10 +2529,10 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
debugCodeCall
(
"first"
);
checkClosed
();
if
(
result
.
getRowId
()
<
0
)
{
return
nextRow
();
return
nextRow
();
}
else
{
resetResult
();
return
nextRow
();
resetResult
();
return
nextRow
();
}
}
catch
(
Throwable
e
)
{
throw
logAndConvert
(
e
);
...
...
@@ -2900,18 +2900,18 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
private
boolean
nextRow
()
throws
SQLException
{
boolean
next
=
result
.
next
();
if
(!
next
&&
!
scrollable
)
{
result
.
close
();
}
return
next
;
boolean
next
=
result
.
next
();
if
(!
next
&&
!
scrollable
)
{
result
.
close
();
}
return
next
;
}
private
void
resetResult
()
throws
SQLException
{
if
(!
scrollable
)
{
throw
Message
.
getSQLException
(
Message
.
RESULT_SET_NOT_SCROLLABLE
);
}
result
.
reset
();
if
(!
scrollable
)
{
throw
Message
.
getSQLException
(
Message
.
RESULT_SET_NOT_SCROLLABLE
);
}
result
.
reset
();
}
/**
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
46cdafb3
...
...
@@ -364,26 +364,8 @@ public class PgServerThread implements Runnable {
}
else
if
(
s
.
startsWith
(
"BEGIN"
))
{
s
=
"set DATESTYLE ISO"
;
}
s
=
StringUtils
.
replaceAll
(
s
,
"FROM pg_database"
,
"FROM pg_catalog.pg_database"
);
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"
);
int
todoNeedToSupportInParser
;
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
;
}
...
...
h2/src/main/org/h2/server/pg/pg_catalog.sql
浏览文件 @
46cdafb3
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
;
drop
schema
if
exists
pg_catalog
;
create
schema
pg_catalog
;
set
search_path
=
PUBLIC
,
pg_catalog
;
create
table
pg_catalog
.
pg_namespace
-- (oid, nspname)
as
select
id
oid
,
cast
(
schema_name
as
varchar_ignorecase
)
nspname
id
oid
,
cast
(
schema_name
as
varchar_ignorecase
)
nspname
from
information_schema
.
schemata
;
create
table
pg_catalog
.
pg_type
(
oid
int
,
typname
varchar_ignorecase
,
typnamespace
int
,
typlen
int
,
typbasetype
int
);
oid
int
,
typname
varchar_ignorecase
,
typnamespace
int
,
typlen
int
,
typbasetype
int
);
insert
into
pg_catalog
.
pg_type
select
data_type
oid
,
cast
(
type_name
as
varchar_ignorecase
)
typname
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
)
typnamespace
,
-
1
typlen
,
0
typbasetype
data_type
oid
,
cast
(
type_name
as
varchar_ignorecase
)
typname
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
)
typnamespace
,
-
1
typlen
,
0
typbasetype
from
information_schema
.
type_info
;
insert
into
pg_catalog
.
pg_type
values
(
1111
,
'name'
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
-
1
,
0
1111
,
'name'
,
(
select
oid
from
pg_catalog
.
pg_namespace
where
nspname
=
'pg_catalog'
),
-
1
,
0
);
create
table
pg_catalog
.
pg_class
-- (oid, relname, relnamespace, relkind, relam, reltuples, relpages, relhasrules, relhasoids)
as
select
id
oid
,
cast
(
table_name
as
varchar_ignorecase
)
relname
,
(
select
id
from
information_schema
.
schemata
where
schema_name
=
table_schema
)
relnamespace
,
case
table_type
when
'TABLE'
then
'r'
else
'v'
end
relkind
,
0
relam
,
cast
(
0
as
float
)
reltuples
,
0
relpages
,
false
relhasrules
,
false
relhasoids
id
oid
,
cast
(
table_name
as
varchar_ignorecase
)
relname
,
(
select
id
from
information_schema
.
schemata
where
schema_name
=
table_schema
)
relnamespace
,
case
table_type
when
'TABLE'
then
'r'
else
'v'
end
relkind
,
0
relam
,
cast
(
0
as
float
)
reltuples
,
0
relpages
,
false
relhasrules
,
false
relhasoids
from
information_schema
.
tables
union
all
select
id
oid
,
cast
(
index_name
as
varchar_ignorecase
)
relname
,
(
select
id
from
information_schema
.
schemata
where
schema_name
=
table_schema
)
relnamespace
,
'i'
relkind
,
0
relam
,
cast
(
0
as
float
)
reltuples
,
0
relpages
,
false
relhasrules
,
false
relhasoids
id
oid
,
cast
(
index_name
as
varchar_ignorecase
)
relname
,
(
select
id
from
information_schema
.
schemata
where
schema_name
=
table_schema
)
relnamespace
,
'i'
relkind
,
0
relam
,
cast
(
0
as
float
)
reltuples
,
0
relpages
,
false
relhasrules
,
false
relhasoids
from
information_schema
.
indexes
;
create
table
pg_catalog
.
pg_description
-- (objoid, objsubid, classoid, description)
as
select
id
objoid
,
0
objsubid
,
-
1
classoid
,
cast
(
''
as
varchar_ignorecase
)
description
id
objoid
,
0
objsubid
,
-
1
classoid
,
cast
(
''
as
varchar_ignorecase
)
description
from
information_schema
.
tables
where
1
=
0
;
create
table
pg_catalog
.
pg_proc
(
oid
int
,
proname
varchar_ignorecase
oid
int
,
proname
varchar_ignorecase
);
create
table
pg_catalog
.
pg_trigger
(
oid
int
,
tgconstrrelid
int
,
tgfoid
int
,
tgargs
int
,
tgnargs
int
,
tgdeferrable
boolean
,
tginitdeferred
boolean
,
tgconstrname
varchar_ignorecase
,
tgrelid
int
oid
int
,
tgconstrrelid
int
,
tgfoid
int
,
tgargs
int
,
tgnargs
int
,
tgdeferrable
boolean
,
tginitdeferred
boolean
,
tgconstrname
varchar_ignorecase
,
tgrelid
int
);
create
table
pg_catalog
.
pg_attrdef
-- (oid, adsrc, adrelid, adnum)
as
select
id
oid
,
0
adsrc
,
0
adrelid
,
0
adnum
id
oid
,
0
adsrc
,
0
adrelid
,
0
adnum
from
information_schema
.
tables
where
1
=
0
;
create
table
pg_catalog
.
pg_attribute
-- (oid, attrelid, attname, atttypid, attlen, attnum, atttypmod, attnotnull, attisdropped, atthasdef)
as
select
t
.
id
*
10000
+
c
.
ordinal_position
oid
,
t
.
id
attrelid
,
c
.
column_name
attname
,
data_type
atttypid
,
-
1
attlen
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
false
attnotnull
,
false
attisdropped
,
false
atthasdef
t
.
id
*
10000
+
c
.
ordinal_position
oid
,
t
.
id
attrelid
,
c
.
column_name
attname
,
data_type
atttypid
,
-
1
attlen
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
false
attnotnull
,
false
attisdropped
,
false
atthasdef
from
information_schema
.
tables
t
,
information_schema
.
columns
c
where
t
.
table_name
=
c
.
table_name
and
t
.
table_schema
=
c
.
table_schema
union
all
select
1000000
+
t
.
id
*
10000
+
c
.
ordinal_position
oid
,
i
.
id
attrelid
,
c
.
column_name
attname
,
data_type
atttypid
,
-
1
attlen
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
false
attnotnull
,
false
attisdropped
,
false
atthasdef
1000000
+
t
.
id
*
10000
+
c
.
ordinal_position
oid
,
i
.
id
attrelid
,
c
.
column_name
attname
,
data_type
atttypid
,
-
1
attlen
,
c
.
ordinal_position
attnum
,
-
1
atttypmod
,
false
attnotnull
,
false
attisdropped
,
false
atthasdef
from
information_schema
.
tables
t
,
information_schema
.
indexes
i
,
information_schema
.
columns
c
where
t
.
table_name
=
i
.
table_name
and
t
.
table_schema
=
i
.
table_schema
...
...
@@ -130,14 +137,14 @@ and t.table_schema = c.table_schema;
create
table
pg_catalog
.
pg_index
-- (oid, indexrelid, indrelid, indisclustered, indisunique, indisprimary, indexprs, indkey)
as
select
i
.
id
oid
,
i
.
id
indexrelid
,
t
.
id
indrelid
,
false
indisclustered
,
not
non_unique
indisunique
,
primary_key
indisprimary
,
cast
(
null
as
varchar_ignorecase
)
indexprs
,
cast
(
0
as
array
)
indkey
i
.
id
oid
,
i
.
id
indexrelid
,
t
.
id
indrelid
,
false
indisclustered
,
not
non_unique
indisunique
,
primary_key
indisprimary
,
cast
(
null
as
varchar_ignorecase
)
indexprs
,
cast
(
0
as
array
)
indkey
from
information_schema
.
indexes
i
,
information_schema
.
tables
t
where
i
.
table_schema
=
t
.
table_schema
and
i
.
table_name
=
t
.
table_name
...
...
@@ -171,49 +178,49 @@ drop alias if exists currtid2;
create
alias
currtid2
for
"org.h2.server.pg.PgServer.getCurrentTid"
;
create
table
pg_catalog
.
pg_database
(
oid
int
,
datname
varchar_ignorecase
,
encoding
int
,
datlastsysoid
int
,
datallowconn
boolean
,
datconfig
array
,
-- text[]
datacl
array
,
-- aclitem[]
datdba
int
,
dattablespace
int
oid
int
,
datname
varchar_ignorecase
,
encoding
int
,
datlastsysoid
int
,
datallowconn
boolean
,
datconfig
array
,
-- text[]
datacl
array
,
-- aclitem[]
datdba
int
,
dattablespace
int
);
insert
into
pg_catalog
.
pg_database
values
(
0
,
-- oid
'postgres'
,
-- datname
6
,
-- encoding, UTF8
100000
,
-- datlastsysoid
true
,
-- datallowconn
null
,
-- datconfig
null
,
-- datacl
select
min
(
id
)
from
information_schema
.
users
where
admin
=
true
,
-- datdba
0
-- dattablespace
0
,
-- oid
'postgres'
,
-- datname
6
,
-- encoding, UTF8
100000
,
-- datlastsysoid
true
,
-- datallowconn
null
,
-- datconfig
null
,
-- datacl
select
min
(
id
)
from
information_schema
.
users
where
admin
=
true
,
-- datdba
0
-- dattablespace
);
create
table
pg_catalog
.
pg_tablespace
(
oid
int
,
spcname
varchar_ignorecase
,
spclocation
varchar_ignorecase
,
spcowner
int
,
spcacl
array
-- aclitem[]
oid
int
,
spcname
varchar_ignorecase
,
spclocation
varchar_ignorecase
,
spcowner
int
,
spcacl
array
-- aclitem[]
);
insert
into
pg_catalog
.
pg_tablespace
values
(
0
,
'main'
,
-- spcname
'?'
,
-- spclocation
0
,
-- spcowner,
null
-- spcacl
0
,
'main'
,
-- spcname
'?'
,
-- spclocation
0
,
-- spcowner,
null
-- spcacl
);
create
table
pg_catalog
.
pg_settings
(
oid
int
,
name
varchar_ignorecase
,
setting
varchar_ignorecase
oid
int
,
name
varchar_ignorecase
,
setting
varchar_ignorecase
);
insert
into
pg_catalog
.
pg_settings
values
...
...
@@ -222,31 +229,31 @@ insert into pg_catalog.pg_settings values
(
2
,
'stats_row_level'
,
'on'
);
create
table
pg_catalog
.
pg_user
(
oid
int
,
usename
varchar_ignorecase
,
usecreatedb
boolean
,
usesuper
boolean
);
oid
int
,
usename
varchar_ignorecase
,
usecreatedb
boolean
,
usesuper
boolean
);
insert
into
pg_catalog
.
pg_user
select
id
oid
,
cast
(
name
as
varchar_ignorecase
)
usename
,
true
usecreatedb
,
true
usesuper
id
oid
,
cast
(
name
as
varchar_ignorecase
)
usename
,
true
usecreatedb
,
true
usesuper
from
information_schema
.
users
;
create
table
pg_catalog
.
pg_authid
(
oid
int
,
rolname
varchar_ignorecase
,
rolsuper
boolean
,
rolinherit
boolean
,
rolcreaterole
boolean
,
rolcreatedb
boolean
,
rolcatupdate
boolean
,
rolcanlogin
boolean
,
rolconnlimit
boolean
,
rolpassword
boolean
,
rolvaliduntil
timestamp
,
-- timestamptz
rolconfig
array
-- text[]
oid
int
,
rolname
varchar_ignorecase
,
rolsuper
boolean
,
rolinherit
boolean
,
rolcreaterole
boolean
,
rolcreatedb
boolean
,
rolcatupdate
boolean
,
rolcanlogin
boolean
,
rolconnlimit
boolean
,
rolpassword
boolean
,
rolvaliduntil
timestamp
,
-- timestamptz
rolconfig
array
-- text[]
);
create
table
pg_catalog
.
pg_am
(
oid
int
,
amname
varchar_ignorecase
);
...
...
@@ -254,22 +261,22 @@ insert into pg_catalog.pg_am values(0, 'btree');
insert
into
pg_catalog
.
pg_am
values
(
1
,
'hash'
);
SELECT
NULL
AS
TABLE_CAT
,
n
.
nspname
AS
TABLE_SCHEM
,
ct
.
relname
AS
TABLE_NAME
,
NOT
i
.
indisunique
AS
NON_UNIQUE
,
NULL
AS
INDEX_QUALIFIER
,
ci
.
relname
AS
INDEX_NAME
,
CASE
i
.
indisclustered
WHEN
true
THEN
1
ELSE
CASE
am
.
amname
WHEN
'hash'
THEN
2
ELSE
3
END
END
AS
TYPE
,
a
.
attnum
AS
ORDINAL_POSITION
,
CASE
i
.
indexprs
WHEN
null
THEN
a
.
attname
ELSE
pg_get_indexdef
(
ci
.
oid
,
a
.
attnum
,
false
)
END
AS
COLUMN_NAME
,
NULL
AS
ASC_OR_DESC
,
ci
.
reltuples
AS
CARDINALITY
,
ci
.
relpages
AS
PAGES
,
NULL
AS
FILTER_CONDITION
NULL
AS
TABLE_CAT
,
n
.
nspname
AS
TABLE_SCHEM
,
ct
.
relname
AS
TABLE_NAME
,
NOT
i
.
indisunique
AS
NON_UNIQUE
,
NULL
AS
INDEX_QUALIFIER
,
ci
.
relname
AS
INDEX_NAME
,
CASE
i
.
indisclustered
WHEN
true
THEN
1
ELSE
CASE
am
.
amname
WHEN
'hash'
THEN
2
ELSE
3
END
END
AS
TYPE
,
a
.
attnum
AS
ORDINAL_POSITION
,
CASE
i
.
indexprs
WHEN
null
THEN
a
.
attname
ELSE
pg_get_indexdef
(
ci
.
oid
,
a
.
attnum
,
false
)
END
AS
COLUMN_NAME
,
NULL
AS
ASC_OR_DESC
,
ci
.
reltuples
AS
CARDINALITY
,
ci
.
relpages
AS
PAGES
,
NULL
AS
FILTER_CONDITION
FROM
pg_catalog
.
pg_namespace
n
,
pg_catalog
.
pg_class
ct
,
pg_catalog
.
pg_class
ci
,
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
46cdafb3
...
...
@@ -248,9 +248,9 @@ public class WebServer implements Service {
// System.out.println(s);
}
public
void
traceError
(
Exception
e
)
{
e
.
printStackTrace
();
}
public
void
traceError
(
Exception
e
)
{
e
.
printStackTrace
();
}
public
boolean
supportsLanguage
(
String
language
)
{
return
languages
.
contains
(
language
);
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
46cdafb3
...
...
@@ -160,7 +160,7 @@ class WebThread extends Thread {
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
message
=
"HTTP/1.1 200 OK\n"
;
...
...
@@ -1517,16 +1517,16 @@ class WebThread extends Thread {
return
NetUtils
.
isLoopbackAddress
(
socket
);
}
public
String
getMimeType
()
{
return
mimeType
;
}
public
String
getMimeType
()
{
return
mimeType
;
}
public
boolean
getCache
()
{
return
cache
;
}
public
boolean
getCache
()
{
return
cache
;
}
public
WebSession
getSession
()
{
return
session
;
}
public
WebSession
getSession
()
{
return
session
;
}
}
h2/src/main/org/h2/util/Cache2Q.java
浏览文件 @
46cdafb3
...
...
@@ -36,7 +36,7 @@ public class Cache2Q implements Cache {
}
private
void
resize
(
int
maxSize
)
{
this
.
maxSize
=
maxSize
;
this
.
maxSize
=
maxSize
;
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
mask
=
len
-
1
;
MathUtils
.
checkPowerOf2
(
len
);
...
...
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
46cdafb3
...
...
@@ -34,7 +34,7 @@ public class CacheLRU implements Cache {
}
private
void
resize
(
int
maxSize
)
{
this
.
maxSize
=
maxSize
;
this
.
maxSize
=
maxSize
;
this
.
len
=
MathUtils
.
nextPowerOf2
(
maxSize
/
2
);
this
.
mask
=
len
-
1
;
MathUtils
.
checkPowerOf2
(
len
);
...
...
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
46cdafb3
...
...
@@ -27,11 +27,11 @@ public class MathUtils {
}
public
static
int
nextPowerOf2
(
int
x
)
{
int
i
=
1
;
while
(
i
<
x
&&
i
<
(
Integer
.
MAX_VALUE
/
2
))
{
i
+=
i
;
}
return
(
int
)
i
;
int
i
=
1
;
while
(
i
<
x
&&
i
<
(
Integer
.
MAX_VALUE
/
2
))
{
i
+=
i
;
}
return
(
int
)
i
;
}
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 {
public
ObjectArray
(
int
size
)
{
data
=
new
Object
[
size
>
1
?
size
:
1
];
}
}
public
ObjectArray
(
Object
[]
data
)
{
this
.
data
=
data
;
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
46cdafb3
...
...
@@ -113,7 +113,7 @@ public class DataType {
);
add
(
Value
.
LONG
,
Types
.
BIGINT
,
"Long"
,
createDecimal
(
ValueLong
.
PRECISION
,
ValueLong
.
PRECISION
,
0
,
false
,
true
),
new
String
[]{
"IDENTITY"
}
new
String
[]{
"IDENTITY"
,
"SERIAL"
}
);
add
(
Value
.
DECIMAL
,
Types
.
DECIMAL
,
"BigDecimal"
,
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 {
String
[]
list
=
FileUtils
.
listFiles
(
dir
);
for
(
int
i
=
0
;
i
<
list
.
length
;
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"
))
{
deleteFile
(
handler
,
name
);
}
...
...
h2/src/main/org/h2/value/ValueResultSet.java
浏览文件 @
46cdafb3
...
...
@@ -17,7 +17,7 @@ public class ValueResultSet extends Value {
private
final
ResultSet
result
;
private
ValueResultSet
(
ResultSet
rs
)
{
this
.
result
=
rs
;
this
.
result
=
rs
;
}
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
/*
-- 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
oid (object identifier)
...
...
h2/src/test/org/h2/test/db/TestBigResult.java
浏览文件 @
46cdafb3
...
...
@@ -27,18 +27,18 @@ public class TestBigResult extends TestBase {
stat
.
execute
(
"SET MAX_MEMORY_ROWS 2"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SELECT * FROM SYSTEM_RANGE(1, 100)"
);
while
(
rs
.
next
())
{
// ignore
// ignore
}
// rs.close();
conn
.
close
();
deleteDb
(
"bigResult"
);
ArrayList
files
=
FileLister
.
getDatabaseFiles
(
BASE_DIR
,
"bigResult"
,
true
);
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"
);
Connection
conn
=
getConnection
(
"bigResult"
);
Statement
stat
=
conn
.
createStatement
();
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
46cdafb3
...
...
@@ -188,8 +188,8 @@ public class TestFunctions extends TestBase {
}
public
static
ResultSet
select
(
Connection
conn
,
String
sql
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
return
stat
.
executeQuery
(
sql
);
Statement
stat
=
conn
.
createStatement
(
ResultSet
.
TYPE_SCROLL_INSENSITIVE
,
ResultSet
.
CONCUR_READ_ONLY
);
return
stat
.
executeQuery
(
sql
);
}
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 {
if
(
config
.
memory
)
{
return
;
}
testLobDrop
();
testLobNoClose
();
testLobTransactions
(
10
);
testLobTransactions
(
10000
);
...
...
@@ -54,6 +55,28 @@ public class TestLob extends TestBase {
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
{
if
(
config
.
logMode
==
0
||
config
.
networked
)
{
return
;
...
...
@@ -90,7 +113,7 @@ public class TestLob extends TestBase {
if
(
config
.
logMode
==
0
)
{
return
;
}
// Constants.LOB_CLOSE_BETWEEN_READS = true;
// Constants.LOB_CLOSE_BETWEEN_READS = true;
deleteDb
(
"lob"
);
Connection
conn
=
reconnect
(
null
);
...
...
h2/src/test/org/h2/test/test.in.txt
浏览文件 @
46cdafb3
--- 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);
> ok
...
...
h2/src/tools/org/h2/server/web/WebServlet.java
浏览文件 @
46cdafb3
...
...
@@ -127,7 +127,7 @@ public class WebServlet extends HttpServlet {
try
{
bytes
=
StringUtils
.
utf8Encode
(
"File not found: "
+
file
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
else
{
if
(
session
!=
null
&&
file
.
endsWith
(
".jsp"
))
{
...
...
@@ -136,7 +136,7 @@ public class WebServlet extends HttpServlet {
try
{
bytes
=
StringUtils
.
utf8Encode
(
page
);
}
catch
(
SQLException
e
)
{
server
.
traceError
(
e
);
server
.
traceError
(
e
);
}
}
resp
.
setContentType
(
mimeType
);
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
46cdafb3
...
...
@@ -484,3 +484,14 @@ chdh biz inventec
enclosing mostly dtp scrolls cars splitting replay incomplete automate
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论