Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ced54a0a
提交
ced54a0a
authored
6月 18, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split long lines.
上级
a7b804e6
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
117 行增加
和
58 行删除
+117
-58
Parser.java
h2/src/main/org/h2/command/Parser.java
+6
-2
CreateLinkedTable.java
h2/src/main/org/h2/command/ddl/CreateLinkedTable.java
+2
-1
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+4
-2
DropTable.java
h2/src/main/org/h2/command/ddl/DropTable.java
+3
-1
DropView.java
h2/src/main/org/h2/command/ddl/DropView.java
+3
-1
Query.java
h2/src/main/org/h2/command/dml/Query.java
+4
-1
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+8
-4
Select.java
h2/src/main/org/h2/command/dml/Select.java
+5
-2
DbSettings.java
h2/src/main/org/h2/constant/DbSettings.java
+12
-13
Database.java
h2/src/main/org/h2/engine/Database.java
+5
-1
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+2
-1
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+4
-2
ExpressionVisitor.java
h2/src/main/org/h2/expression/ExpressionVisitor.java
+6
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-1
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+4
-2
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+2
-1
FullTextSettings.java
h2/src/main/org/h2/fulltext/FullTextSettings.java
+2
-1
BaseIndex.java
h2/src/main/org/h2/index/BaseIndex.java
+2
-1
PageDataIndex.java
h2/src/main/org/h2/index/PageDataIndex.java
+2
-1
PageDataLeaf.java
h2/src/main/org/h2/index/PageDataLeaf.java
+4
-2
PageDataNode.java
h2/src/main/org/h2/index/PageDataNode.java
+4
-2
PageDataOverflow.java
h2/src/main/org/h2/index/PageDataOverflow.java
+3
-1
PageDelegateIndex.java
h2/src/main/org/h2/index/PageDelegateIndex.java
+2
-1
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+2
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+12
-6
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+6
-3
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+2
-1
JdbcDataSourceFactory.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
+2
-1
DatabaseInfo.java
h2/src/main/org/h2/jmx/DatabaseInfo.java
+2
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
ced54a0a
...
...
@@ -4165,7 +4165,9 @@ public class Parser {
private
CreateFunctionAlias
parseCreateFunctionAlias
(
boolean
force
)
{
boolean
ifNotExists
=
readIfNoExists
();
String
aliasName
=
readIdentifierWithSchema
();
if
(
isKeyword
(
aliasName
)
||
Function
.
getFunction
(
database
,
aliasName
)
!=
null
||
Aggregate
.
getAggregateType
(
aliasName
)
>=
0
)
{
if
(
isKeyword
(
aliasName
)
||
Function
.
getFunction
(
database
,
aliasName
)
!=
null
||
Aggregate
.
getAggregateType
(
aliasName
)
>=
0
)
{
throw
DbException
.
get
(
ErrorCode
.
FUNCTION_ALIAS_ALREADY_EXISTS_1
,
aliasName
);
}
CreateFunctionAlias
command
=
new
CreateFunctionAlias
(
session
,
getSchema
());
...
...
@@ -4912,7 +4914,9 @@ public class Parser {
boolean
ifNotExists
=
readIfNoExists
();
Schema
schema
=
table
.
getSchema
();
AlterTableAlterColumn
command
=
new
AlterTableAlterColumn
(
session
,
schema
);
command
.
setType
(
ifNotExists
?
CommandInterface
.
ALTER_TABLE_ADD_COLUMN_IF_NOT_EXISTS
:
CommandInterface
.
ALTER_TABLE_ADD_COLUMN
);
command
.
setType
(
ifNotExists
?
CommandInterface
.
ALTER_TABLE_ADD_COLUMN_IF_NOT_EXISTS
:
CommandInterface
.
ALTER_TABLE_ADD_COLUMN
);
command
.
setTable
(
table
);
String
columnName
=
readColumnIdentifier
();
Column
column
=
parseColumnForTable
(
columnName
,
true
);
...
...
h2/src/main/org/h2/command/ddl/CreateLinkedTable.java
浏览文件 @
ced54a0a
...
...
@@ -74,7 +74,8 @@ public class CreateLinkedTable extends SchemaCommand {
tableName
);
}
int
id
=
getObjectId
();
TableLink
table
=
getSchema
().
createTableLink
(
id
,
tableName
,
driver
,
url
,
user
,
password
,
originalSchema
,
originalTable
,
emitUpdates
,
force
);
TableLink
table
=
getSchema
().
createTableLink
(
id
,
tableName
,
driver
,
url
,
user
,
password
,
originalSchema
,
originalTable
,
emitUpdates
,
force
);
table
.
setTemporary
(
temporary
);
table
.
setGlobalTemporary
(
globalTemporary
);
table
.
setComment
(
comment
);
...
...
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
ced54a0a
...
...
@@ -199,12 +199,14 @@ public class CreateTable extends SchemaCommand {
long
precision
=
expr
.
getPrecision
();
int
displaySize
=
expr
.
getDisplaySize
();
DataType
dt
=
DataType
.
getDataType
(
type
);
if
(
precision
>
0
&&
(
dt
.
defaultPrecision
==
0
||
(
dt
.
defaultPrecision
>
precision
&&
dt
.
defaultPrecision
<
Byte
.
MAX_VALUE
)))
{
if
(
precision
>
0
&&
(
dt
.
defaultPrecision
==
0
||
(
dt
.
defaultPrecision
>
precision
&&
dt
.
defaultPrecision
<
Byte
.
MAX_VALUE
)))
{
// dont' set precision to MAX_VALUE if this is the default
precision
=
dt
.
defaultPrecision
;
}
int
scale
=
expr
.
getScale
();
if
(
scale
>
0
&&
(
dt
.
defaultScale
==
0
||
(
dt
.
defaultScale
>
scale
&&
dt
.
defaultScale
<
precision
)))
{
if
(
scale
>
0
&&
(
dt
.
defaultScale
==
0
||
(
dt
.
defaultScale
>
scale
&&
dt
.
defaultScale
<
precision
)))
{
scale
=
dt
.
defaultScale
;
}
if
(
scale
>
precision
)
{
...
...
h2/src/main/org/h2/command/ddl/DropTable.java
浏览文件 @
ced54a0a
...
...
@@ -33,7 +33,9 @@ public class DropTable extends SchemaCommand {
public
DropTable
(
Session
session
,
Schema
schema
)
{
super
(
session
,
schema
);
dropAction
=
session
.
getDatabase
().
getSettings
().
dropRestrict
?
ConstraintReferential
.
RESTRICT
:
ConstraintReferential
.
CASCADE
;
dropAction
=
session
.
getDatabase
().
getSettings
().
dropRestrict
?
ConstraintReferential
.
RESTRICT
:
ConstraintReferential
.
CASCADE
;
}
/**
...
...
h2/src/main/org/h2/command/ddl/DropView.java
浏览文件 @
ced54a0a
...
...
@@ -29,7 +29,9 @@ public class DropView extends SchemaCommand {
public
DropView
(
Session
session
,
Schema
schema
)
{
super
(
session
,
schema
);
dropAction
=
session
.
getDatabase
().
getSettings
().
dropRestrict
?
ConstraintReferential
.
RESTRICT
:
ConstraintReferential
.
CASCADE
;
dropAction
=
session
.
getDatabase
().
getSettings
().
dropRestrict
?
ConstraintReferential
.
RESTRICT
:
ConstraintReferential
.
CASCADE
;
}
public
void
setIfExists
(
boolean
b
)
{
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
ced54a0a
...
...
@@ -317,7 +317,10 @@ public abstract class Query extends Prepared {
* @param visible the number of visible columns in the select list
* @param mustBeInResult all order by expressions must be in the select list
*/
static
void
initOrder
(
ArrayList
<
Expression
>
expressions
,
ArrayList
<
String
>
expressionSQL
,
ArrayList
<
SelectOrderBy
>
orderList
,
int
visible
,
static
void
initOrder
(
ArrayList
<
Expression
>
expressions
,
ArrayList
<
String
>
expressionSQL
,
ArrayList
<
SelectOrderBy
>
orderList
,
int
visible
,
boolean
mustBeInResult
)
{
for
(
SelectOrderBy
o
:
orderList
)
{
Expression
e
=
o
.
expression
;
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
ced54a0a
...
...
@@ -345,10 +345,14 @@ public class ScriptCommand extends ScriptBase {
private
int
writeLobStream
(
Value
v
)
throws
IOException
{
if
(!
tempLobTableCreated
)
{
add
(
"CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT NOT NULL, PART INT NOT NULL, CDATA VARCHAR, BDATA BINARY)"
,
true
);
add
(
"CREATE PRIMARY KEY SYSTEM_LOB_STREAM_PRIMARY_KEY ON SYSTEM_LOB_STREAM(ID, PART)"
,
true
);
add
(
"CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR \""
+
this
.
getClass
().
getName
()
+
".combineClob\""
,
true
);
add
(
"CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR \""
+
this
.
getClass
().
getName
()
+
".combineBlob\""
,
true
);
add
(
"CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM"
+
"(ID INT NOT NULL, PART INT NOT NULL, CDATA VARCHAR, BDATA BINARY)"
,
true
);
add
(
"CREATE PRIMARY KEY SYSTEM_LOB_STREAM_PRIMARY_KEY "
+
"ON SYSTEM_LOB_STREAM(ID, PART)"
,
true
);
add
(
"CREATE ALIAS IF NOT EXISTS "
+
"SYSTEM_COMBINE_CLOB FOR \""
+
this
.
getClass
().
getName
()
+
".combineClob\""
,
true
);
add
(
"CREATE ALIAS IF NOT EXISTS "
+
"SYSTEM_COMBINE_BLOB FOR \""
+
this
.
getClass
().
getName
()
+
".combineBlob\""
,
true
);
tempLobTableCreated
=
true
;
}
int
id
=
nextLobId
++;
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
ced54a0a
...
...
@@ -816,7 +816,9 @@ public class Select extends Query {
}
}
cost
=
preparePlan
();
if
(
distinct
&&
session
.
getDatabase
().
getSettings
().
optimizeDistinct
&&
!
isGroupQuery
&&
filters
.
size
()
==
1
&&
expressions
.
size
()
==
1
&&
condition
==
null
)
{
if
(
distinct
&&
session
.
getDatabase
().
getSettings
().
optimizeDistinct
&&
!
isGroupQuery
&&
filters
.
size
()
==
1
&&
expressions
.
size
()
==
1
&&
condition
==
null
)
{
Expression
expr
=
expressions
.
get
(
0
);
expr
=
expr
.
getNonAliasExpression
();
if
(
expr
instanceof
ExpressionColumn
)
{
...
...
@@ -828,7 +830,8 @@ public class Select extends Query {
boolean
ascending
=
columnIndex
.
getIndexColumns
()[
0
].
sortType
==
SortOrder
.
ASCENDING
;
Index
current
=
topTableFilter
.
getIndex
();
// if another index is faster
if
(
columnIndex
.
canFindNext
()
&&
ascending
&&
(
current
==
null
||
current
.
getIndexType
().
isScan
()
||
columnIndex
==
current
))
{
if
(
columnIndex
.
canFindNext
()
&&
ascending
&&
(
current
==
null
||
current
.
getIndexType
().
isScan
()
||
columnIndex
==
current
))
{
IndexType
type
=
columnIndex
.
getIndexType
();
// hash indexes don't work, and unique single column indexes don't work
if
(!
type
.
isHash
()
&&
(!
type
.
isUnique
()
||
columnIndex
.
getColumns
().
length
>
1
))
{
...
...
h2/src/main/org/h2/constant/DbSettings.java
浏览文件 @
ced54a0a
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
constant
;
import
java.util.HashMap
;
import
org.h2.engine.Constants
;
import
org.h2.engine.SettingsBase
;
/**
...
...
@@ -48,7 +47,7 @@ public class DbSettings extends SettingsBase {
* starting the database. It is not run on local temporary tables, and
* tables that have a trigger on SELECT.
*/
public
final
int
analyzeAuto
=
get
(
"ANALYZE_AUTO"
,
Constants
.
VERSION_MINOR
>=
3
?
2000
:
0
);
public
final
int
analyzeAuto
=
get
(
"ANALYZE_AUTO"
,
200
0
);
/**
* Database setting <code>ANALYZE_SAMPLE</code> (default: 10000).<br />
...
...
@@ -101,7 +100,7 @@ public class DbSettings extends SettingsBase {
* with older versions of H2 the default action is currently CASCADE. This will
* change in a future version of H2.
*/
public
final
boolean
dropRestrict
=
get
(
"DROP_RESTRICT"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
dropRestrict
=
get
(
"DROP_RESTRICT"
,
true
);
/**
* Database setting <code>EARLY_FILTER</code> (default: false).<br />
...
...
@@ -125,7 +124,7 @@ public class DbSettings extends SettingsBase {
* will always include the schema name in the CREATE ALIAS statement.
* This is not backward compatible with H2 versions 1.2.134 and older.
*/
public
final
boolean
functionsInSchema
=
get
(
"FUNCTIONS_IN_SCHEMA"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
functionsInSchema
=
get
(
"FUNCTIONS_IN_SCHEMA"
,
true
);
/**
* Database setting <code>LARGE_RESULT_BUFFER_SIZE</code> (default: 4096).<br />
...
...
@@ -138,7 +137,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>LARGE_TRANSACTIONS</code> (default: true).<br />
* Support very large transactions
*/
public
final
boolean
largeTransactions
=
get
(
"LARGE_TRANSACTIONS"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
largeTransactions
=
get
(
"LARGE_TRANSACTIONS"
,
true
);
/**
* Database setting <code>MAX_COMPACT_COUNT</code>
...
...
@@ -160,7 +159,7 @@ public class DbSettings extends SettingsBase {
* more than this number of rows are in a result set, a temporary table is
* used.
*/
public
final
int
maxMemoryRowsDistinct
=
get
(
"MAX_MEMORY_ROWS_DISTINCT"
,
Constants
.
VERSION_MINOR
>=
3
?
10000
:
Integer
.
MAX_VALUE
);
public
final
int
maxMemoryRowsDistinct
=
get
(
"MAX_MEMORY_ROWS_DISTINCT"
,
10000
);
/**
* Database setting <code>MAX_QUERY_TIMEOUT</code> (default: 0).<br />
...
...
@@ -174,7 +173,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>NESTED_JOINS</code> (default: true).<br />
* Whether nested joins should be supported.
*/
public
final
boolean
nestedJoins
=
get
(
"NESTED_JOINS"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
nestedJoins
=
get
(
"NESTED_JOINS"
,
true
);
/**
* Database setting <code>OPTIMIZE_DISTINCT</code> (default: true).<br />
...
...
@@ -203,7 +202,7 @@ public class DbSettings extends SettingsBase {
* Insert into table from query directly bypassing temporary disk storage.
* This also applies to create table as select.
*/
public
final
boolean
optimizeInsertFromSelect
=
get
(
"OPTIMIZE_INSERT_FROM_SELECT"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
optimizeInsertFromSelect
=
get
(
"OPTIMIZE_INSERT_FROM_SELECT"
,
true
);
/**
* Database setting <code>OPTIMIZE_IN_LIST</code> (default: true).<br />
...
...
@@ -217,7 +216,7 @@ public class DbSettings extends SettingsBase {
* Optimize IN(SELECT ...) comparisons. This includes
* optimization for SELECT, DELETE, and UPDATE.
*/
public
final
boolean
optimizeInSelect
=
get
(
"OPTIMIZE_IN_SELECT"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
optimizeInSelect
=
get
(
"OPTIMIZE_IN_SELECT"
,
true
);
/**
* Database setting <code>OPTIMIZE_IS_NULL</code> (default: false).<br />
...
...
@@ -229,7 +228,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>OPTIMIZE_OR</code> (default: true).<br />
* Convert (C=? OR C=?) to (C IN(?, ?)).
*/
public
final
boolean
optimizeOr
=
get
(
"OPTIMIZE_OR"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
optimizeOr
=
get
(
"OPTIMIZE_OR"
,
true
);
/**
* Database setting <code>OPTIMIZE_TWO_EQUALS</code> (default: true).<br />
...
...
@@ -273,7 +272,7 @@ public class DbSettings extends SettingsBase {
* SELECT statements are cached (excluding UNION and FOR UPDATE statements).
* This works for both statements and prepared statement.
*/
public
final
int
queryCacheSize
=
get
(
"QUERY_CACHE_SIZE"
,
Constants
.
VERSION_MINOR
>=
3
?
8
:
0
);
public
final
int
queryCacheSize
=
get
(
"QUERY_CACHE_SIZE"
,
8
);
/**
* Database setting <code>RECOMPILE_ALWAYS</code> (default: false).<br />
...
...
@@ -294,7 +293,7 @@ public class DbSettings extends SettingsBase {
* Database setting <code>ROWID</code> (default: true).<br />
* If set, each table has a pseudo-column _ROWID_.
*/
public
final
boolean
rowId
=
get
(
"ROWID"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
rowId
=
get
(
"ROWID"
,
true
);
/**
* Database setting <code>SELECT_FOR_UPDATE_MVCC</code>
...
...
@@ -302,7 +301,7 @@ public class DbSettings extends SettingsBase {
* If set, SELECT .. FOR UPDATE queries lock only the selected rows when
* using MVCC.
*/
public
final
boolean
selectForUpdateMvcc
=
get
(
"SELECT_FOR_UPDATE_MVCC"
,
Constants
.
VERSION_MINOR
>=
3
);
public
final
boolean
selectForUpdateMvcc
=
get
(
"SELECT_FOR_UPDATE_MVCC"
,
true
);
/**
* Database setting <code>SHARE_LINKED_CONNECTIONS</code>
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
ced54a0a
...
...
@@ -520,7 +520,11 @@ public class Database implements DataHandler {
trace
=
traceSystem
.
getTrace
(
Trace
.
DATABASE
);
trace
.
info
(
"opening {0} (build {1})"
,
databaseName
,
Constants
.
BUILD_ID
);
if
(
autoServerMode
)
{
if
(
readOnly
||
fileLockMethod
==
FileLock
.
LOCK_NO
||
fileLockMethod
==
FileLock
.
LOCK_SERIALIZED
||
fileLockMethod
==
FileLock
.
LOCK_FS
||
!
persistent
)
{
if
(
readOnly
||
fileLockMethod
==
FileLock
.
LOCK_NO
||
fileLockMethod
==
FileLock
.
LOCK_SERIALIZED
||
fileLockMethod
==
FileLock
.
LOCK_FS
||
!
persistent
)
{
throw
DbException
.
getUnsupportedException
(
"autoServerMode && (readOnly || fileLockMethod == NO"
+
" || fileLockMethod == SERIALIZED || inMemory)"
);
}
...
...
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
ced54a0a
...
...
@@ -245,7 +245,8 @@ public class FunctionAlias extends SchemaObjectBase {
return
m
;
}
}
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_FOUND_1
,
methodName
+
" ("
+
className
+
", parameter count: "
+
parameterCount
+
")"
);
throw
DbException
.
get
(
ErrorCode
.
METHOD_NOT_FOUND_1
,
methodName
+
" ("
+
className
+
", parameter count: "
+
parameterCount
+
")"
);
}
public
String
getJavaClassName
()
{
...
...
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
ced54a0a
...
...
@@ -48,11 +48,13 @@ public class CompareLike extends Condition {
private
boolean
fastCompare
;
private
boolean
invalidPattern
;
public
CompareLike
(
Database
db
,
Expression
left
,
Expression
right
,
Expression
escape
,
boolean
regexp
)
{
public
CompareLike
(
Database
db
,
Expression
left
,
Expression
right
,
Expression
escape
,
boolean
regexp
)
{
this
(
db
.
getCompareMode
(),
db
.
getSettings
().
defaultEscape
,
left
,
right
,
escape
,
regexp
);
}
public
CompareLike
(
CompareMode
compareMode
,
String
defaultEscape
,
Expression
left
,
Expression
right
,
Expression
escape
,
boolean
regexp
)
{
public
CompareLike
(
CompareMode
compareMode
,
String
defaultEscape
,
Expression
left
,
Expression
right
,
Expression
escape
,
boolean
regexp
)
{
this
.
compareMode
=
compareMode
;
this
.
defaultEscape
=
defaultEscape
;
this
.
regexp
=
regexp
;
...
...
h2/src/main/org/h2/expression/ExpressionVisitor.java
浏览文件 @
ced54a0a
...
...
@@ -109,7 +109,12 @@ public class ExpressionVisitor {
private
final
long
[]
maxDataModificationId
;
private
final
ColumnResolver
resolver
;
private
ExpressionVisitor
(
int
type
,
int
queryLevel
,
HashSet
<
DbObject
>
dependencies
,
HashSet
<
Column
>
columns
,
Table
table
,
ColumnResolver
resolver
,
long
[]
maxDataModificationId
)
{
private
ExpressionVisitor
(
int
type
,
int
queryLevel
,
HashSet
<
DbObject
>
dependencies
,
HashSet
<
Column
>
columns
,
Table
table
,
ColumnResolver
resolver
,
long
[]
maxDataModificationId
)
{
this
.
type
=
type
;
this
.
queryLevel
=
queryLevel
;
this
.
dependencies
=
dependencies
;
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
ced54a0a
...
...
@@ -1994,7 +1994,8 @@ public class Function extends Expression implements FunctionCall {
return
(
ValueResultSet
)
getValueWithArgs
(
session
,
argList
);
}
private
static
void
setCsvDelimiterEscape
(
Csv
csv
,
String
fieldSeparator
,
String
fieldDelimiter
,
String
escapeCharacter
)
{
private
static
void
setCsvDelimiterEscape
(
Csv
csv
,
String
fieldSeparator
,
String
fieldDelimiter
,
String
escapeCharacter
)
{
if
(
fieldSeparator
!=
null
)
{
csv
.
setFieldSeparatorWrite
(
fieldSeparator
);
if
(
fieldSeparator
.
length
()
>
0
)
{
...
...
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
ced54a0a
...
...
@@ -563,7 +563,8 @@ public class FullText {
* @param data whether the raw data should be returned
* @return the result set
*/
protected
static
ResultSet
search
(
Connection
conn
,
String
text
,
int
limit
,
int
offset
,
boolean
data
)
throws
SQLException
{
protected
static
ResultSet
search
(
Connection
conn
,
String
text
,
int
limit
,
int
offset
,
boolean
data
)
throws
SQLException
{
SimpleResultSet
result
=
createResultSet
(
data
);
if
(
conn
.
getMetaData
().
getURL
().
startsWith
(
"jdbc:columnlist:"
))
{
// this is just to query the result set columns
...
...
@@ -722,7 +723,8 @@ public class FullText {
createOrDropTrigger
(
conn
,
schema
,
table
,
true
);
}
private
static
void
createOrDropTrigger
(
Connection
conn
,
String
schema
,
String
table
,
boolean
create
)
throws
SQLException
{
private
static
void
createOrDropTrigger
(
Connection
conn
,
String
schema
,
String
table
,
boolean
create
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
String
trigger
=
StringUtils
.
quoteIdentifier
(
schema
)
+
"."
+
StringUtils
.
quoteIdentifier
(
TRIGGER_PREFIX
+
table
);
...
...
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
ced54a0a
...
...
@@ -372,7 +372,8 @@ public class FullTextLucene extends FullText {
* @param data whether the raw data should be returned
* @return the result set
*/
protected
static
ResultSet
search
(
Connection
conn
,
String
text
,
int
limit
,
int
offset
,
boolean
data
)
throws
SQLException
{
protected
static
ResultSet
search
(
Connection
conn
,
String
text
,
int
limit
,
int
offset
,
boolean
data
)
throws
SQLException
{
SimpleResultSet
result
=
createResultSet
(
data
);
if
(
conn
.
getMetaData
().
getURL
().
startsWith
(
"jdbc:columnlist:"
))
{
// this is just to query the result set columns
...
...
h2/src/main/org/h2/fulltext/FullTextSettings.java
浏览文件 @
ced54a0a
...
...
@@ -49,7 +49,8 @@ public class FullTextSettings {
/**
* The prepared statement cache.
*/
protected
SoftHashMap
<
Connection
,
SoftHashMap
<
String
,
PreparedStatement
>>
cache
=
new
SoftHashMap
<
Connection
,
SoftHashMap
<
String
,
PreparedStatement
>>();
protected
SoftHashMap
<
Connection
,
SoftHashMap
<
String
,
PreparedStatement
>>
cache
=
new
SoftHashMap
<
Connection
,
SoftHashMap
<
String
,
PreparedStatement
>>();
/**
* The whitespace characters.
...
...
h2/src/main/org/h2/index/BaseIndex.java
浏览文件 @
ced54a0a
...
...
@@ -49,7 +49,8 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
* not yet known
* @param newIndexType the index type
*/
protected
void
initBaseIndex
(
Table
newTable
,
int
id
,
String
name
,
IndexColumn
[]
newIndexColumns
,
IndexType
newIndexType
)
{
protected
void
initBaseIndex
(
Table
newTable
,
int
id
,
String
name
,
IndexColumn
[]
newIndexColumns
,
IndexType
newIndexType
)
{
initSchemaObjectBase
(
newTable
.
getSchema
(),
id
,
name
,
Trace
.
INDEX
);
this
.
indexType
=
newIndexType
;
this
.
table
=
newTable
;
...
...
h2/src/main/org/h2/index/PageDataIndex.java
浏览文件 @
ced54a0a
...
...
@@ -54,7 +54,8 @@ public class PageDataIndex extends PageIndex {
private
boolean
multiVersion
;
public
PageDataIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
IndexType
indexType
,
boolean
create
,
Session
session
)
{
public
PageDataIndex
(
RegularTable
table
,
int
id
,
IndexColumn
[]
columns
,
IndexType
indexType
,
boolean
create
,
Session
session
)
{
initBaseIndex
(
table
,
id
,
table
.
getName
()
+
"_DATA"
,
columns
,
indexType
);
this
.
multiVersion
=
database
.
isMultiVersion
();
...
...
h2/src/main/org/h2/index/PageDataLeaf.java
浏览文件 @
ced54a0a
...
...
@@ -252,7 +252,8 @@ public class PageDataLeaf extends PageData {
size
=
pageSize
-
PageDataOverflow
.
START_MORE
;
next
=
index
.
getPageStore
().
allocatePage
();
}
PageDataOverflow
overflow
=
PageDataOverflow
.
create
(
index
.
getPageStore
(),
page
,
type
,
previous
,
next
,
all
,
dataOffset
,
size
);
PageDataOverflow
overflow
=
PageDataOverflow
.
create
(
index
.
getPageStore
(),
page
,
type
,
previous
,
next
,
all
,
dataOffset
,
size
);
index
.
getPageStore
().
update
(
overflow
);
dataOffset
+=
size
;
remaining
-=
size
;
...
...
@@ -407,7 +408,8 @@ public class PageDataLeaf extends PageData {
boolean
remove
(
long
key
)
{
int
i
=
find
(
key
);
if
(
keys
==
null
||
keys
[
i
]
!=
key
)
{
throw
DbException
.
get
(
ErrorCode
.
ROW_NOT_FOUND_WHEN_DELETING_1
,
index
.
getSQL
()
+
": "
+
key
+
" "
+
(
keys
==
null
?
-
1
:
keys
[
i
]));
throw
DbException
.
get
(
ErrorCode
.
ROW_NOT_FOUND_WHEN_DELETING_1
,
index
.
getSQL
()
+
": "
+
key
+
" "
+
(
keys
==
null
?
-
1
:
keys
[
i
]));
}
index
.
getPageStore
().
logUndo
(
this
,
data
);
if
(
entryCount
==
1
)
{
...
...
h2/src/main/org/h2/index/PageDataNode.java
浏览文件 @
ced54a0a
...
...
@@ -280,7 +280,8 @@ public class PageDataNode extends PageData {
throw
DbException
.
throwInternalError
(
"Page it its own child: "
+
getPos
());
}
count
+=
page
.
getRowCount
();
index
.
getDatabase
().
setProgress
(
DatabaseEventListener
.
STATE_SCAN_FILE
,
index
.
getTable
()
+
"."
+
index
.
getName
(),
count
,
Integer
.
MAX_VALUE
);
index
.
getDatabase
().
setProgress
(
DatabaseEventListener
.
STATE_SCAN_FILE
,
index
.
getTable
()
+
"."
+
index
.
getName
(),
count
,
Integer
.
MAX_VALUE
);
}
rowCount
=
count
;
}
...
...
@@ -363,7 +364,8 @@ public class PageDataNode extends PageData {
}
public
String
toString
()
{
return
"page["
+
getPos
()
+
"] data node table:"
+
index
.
getId
()
+
" entries:"
+
entryCount
+
" "
+
Arrays
.
toString
(
childPageIds
);
return
"page["
+
getPos
()
+
"] data node table:"
+
index
.
getId
()
+
" entries:"
+
entryCount
+
" "
+
Arrays
.
toString
(
childPageIds
);
}
public
void
moveTo
(
Session
session
,
int
newPos
)
{
...
...
h2/src/main/org/h2/index/PageDataOverflow.java
浏览文件 @
ced54a0a
...
...
@@ -105,7 +105,9 @@ public class PageDataOverflow extends Page {
* @param size the number of bytes
* @return the page
*/
static
PageDataOverflow
create
(
PageStore
store
,
int
page
,
int
type
,
int
parentPageId
,
int
next
,
Data
all
,
int
offset
,
int
size
)
{
static
PageDataOverflow
create
(
PageStore
store
,
int
page
,
int
type
,
int
parentPageId
,
int
next
,
Data
all
,
int
offset
,
int
size
)
{
Data
data
=
store
.
createData
();
PageDataOverflow
p
=
new
PageDataOverflow
(
store
,
page
,
data
);
store
.
logUndo
(
p
,
null
);
...
...
h2/src/main/org/h2/index/PageDelegateIndex.java
浏览文件 @
ced54a0a
...
...
@@ -22,7 +22,8 @@ public class PageDelegateIndex extends PageIndex {
private
final
PageDataIndex
mainIndex
;
public
PageDelegateIndex
(
RegularTable
table
,
int
id
,
String
name
,
IndexType
indexType
,
PageDataIndex
mainIndex
,
boolean
create
,
Session
session
)
{
public
PageDelegateIndex
(
RegularTable
table
,
int
id
,
String
name
,
IndexType
indexType
,
PageDataIndex
mainIndex
,
boolean
create
,
Session
session
)
{
IndexColumn
[]
cols
=
IndexColumn
.
wrap
(
new
Column
[]
{
table
.
getColumn
(
mainIndex
.
getMainIndexColumn
())});
this
.
initBaseIndex
(
table
,
id
,
name
,
cols
,
indexType
);
this
.
mainIndex
=
mainIndex
;
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
ced54a0a
...
...
@@ -36,7 +36,8 @@ public class ViewIndex extends BaseIndex {
private
final
TableView
view
;
private
final
String
querySQL
;
private
final
ArrayList
<
Parameter
>
originalParameters
;
private
final
SmallLRUCache
<
IntArray
,
CostElement
>
costCache
=
SmallLRUCache
.
newInstance
(
Constants
.
VIEW_INDEX_CACHE_SIZE
);
private
final
SmallLRUCache
<
IntArray
,
CostElement
>
costCache
=
SmallLRUCache
.
newInstance
(
Constants
.
VIEW_INDEX_CACHE_SIZE
);
private
boolean
recursive
;
private
int
[]
indexMasks
;
private
String
planSQL
;
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
ced54a0a
...
...
@@ -209,7 +209,8 @@ public class JdbcConnection extends TraceObject implements Connection {
try
{
int
id
=
getNextId
(
TraceObject
.
STATEMENT
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"Statement"
,
TraceObject
.
STATEMENT
,
id
,
"createStatement("
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
debugCodeAssign
(
"Statement"
,
TraceObject
.
STATEMENT
,
id
,
"createStatement("
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
}
checkTypeConcurrency
(
resultSetType
,
resultSetConcurrency
);
checkClosed
();
...
...
@@ -263,7 +264,8 @@ public class JdbcConnection extends TraceObject implements Connection {
}
checkClosed
();
sql
=
translateSQL
(
sql
);
return
new
JdbcPreparedStatement
(
this
,
sql
,
id
,
ResultSet
.
TYPE_FORWARD_ONLY
,
Constants
.
DEFAULT_RESULT_SET_CONCURRENCY
,
false
);
return
new
JdbcPreparedStatement
(
this
,
sql
,
id
,
ResultSet
.
TYPE_FORWARD_ONLY
,
Constants
.
DEFAULT_RESULT_SET_CONCURRENCY
,
false
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
...
...
@@ -284,7 +286,8 @@ public class JdbcConnection extends TraceObject implements Connection {
}
checkClosed
();
sql
=
translateSQL
(
sql
);
return
new
JdbcPreparedStatement
(
this
,
sql
,
id
,
ResultSet
.
TYPE_FORWARD_ONLY
,
Constants
.
DEFAULT_RESULT_SET_CONCURRENCY
,
true
);
return
new
JdbcPreparedStatement
(
this
,
sql
,
id
,
ResultSet
.
TYPE_FORWARD_ONLY
,
Constants
.
DEFAULT_RESULT_SET_CONCURRENCY
,
true
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
...
...
@@ -623,7 +626,8 @@ public class JdbcConnection extends TraceObject implements Connection {
try
{
int
id
=
getNextId
(
TraceObject
.
PREPARED_STATEMENT
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"PreparedStatement"
,
TraceObject
.
PREPARED_STATEMENT
,
id
,
"prepareStatement("
+
quote
(
sql
)
+
", "
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
debugCodeAssign
(
"PreparedStatement"
,
TraceObject
.
PREPARED_STATEMENT
,
id
,
"prepareStatement("
+
quote
(
sql
)
+
", "
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
}
checkTypeConcurrency
(
resultSetType
,
resultSetConcurrency
);
checkClosed
();
...
...
@@ -865,7 +869,8 @@ public class JdbcConnection extends TraceObject implements Connection {
try
{
int
id
=
getNextId
(
TraceObject
.
CALLABLE_STATEMENT
);
if
(
isDebugEnabled
())
{
debugCodeAssign
(
"CallableStatement"
,
TraceObject
.
CALLABLE_STATEMENT
,
id
,
"prepareCall("
+
quote
(
sql
)
+
", "
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
debugCodeAssign
(
"CallableStatement"
,
TraceObject
.
CALLABLE_STATEMENT
,
id
,
"prepareCall("
+
quote
(
sql
)
+
", "
+
resultSetType
+
", "
+
resultSetConcurrency
+
")"
);
}
checkTypeConcurrency
(
resultSetType
,
resultSetConcurrency
);
checkClosed
();
...
...
@@ -1006,7 +1011,8 @@ public class JdbcConnection extends TraceObject implements Connection {
* @throws SQLException if the connection is closed or the result set type,
* concurrency, or holdability are not supported
*/
public
PreparedStatement
prepareStatement
(
String
sql
,
int
resultSetType
,
int
resultSetConcurrency
,
int
resultSetHoldability
)
throws
SQLException
{
public
PreparedStatement
prepareStatement
(
String
sql
,
int
resultSetType
,
int
resultSetConcurrency
,
int
resultSetHoldability
)
throws
SQLException
{
try
{
int
id
=
getNextId
(
TraceObject
.
PREPARED_STATEMENT
);
if
(
isDebugEnabled
())
{
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
ced54a0a
...
...
@@ -125,7 +125,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of columns
* @throws SQLException if the connection is closed
*/
public
ResultSet
getTables
(
String
catalogPattern
,
String
schemaPattern
,
String
tableNamePattern
,
String
[]
types
)
throws
SQLException
{
public
ResultSet
getTables
(
String
catalogPattern
,
String
schemaPattern
,
String
tableNamePattern
,
String
[]
types
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getTables("
+
quote
(
catalogPattern
)
+
", "
+
quote
(
schemaPattern
)
+
", "
+
quote
(
tableNamePattern
)
...
...
@@ -301,7 +302,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of indexes and columns
* @throws SQLException if the connection is closed
*/
public
ResultSet
getIndexInfo
(
String
catalogPattern
,
String
schemaPattern
,
String
tableName
,
boolean
unique
,
boolean
approximate
)
public
ResultSet
getIndexInfo
(
String
catalogPattern
,
String
schemaPattern
,
String
tableName
,
boolean
unique
,
boolean
approximate
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
...
...
@@ -829,7 +831,8 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
* @return the list of privileges
* @throws SQLException if the connection is closed
*/
public
ResultSet
getTablePrivileges
(
String
catalogPattern
,
String
schemaPattern
,
String
tableNamePattern
)
throws
SQLException
{
public
ResultSet
getTablePrivileges
(
String
catalogPattern
,
String
schemaPattern
,
String
tableNamePattern
)
throws
SQLException
{
try
{
if
(
isDebugEnabled
())
{
debugCode
(
"getTablePrivileges("
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
ced54a0a
...
...
@@ -63,7 +63,8 @@ import java.util.logging.Logger;
* In this example the user name and password are serialized as
* well; this may be a security problem in some cases.
*/
public
class
JdbcDataSource
extends
TraceObject
implements
XADataSource
,
DataSource
,
ConnectionPoolDataSource
,
Serializable
,
Referenceable
{
public
class
JdbcDataSource
extends
TraceObject
implements
XADataSource
,
DataSource
,
ConnectionPoolDataSource
,
Serializable
,
Referenceable
{
private
static
final
long
serialVersionUID
=
1288136338451857771L
;
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
浏览文件 @
ced54a0a
...
...
@@ -76,7 +76,8 @@ public class JdbcDataSourceFactory implements ObjectFactory {
public
static
TraceSystem
getTraceSystem
()
{
synchronized
(
JdbcDataSourceFactory
.
class
)
{
if
(
cachedTraceSystem
==
null
)
{
cachedTraceSystem
=
new
TraceSystem
(
SysProperties
.
CLIENT_TRACE_DIRECTORY
+
"h2datasource"
+
Constants
.
SUFFIX_TRACE_FILE
);
cachedTraceSystem
=
new
TraceSystem
(
SysProperties
.
CLIENT_TRACE_DIRECTORY
+
"h2datasource"
+
Constants
.
SUFFIX_TRACE_FILE
);
cachedTraceSystem
.
setLevelFile
(
SysProperties
.
DATASOURCE_TRACE_LEVEL
);
}
return
cachedTraceSystem
;
...
...
h2/src/main/org/h2/jmx/DatabaseInfo.java
浏览文件 @
ced54a0a
...
...
@@ -141,7 +141,8 @@ public class DatabaseInfo implements DatabaseInfoMBean {
}
public
long
getFileSize
()
{
return
database
.
isPersistent
()
?
(
database
.
getPageStore
().
getPageCount
()
*
database
.
getPageStore
().
getPageSize
()
/
1024
)
:
0
;
return
database
.
isPersistent
()
?
(
database
.
getPageStore
().
getPageCount
()
*
database
.
getPageStore
().
getPageSize
()
/
1024
)
:
0
;
}
public
int
getCacheSizeMax
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论