Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3db03fa6
提交
3db03fa6
authored
4月 03, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support for not persistent in-memory tables in regular (persistent) databases.
上级
22e939fe
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
77 行增加
和
51 行删除
+77
-51
changelog.html
h2/src/docsrc/html/changelog.html
+3
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+6
-3
AlterTableAddConstraint.java
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
+3
-3
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+1
-2
CreateIndex.java
h2/src/main/org/h2/command/ddl/CreateIndex.java
+1
-1
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+10
-5
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
PageBtreeIndex.java
h2/src/main/org/h2/index/PageBtreeIndex.java
+1
-1
PageScanIndex.java
h2/src/main/org/h2/index/PageScanIndex.java
+1
-1
ScanIndex.java
h2/src/main/org/h2/index/ScanIndex.java
+2
-2
help.csv
h2/src/main/org/h2/res/help.csv
+2
-1
ResultTempTable.java
h2/src/main/org/h2/result/ResultTempTable.java
+1
-1
Schema.java
h2/src/main/org/h2/schema/Schema.java
+4
-3
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+2
-2
FunctionTable.java
h2/src/main/org/h2/table/FunctionTable.java
+1
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+2
-2
RangeTable.java
h2/src/main/org/h2/table/RangeTable.java
+1
-1
Table.java
h2/src/main/org/h2/table/Table.java
+13
-7
TableData.java
h2/src/main/org/h2/table/TableData.java
+10
-7
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+1
-1
TableView.java
h2/src/main/org/h2/table/TableView.java
+1
-1
testSimple.in.txt
h2/src/test/org/h2/test/testSimple.in.txt
+8
-0
TestPageStore.java
h2/src/test/org/h2/test/unit/TestPageStore.java
+2
-4
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
3db03fa6
...
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
The H2 Console trimmed the password (removed leading and trailing spaces).
<ul><li>
Support for not persistent in-memory tables in regular (persistent) databases
using CREATE MEMORY TABLE(..) NOT PERSISTENT. Thanks a lot to Sergi Vladykin for the patch!
</li><li>
The H2 Console trimmed the password (removed leading and trailing spaces).
This is no longer the case, to support encrypted H2 database with an empty user password.
</li><li>
The data type of a SUBSTRING method was wrong.
</li><li>
ResultSet.findColumn and get methods with column label parameters
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
3db03fa6
...
...
@@ -3781,7 +3781,7 @@ public class Parser {
columns
.
add
(
new
Column
(
cols
[
i
],
Value
.
STRING
));
}
int
id
=
database
.
allocateObjectId
(
true
,
true
);
recursiveTable
=
schema
.
createTable
(
tempViewName
,
id
,
columns
,
false
,
false
,
Index
.
EMPTY_HEAD
);
recursiveTable
=
schema
.
createTable
(
tempViewName
,
id
,
columns
,
false
,
true
,
false
,
Index
.
EMPTY_HEAD
);
recursiveTable
.
setTemporary
(
true
);
session
.
addLocalTempTable
(
recursiveTable
);
String
querySQL
=
StringCache
.
getNew
(
sqlCommand
.
substring
(
parseIndex
));
...
...
@@ -4590,7 +4590,7 @@ public class Parser {
return
command
;
}
private
CreateTable
parseCreateTable
(
boolean
temp
,
boolean
globalTemp
,
boolean
persist
ent
)
throws
SQLException
{
private
CreateTable
parseCreateTable
(
boolean
temp
,
boolean
globalTemp
,
boolean
persist
Indexes
)
throws
SQLException
{
boolean
ifNotExists
=
readIfNoExists
();
String
tableName
=
readIdentifierWithSchema
();
if
(
temp
&&
globalTemp
&&
"SESSION"
.
equals
(
schemaName
))
{
...
...
@@ -4601,7 +4601,7 @@ public class Parser {
}
Schema
schema
=
getSchema
();
CreateTable
command
=
new
CreateTable
(
session
,
schema
);
command
.
setPersist
ent
(
persistent
);
command
.
setPersist
Indexes
(
persistIndexes
);
command
.
setTemporary
(
temp
);
command
.
setGlobalTemporary
(
globalTemp
);
command
.
setIfNotExists
(
ifNotExists
);
...
...
@@ -4698,6 +4698,9 @@ public class Parser {
}
else
if
(
readIf
(
"NOT"
))
{
read
(
"LOGGED"
);
}
}
else
if
(!
persistIndexes
&&
readIf
(
"NOT"
))
{
read
(
"PERSISTENT"
);
command
.
setPersistData
(
false
);
}
if
(
readIf
(
"CLUSTERED"
))
{
command
.
setClustered
(
true
);
...
...
h2/src/main/org/h2/command/ddl/AlterTableAddConstraint.java
浏览文件 @
3db03fa6
...
...
@@ -134,7 +134,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
}
if
(
index
==
null
)
{
IndexType
indexType
=
IndexType
.
createPrimaryKey
(
table
.
getPersistent
(),
primaryKeyHash
);
IndexType
indexType
=
IndexType
.
createPrimaryKey
(
table
.
isPersistIndexes
(),
primaryKeyHash
);
String
indexName
=
table
.
getSchema
().
getUniqueIndexName
(
session
,
table
,
Constants
.
PREFIX_PRIMARY_KEY
);
int
id
=
getObjectId
(
true
,
false
);
try
{
...
...
@@ -262,10 +262,10 @@ public class AlterTableAddConstraint extends SchemaCommand {
IndexType
indexType
;
if
(
unique
)
{
// for unique constraints
indexType
=
IndexType
.
createUnique
(
t
.
getPersistent
(),
false
);
indexType
=
IndexType
.
createUnique
(
t
.
isPersistIndexes
(),
false
);
}
else
{
// constraints
indexType
=
IndexType
.
createNonUnique
(
t
.
getPersistent
());
indexType
=
IndexType
.
createNonUnique
(
t
.
isPersistIndexes
());
}
indexType
.
setBelongsToConstraint
(
true
);
String
prefix
=
constraintName
==
null
?
"CONSTRAINT"
:
constraintName
;
...
...
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
3db03fa6
...
...
@@ -234,14 +234,13 @@ public class AlterTableAlterColumn extends SchemaCommand {
newColumns
.
remove
(
position
);
newColumns
.
add
(
position
,
newColumn
);
}
boolean
persistent
=
table
.
getPersistent
();
// create a table object in order to get the SQL statement
// can't just use this table, because most column objects are 'shared'
// with the old table
// still need a new id because using 0 would mean: the new table tries
// to use the rows of the table 0 (the meta table)
int
id
=
db
.
allocateObjectId
(
true
,
true
);
TableData
newTable
=
getSchema
().
createTable
(
tempName
,
id
,
newColumns
,
persistent
,
false
,
Index
.
EMPTY_HEAD
);
TableData
newTable
=
getSchema
().
createTable
(
tempName
,
id
,
newColumns
,
table
.
isPersistIndexes
(),
table
.
isPersistData
()
,
false
,
Index
.
EMPTY_HEAD
);
newTable
.
setComment
(
table
.
getComment
());
StringBuffer
buff
=
new
StringBuffer
(
newTable
.
getCreateSQL
());
StringBuffer
columnList
=
new
StringBuffer
();
...
...
h2/src/main/org/h2/command/ddl/CreateIndex.java
浏览文件 @
3db03fa6
...
...
@@ -59,7 +59,7 @@ public class CreateIndex extends SchemaCommand {
Table
table
=
getSchema
().
getTableOrView
(
session
,
tableName
);
session
.
getUser
().
checkRight
(
table
,
Right
.
ALL
);
table
.
lock
(
session
,
true
,
true
);
if
(!
table
.
getPersistent
())
{
if
(!
table
.
isPersistIndexes
())
{
persistent
=
false
;
}
int
id
=
getObjectId
(
true
,
false
);
...
...
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
3db03fa6
...
...
@@ -35,7 +35,8 @@ public class CreateTable extends SchemaCommand {
private
ObjectArray
columns
=
new
ObjectArray
();
private
IndexColumn
[]
pkColumns
;
private
boolean
ifNotExists
;
private
boolean
persistent
=
true
;
private
boolean
persistIndexes
=
true
;
private
boolean
persistData
=
true
;
private
boolean
temporary
;
private
boolean
globalTemporary
;
private
boolean
onCommitDrop
;
...
...
@@ -103,7 +104,7 @@ public class CreateTable extends SchemaCommand {
session
.
commit
(
true
);
Database
db
=
session
.
getDatabase
();
if
(!
db
.
isPersistent
())
{
persist
ent
=
false
;
persist
Indexes
=
false
;
}
if
(
getSchema
().
findTableOrView
(
session
,
tableName
)
!=
null
)
{
if
(
ifNotExists
)
{
...
...
@@ -143,7 +144,7 @@ public class CreateTable extends SchemaCommand {
}
}
int
id
=
getObjectId
(
true
,
true
);
TableData
table
=
getSchema
().
createTable
(
tableName
,
id
,
columns
,
persist
ent
,
clustered
,
headPos
);
TableData
table
=
getSchema
().
createTable
(
tableName
,
id
,
columns
,
persist
Indexes
,
persistData
,
clustered
,
headPos
);
table
.
setComment
(
comment
);
table
.
setTemporary
(
temporary
);
table
.
setGlobalTemporary
(
globalTemporary
);
...
...
@@ -239,8 +240,8 @@ public class CreateTable extends SchemaCommand {
return
false
;
}
public
void
setPersist
ent
(
boolean
persistent
)
{
this
.
persist
ent
=
persistent
;
public
void
setPersist
Indexes
(
boolean
persistIndexes
)
{
this
.
persist
Indexes
=
persistIndexes
;
}
public
void
setGlobalTemporary
(
boolean
globalTemporary
)
{
...
...
@@ -269,4 +270,8 @@ public class CreateTable extends SchemaCommand {
this
.
clustered
=
clustered
;
}
public
void
setPersistData
(
boolean
persistData
)
{
this
.
persistData
=
persistData
;
}
}
h2/src/main/org/h2/engine/Database.java
浏览文件 @
3db03fa6
...
...
@@ -596,7 +596,7 @@ public class Database implements DataHandler {
if
(
pageStore
!=
null
)
{
headPos
=
pageStore
.
getSystemTableHeadPos
();
}
meta
=
mainSchema
.
createTable
(
"SYS"
,
0
,
cols
,
persistent
,
false
,
headPos
);
meta
=
mainSchema
.
createTable
(
"SYS"
,
0
,
cols
,
persistent
,
persistent
,
false
,
headPos
);
tableMap
.
put
(
0
,
meta
);
IndexColumn
[]
pkCols
=
IndexColumn
.
wrap
(
new
Column
[]
{
columnId
});
metaIdIndex
=
meta
.
addIndex
(
systemSession
,
"SYS_ID"
,
0
,
pkCols
,
IndexType
.
createPrimaryKey
(
...
...
h2/src/main/org/h2/index/PageBtreeIndex.java
浏览文件 @
3db03fa6
...
...
@@ -219,7 +219,7 @@ public class PageBtreeIndex extends BaseIndex {
trace
.
debug
(
"truncate"
);
}
removeAllRows
();
if
(
tableData
.
getContainsLargeObject
()
&&
tableData
.
getPersistent
()
)
{
if
(
tableData
.
getContainsLargeObject
())
{
ValueLob
.
removeAllForTable
(
database
,
table
.
getId
());
}
tableData
.
setRowCount
(
0
);
...
...
h2/src/main/org/h2/index/PageScanIndex.java
浏览文件 @
3db03fa6
...
...
@@ -239,7 +239,7 @@ public class PageScanIndex extends BaseIndex implements RowIndex {
trace
.
debug
(
"truncate"
);
}
removeAllRows
();
if
(
tableData
.
getContainsLargeObject
()
&&
tableData
.
getPersistent
())
{
if
(
tableData
.
getContainsLargeObject
()
&&
tableData
.
isPersistData
())
{
ValueLob
.
removeAllForTable
(
database
,
table
.
getId
());
}
tableData
.
setRowCount
(
0
);
...
...
h2/src/main/org/h2/index/ScanIndex.java
浏览文件 @
3db03fa6
...
...
@@ -49,7 +49,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
sessionRowCount
=
new
HashMap
();
}
tableData
=
table
;
if
(!
database
.
isPersistent
()
||
id
<
0
)
{
if
(!
database
.
isPersistent
()
||
id
<
0
||
!
indexType
.
getPersistent
()
)
{
return
;
}
this
.
storage
=
database
.
getStorage
(
table
,
id
,
true
);
...
...
@@ -74,7 +74,7 @@ public class ScanIndex extends BaseIndex implements RowIndex {
}
else
{
storage
.
truncate
(
session
);
}
if
(
tableData
.
getContainsLargeObject
()
&&
tableData
.
getPersistent
())
{
if
(
tableData
.
getContainsLargeObject
()
&&
tableData
.
isPersistData
())
{
ValueLob
.
removeAllForTable
(
database
,
table
.
getId
());
}
tableData
.
setRowCount
(
0
);
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
3db03fa6
...
...
@@ -480,11 +480,12 @@ TABLE [IF NOT EXISTS] name
[{AUTO_INCREMENT | IDENTITY}[(startInt [, incrementInt])]]
[SELECTIVITY selectivity]
[PRIMARY KEY [HASH] | UNIQUE]
| constraint} [,...] ) [
AS select
] } | { AS select }
| constraint} [,...] ) [
AS select] [NOT PERSISTENT
] } | { AS select }
","
Creates a new table.
Cached tables (the default) are persistent, and the number or rows is not limited by the main memory.
Memory tables are persistent, but the index data is kept in the main memory, so memory tables should not get too large.
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all rows are lost when the database is closed.
Temporary tables are not persistent. Temporary tables can be global (accessible by all connections)
or local (only accessible by the current connection). The default is for temporary tables is global.
Identity and auto-increment columns are columns with a sequence as the default.
...
...
h2/src/main/org/h2/result/ResultTempTable.java
浏览文件 @
3db03fa6
...
...
@@ -46,7 +46,7 @@ public class ResultTempTable implements ResultExternal {
columns
.
add
(
column
);
int
tableId
=
session
.
getDatabase
().
allocateObjectId
(
true
,
true
);
String
tableName
=
"TEMP_RESULT_SET_"
+
tableId
;
table
=
schema
.
createTable
(
tableName
,
tableId
,
columns
,
false
,
false
,
Index
.
EMPTY_HEAD
);
table
=
schema
.
createTable
(
tableName
,
tableId
,
columns
,
false
,
true
,
false
,
Index
.
EMPTY_HEAD
);
int
indexId
=
session
.
getDatabase
().
allocateObjectId
(
true
,
false
);
IndexColumn
indexColumn
=
new
IndexColumn
();
indexColumn
.
column
=
column
;
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
3db03fa6
...
...
@@ -470,14 +470,15 @@ public class Schema extends DbObjectBase {
* @param tableName the table name
* @param id the object id
* @param columns the column list
* @param persistent if the table should be persistent
* @param persistIndexes if indexes of the table should be persistent
* @param persistData if data of the table should be persistent
* @param clustered if a clustered table should be created
* @param headPos the position (page number) of the head
* @return the created {@link TableData} object
*/
public
TableData
createTable
(
String
tableName
,
int
id
,
ObjectArray
columns
,
boolean
persist
ent
,
boolean
clustered
,
int
headPos
)
public
TableData
createTable
(
String
tableName
,
int
id
,
ObjectArray
columns
,
boolean
persist
Indexes
,
boolean
persistData
,
boolean
clustered
,
int
headPos
)
throws
SQLException
{
return
new
TableData
(
this
,
tableName
,
id
,
columns
,
persist
ent
,
clustered
,
headPos
);
return
new
TableData
(
this
,
tableName
,
id
,
columns
,
persist
Indexes
,
persistData
,
clustered
,
headPos
);
}
/**
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
3db03fa6
...
...
@@ -823,7 +823,7 @@ trace.setLevel(TraceSystem.DEBUG);
metaSchema
=
new
Schema
(
database
,
0
,
""
,
null
,
true
);
int
headPos
=
metaTableRootPageId
;
metaTable
=
new
TableData
(
metaSchema
,
"PAGE_INDEX"
,
META_TABLE_ID
,
cols
,
true
,
false
,
headPos
);
META_TABLE_ID
,
cols
,
true
,
true
,
false
,
headPos
);
metaIndex
=
(
PageScanIndex
)
metaTable
.
getScanIndex
(
database
.
getSystemSession
());
metaObjects
=
new
HashMap
();
...
...
@@ -865,7 +865,7 @@ trace.setLevel(TraceSystem.DEBUG);
Column
col
=
new
Column
(
"C"
+
i
,
Value
.
INT
);
columnArray
.
add
(
col
);
}
TableData
table
=
new
TableData
(
metaSchema
,
"T"
+
id
,
id
,
columnArray
,
true
,
false
,
headPos
);
TableData
table
=
new
TableData
(
metaSchema
,
"T"
+
id
,
id
,
columnArray
,
true
,
true
,
false
,
headPos
);
meta
=
table
.
getScanIndex
(
database
.
getSystemSession
());
}
else
{
PageScanIndex
p
=
(
PageScanIndex
)
metaObjects
.
get
(
ObjectUtils
.
getInteger
(
parent
));
...
...
h2/src/main/org/h2/table/FunctionTable.java
浏览文件 @
3db03fa6
...
...
@@ -40,7 +40,7 @@ public class FunctionTable extends Table {
private
Value
cachedValue
;
public
FunctionTable
(
Schema
schema
,
Session
session
,
Expression
functionExpr
,
FunctionCall
function
)
throws
SQLException
{
super
(
schema
,
0
,
function
.
getName
(),
false
);
super
(
schema
,
0
,
function
.
getName
(),
false
,
true
);
this
.
functionExpr
=
functionExpr
;
this
.
function
=
function
;
if
(
function
instanceof
TableFunction
)
{
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
3db03fa6
...
...
@@ -117,7 +117,7 @@ public class MetaTable extends Table {
*/
public
MetaTable
(
Schema
schema
,
int
id
,
int
type
)
throws
SQLException
{
// tableName will be set later
super
(
schema
,
id
,
null
,
true
);
super
(
schema
,
id
,
null
,
true
,
true
);
this
.
type
=
type
;
Column
[]
cols
;
String
indexColumnName
=
null
;
...
...
@@ -632,7 +632,7 @@ public class MetaTable extends Table {
storageType
=
"LOCAL TEMPORARY"
;
}
}
else
{
storageType
=
table
.
getPersistent
()
?
"CACHED"
:
"MEMORY"
;
storageType
=
table
.
isPersistIndexes
()
?
"CACHED"
:
"MEMORY"
;
}
add
(
rows
,
new
String
[]
{
// TABLE_CATALOG
...
...
h2/src/main/org/h2/table/RangeTable.java
浏览文件 @
3db03fa6
...
...
@@ -41,7 +41,7 @@ public class RangeTable extends Table {
* @param max the end expression
*/
public
RangeTable
(
Schema
schema
,
Expression
min
,
Expression
max
)
throws
SQLException
{
super
(
schema
,
0
,
NAME
,
true
);
super
(
schema
,
0
,
NAME
,
true
,
true
);
Column
[]
cols
=
new
Column
[]{
new
Column
(
"X"
,
Value
.
LONG
)
};
...
...
h2/src/main/org/h2/table/Table.java
浏览文件 @
3db03fa6
...
...
@@ -84,7 +84,8 @@ public abstract class Table extends SchemaObjectBase {
protected
int
memoryPerRow
;
private
final
HashMap
columnMap
=
new
HashMap
();
private
final
boolean
persistent
;
private
boolean
persistIndexes
;
private
boolean
persistData
;
private
ObjectArray
triggers
;
private
ObjectArray
constraints
;
private
ObjectArray
sequences
;
...
...
@@ -93,9 +94,10 @@ public abstract class Table extends SchemaObjectBase {
private
boolean
onCommitDrop
,
onCommitTruncate
;
private
Row
nullRow
;
Table
(
Schema
schema
,
int
id
,
String
name
,
boolean
persist
ent
)
{
Table
(
Schema
schema
,
int
id
,
String
name
,
boolean
persist
Indexes
,
boolean
persistData
)
{
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
TABLE
);
this
.
persistent
=
persistent
;
this
.
persistIndexes
=
persistIndexes
;
this
.
persistData
=
persistData
;
}
public
void
rename
(
String
newName
)
throws
SQLException
{
...
...
@@ -583,10 +585,6 @@ public abstract class Table extends SchemaObjectBase {
}
}
public
boolean
getPersistent
()
{
return
persistent
;
}
private
void
remove
(
ObjectArray
list
,
DbObject
obj
)
{
if
(
list
!=
null
)
{
int
i
=
list
.
indexOf
(
obj
);
...
...
@@ -899,4 +897,12 @@ public abstract class Table extends SchemaObjectBase {
return
null
;
}
public
boolean
isPersistIndexes
()
{
return
persistIndexes
;
}
public
boolean
isPersistData
()
{
return
persistData
;
}
}
h2/src/main/org/h2/table/TableData.java
浏览文件 @
3db03fa6
...
...
@@ -61,17 +61,17 @@ public class TableData extends Table implements RecordReader {
private
boolean
containsLargeObject
;
public
TableData
(
Schema
schema
,
String
tableName
,
int
id
,
ObjectArray
columns
,
boolean
persist
ent
,
boolean
clustered
,
int
headPos
)
throws
SQLException
{
super
(
schema
,
id
,
tableName
,
persist
ent
);
boolean
persist
Indexes
,
boolean
persistData
,
boolean
clustered
,
int
headPos
)
throws
SQLException
{
super
(
schema
,
id
,
tableName
,
persist
Indexes
,
persistData
);
Column
[]
cols
=
new
Column
[
columns
.
size
()];
columns
.
toArray
(
cols
);
setColumns
(
cols
);
this
.
clustered
=
clustered
;
if
(!
clustered
)
{
if
(
SysProperties
.
PAGE_STORE
&&
database
.
isPersistent
())
{
scanIndex
=
new
PageScanIndex
(
this
,
id
,
IndexColumn
.
wrap
(
cols
),
IndexType
.
createScan
(
persist
ent
),
headPos
);
if
(
SysProperties
.
PAGE_STORE
&&
persistData
&&
database
.
isPersistent
())
{
scanIndex
=
new
PageScanIndex
(
this
,
id
,
IndexColumn
.
wrap
(
cols
),
IndexType
.
createScan
(
persist
Data
),
headPos
);
}
else
{
scanIndex
=
new
ScanIndex
(
this
,
id
,
IndexColumn
.
wrap
(
cols
),
IndexType
.
createScan
(
persist
ent
));
scanIndex
=
new
ScanIndex
(
this
,
id
,
IndexColumn
.
wrap
(
cols
),
IndexType
.
createScan
(
persist
Data
));
}
indexes
.
add
(
scanIndex
);
}
...
...
@@ -176,7 +176,7 @@ public class TableData extends Table implements RecordReader {
}
}
Index
index
;
if
(
getPersistent
()
&&
indexType
.
getPersistent
())
{
if
(
isPersistIndexes
()
&&
indexType
.
getPersistent
())
{
if
(
SysProperties
.
PAGE_STORE
)
{
index
=
new
PageBtreeIndex
(
this
,
indexId
,
indexName
,
cols
,
indexType
,
headPos
);
}
else
{
...
...
@@ -545,7 +545,7 @@ public class TableData extends Table implements RecordReader {
buff
.
append
(
"LOCAL "
);
}
buff
.
append
(
"TEMPORARY "
);
}
else
if
(
getPersistent
())
{
}
else
if
(
isPersistIndexes
())
{
buff
.
append
(
"CACHED "
);
}
else
{
buff
.
append
(
"MEMORY "
);
...
...
@@ -565,6 +565,9 @@ public class TableData extends Table implements RecordReader {
buff
.
append
(
column
.
getCreateSQL
());
}
buff
.
append
(
"\n)"
);
if
(!
getTemporary
()
&&
!
isPersistIndexes
()
&&
!
isPersistData
())
{
buff
.
append
(
"\nNOT PERSISTENT"
);
}
return
buff
.
toString
();
}
...
...
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
3db03fa6
...
...
@@ -59,7 +59,7 @@ public class TableLink extends Table {
public
TableLink
(
Schema
schema
,
int
id
,
String
name
,
String
driver
,
String
url
,
String
user
,
String
password
,
String
originalSchema
,
String
originalTable
,
boolean
emitUpdates
,
boolean
force
)
throws
SQLException
{
super
(
schema
,
id
,
name
,
false
);
super
(
schema
,
id
,
name
,
false
,
true
);
this
.
driver
=
driver
;
this
.
url
=
url
;
this
.
user
=
user
;
...
...
h2/src/main/org/h2/table/TableView.java
浏览文件 @
3db03fa6
...
...
@@ -48,7 +48,7 @@ public class TableView extends Table {
public
TableView
(
Schema
schema
,
int
id
,
String
name
,
String
querySQL
,
ObjectArray
params
,
String
[]
columnNames
,
Session
session
,
boolean
recursive
)
throws
SQLException
{
super
(
schema
,
id
,
name
,
false
);
super
(
schema
,
id
,
name
,
false
,
true
);
this
.
querySQL
=
querySQL
;
this
.
columnNames
=
columnNames
;
this
.
recursive
=
recursive
;
...
...
h2/src/test/org/h2/test/testSimple.in.txt
浏览文件 @
3db03fa6
create memory table test(id int) as select 1 from dual not persistent;
insert into test values(1);
select count(1) from test;
> 2;
@reconnect;
select count(1) from test;
> 0;
drop table test;
create table test(t clob) as select 1;
select distinct t from test;
> 1;
...
...
h2/src/test/org/h2/test/unit/TestPageStore.java
浏览文件 @
3db03fa6
...
...
@@ -167,8 +167,7 @@ public class TestPageStore extends TestBase {
ObjectArray
cols
=
new
ObjectArray
();
cols
.
add
(
new
Column
(
"ID"
,
Value
.
INT
));
schema
=
new
Schema
(
db
,
0
,
""
,
null
,
true
);
table
=
new
TableData
(
schema
,
"PAGE_INDEX"
,
1
,
cols
,
true
,
false
,
100
);
table
=
new
TableData
(
schema
,
"PAGE_INDEX"
,
1
,
cols
,
true
,
true
,
false
,
100
);
index
=
(
PageScanIndex
)
table
.
getScanIndex
(
db
.
getSystemSession
());
}
...
...
@@ -178,8 +177,7 @@ public class TestPageStore extends TestBase {
cols
.
add
(
new
Column
(
"ID"
,
Value
.
INT
));
schema
=
new
Schema
(
db
,
0
,
""
,
null
,
true
);
int
id
=
db
.
allocateObjectId
(
true
,
true
);
table
=
new
TableData
(
schema
,
"BTREE_INDEX"
,
id
,
cols
,
true
,
false
,
100
);
table
=
new
TableData
(
schema
,
"BTREE_INDEX"
,
id
,
cols
,
true
,
true
,
false
,
100
);
id
=
db
.
allocateObjectId
(
true
,
true
);
table
.
addIndex
(
db
.
getSystemSession
(),
"BTREE"
,
id
,
IndexColumn
.
wrap
(
table
.
getColumns
()),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论