Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
3169053d
提交
3169053d
authored
3月 19, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
51343b61
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
77 行增加
和
42 行删除
+77
-42
Constants.java
h2/src/main/org/h2/engine/Constants.java
+1
-0
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+12
-4
JdbcDataSourceFactory.java
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
+3
-1
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+26
-12
help.csv
h2/src/main/org/h2/res/help.csv
+22
-9
Constant.java
h2/src/main/org/h2/schema/Constant.java
+1
-1
Schema.java
h2/src/main/org/h2/schema/Schema.java
+1
-1
SchemaObjectBase.java
h2/src/main/org/h2/schema/SchemaObjectBase.java
+2
-2
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+1
-1
TriggerObject.java
h2/src/main/org/h2/schema/TriggerObject.java
+1
-1
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+3
-2
DiskFile.java
h2/src/main/org/h2/store/DiskFile.java
+0
-1
Table.java
h2/src/main/org/h2/table/Table.java
+3
-1
TableData.java
h2/src/main/org/h2/table/TableData.java
+1
-6
没有找到文件。
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
3169053d
...
...
@@ -68,6 +68,7 @@ package org.h2.engine;
* - Add to freshmeat
* - Upload to http://code.google.com/p/h2database/downloads/list
* - http://en.wikipedia.org/wiki/H2_%28DBMS%29 (change version)
* - http://www.heise.de/software/
*/
/**
* Constants are fixed values that are used in the whole database code.
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
3169053d
...
...
@@ -165,12 +165,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @return the connection
*/
public
Connection
getConnection
(
String
user
,
String
password
)
throws
SQLException
{
if
(
debug
())
{
debugCode
(
"getConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
}
return
getJdbcConnection
(
user
,
password
);
}
private
JdbcConnection
getJdbcConnection
(
String
user
,
String
password
)
throws
SQLException
{
if
(
debug
())
{
debugCode
(
"getJdbcConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
}
Properties
info
=
new
Properties
();
info
.
setProperty
(
"user"
,
user
);
info
.
setProperty
(
"password"
,
password
);
...
...
@@ -278,7 +282,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
//#ifdef JDK14
public
XAConnection
getXAConnection
(
String
user
,
String
password
)
throws
SQLException
{
if
(
debug
())
{
debugCode
(
"getXAConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
}
int
id
=
getNextId
(
XA_DATA_SOURCE
);
return
new
JdbcXAConnection
(
factory
,
id
,
url
,
user
,
password
);
}
...
...
@@ -306,7 +312,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
//#ifdef JDK14
public
PooledConnection
getPooledConnection
(
String
user
,
String
password
)
throws
SQLException
{
if
(
debug
())
{
debugCode
(
"getPooledConnection("
+
quote
(
user
)+
", "
+
quote
(
password
)+
");"
);
}
return
getXAConnection
(
user
,
password
);
}
//#endif
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSourceFactory.java
浏览文件 @
3169053d
...
...
@@ -59,7 +59,9 @@ implements ObjectFactory
*/
//#ifdef JDK14
public
synchronized
Object
getObjectInstance
(
Object
obj
,
Name
name
,
Context
nameCtx
,
Hashtable
environment
)
throws
Exception
{
if
(
trace
.
debug
())
{
trace
.
debug
(
"getObjectInstance obj="
+
obj
+
" name="
+
name
+
" nameCtx="
+
nameCtx
+
" environment="
+
environment
);
}
Reference
ref
=
(
Reference
)
obj
;
if
(
ref
.
getClassName
().
equals
(
JdbcDataSource
.
class
.
getName
()))
{
JdbcDataSource
dataSource
=
new
JdbcDataSource
();
...
...
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
3169053d
...
...
@@ -123,7 +123,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
addConnectionEventListener
(
ConnectionEventListener
listener
)
{
debugCode
(
"addConnectionEventListener(listener)"
);
debugCode
(
"addConnectionEventListener(listener)
;
"
);
listeners
.
add
(
listener
);
if
(
conn
!=
null
)
{
conn
.
setJdbcConnectionListener
(
this
);
...
...
@@ -138,7 +138,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
removeConnectionEventListener
(
ConnectionEventListener
listener
)
{
debugCode
(
"removeConnectionEventListener(listener)"
);
debugCode
(
"removeConnectionEventListener(listener)
;
"
);
listeners
.
remove
(
listener
);
}
//#endif
...
...
@@ -148,7 +148,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
fatalErrorOccurred
(
JdbcConnection
conn
,
SQLException
e
)
throws
SQLException
{
debugCode
(
"fatalErrorOccurred(conn, e)"
);
debugCode
(
"fatalErrorOccurred(conn, e)
;
"
);
for
(
int
i
=
0
;
i
<
listeners
.
size
();
i
++)
{
ConnectionEventListener
listener
=
(
ConnectionEventListener
)
listeners
.
get
(
i
);
ConnectionEvent
event
=
new
ConnectionEvent
(
this
,
e
);
...
...
@@ -163,7 +163,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
closed
(
JdbcConnection
conn
)
{
debugCode
(
"closed(conn)"
);
debugCode
(
"closed(conn)
;
"
);
for
(
int
i
=
0
;
i
<
listeners
.
size
();
i
++)
{
ConnectionEventListener
listener
=
(
ConnectionEventListener
)
listeners
.
get
(
i
);
ConnectionEvent
event
=
new
ConnectionEvent
(
this
);
...
...
@@ -205,7 +205,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
boolean
isSameRM
(
XAResource
xares
)
throws
XAException
{
debugCode
(
"isSameRM(xares)"
);
debugCode
(
"isSameRM(xares)
;
"
);
return
xares
==
this
;
}
//#endif
...
...
@@ -253,7 +253,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
int
prepare
(
Xid
xid
)
throws
XAException
{
debugCode
(
"prepare("
+
quoteXid
(
xid
)+
")"
);
if
(
debug
())
{
debugCode
(
"prepare("
+
quoteXid
(
xid
)+
");"
);
}
checkOpen
();
if
(!
currentTransaction
.
equals
(
xid
))
{
getTrace
().
debug
(
"throw XAException.XAER_INVAL"
);
...
...
@@ -282,7 +284,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
forget
(
Xid
xid
)
throws
XAException
{
debugCode
(
"forget("
+
quoteXid
(
xid
)+
")"
);
if
(
debug
())
{
debugCode
(
"forget("
+
quoteXid
(
xid
)+
");"
);
}
}
//#endif
...
...
@@ -293,7 +297,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
rollback
(
Xid
xid
)
throws
XAException
{
debugCode
(
"rollback("
+
quoteXid
(
xid
)+
")"
);
if
(
debug
())
{
debugCode
(
"rollback("
+
quoteXid
(
xid
)+
");"
);
}
try
{
conn
.
rollback
();
}
catch
(
SQLException
e
)
{
...
...
@@ -312,7 +318,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
end
(
Xid
xid
,
int
flags
)
throws
XAException
{
debugCode
(
"end("
+
quoteXid
(
xid
)+
", "
+
quoteFlags
(
flags
)+
")"
);
if
(
debug
())
{
debugCode
(
"end("
+
quoteXid
(
xid
)+
", "
+
quoteFlags
(
flags
)+
");"
);
}
// TODO transaction end: implement this method
if
(
flags
==
TMSUSPEND
)
{
return
;
...
...
@@ -332,7 +340,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
start
(
Xid
xid
,
int
flags
)
throws
XAException
{
debugCode
(
"start("
+
quoteXid
(
xid
)+
", "
+
quoteFlags
(
flags
)+
")"
);
if
(
debug
())
{
debugCode
(
"start("
+
quoteXid
(
xid
)+
", "
+
quoteFlags
(
flags
)+
");"
);
}
if
(
flags
==
TMRESUME
)
{
return
;
}
...
...
@@ -358,7 +368,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public
void
commit
(
Xid
xid
,
boolean
onePhase
)
throws
XAException
{
debugCode
(
"commit("
+
quoteXid
(
xid
)+
", "
+
onePhase
+
")"
);
if
(
debug
())
{
debugCode
(
"commit("
+
quoteXid
(
xid
)+
", "
+
onePhase
+
");"
);
}
Statement
stat
=
null
;
try
{
if
(
onePhase
)
{
...
...
@@ -430,7 +442,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
private
XAException
convertException
(
SQLException
e
)
{
getTrace
().
debug
(
"throw XAException("
+
e
.
getMessage
()+
")"
);
if
(
debug
())
{
getTrace
().
debug
(
"throw XAException("
+
e
.
getMessage
()+
");"
);
}
return
new
XAException
(
e
.
getMessage
());
}
...
...
h2/src/main/org/h2/res/help.csv
浏览文件 @
3169053d
...
...
@@ -1109,7 +1109,7 @@ SET {TRACE_LEVEL_FILE | TRACE_LEVEL_SYSTEM_OUT} int
","
Sets the trace level for file the file or system out stream.
Levels: 0=off, 1=error, 2=info, 3=debug.
This setting is persistent.
This setting is
not
persistent.
Admin rights are required to execute this command.
This setting can be appended to the database URL: jdbc:h2:test;TRACE_LEVEL_SYSTEM_OUT=3
","
...
...
@@ -1517,7 +1517,8 @@ A digit.
"Data Types","INT Type","
INT | INTEGER | MEDIUMINT | INT4 | SIGNED
","
Possible values: -2147483648 to 2147483647
Possible values: -2147483648 to 2147483647.
See also java.lang.Integer.
","
INT
"
...
...
@@ -1525,7 +1526,8 @@ INT
"Data Types","BOOLEAN Type","
BOOLEAN | BIT | BOOL
","
Possible values: TRUE and FALSE
Possible values: TRUE and FALSE.
See also java.lang.Boolean.
","
BOOLEAN
"
...
...
@@ -1533,7 +1535,8 @@ BOOLEAN
"Data Types","TINYINT Type","
TINYINT
","
Possible values are: -128 to 127
Possible values are: -128 to 127.
See also java.lang.Byte.
","
TINYINT
"
...
...
@@ -1541,7 +1544,8 @@ TINYINT
"Data Types","SMALLINT Type","
SMALLINT | INT2 | YEAR
","
Possible values: -32768 to 32767
Possible values: -32768 to 32767.
See also java.lang.Short.
","
SMALLINT
"
...
...
@@ -1549,7 +1553,8 @@ SMALLINT
"Data Types","BIGINT Type","
BIGINT | INT8
","
Possible values: -9223372036854775808 to 9223372036854775807
Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
","
BIGINT
"
...
...
@@ -1558,7 +1563,8 @@ BIGINT
IDENTITY
","
Auto-Increment value.
Possible values: -9223372036854775808 to 9223372036854775807
Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
","
IDENTITY
"
...
...
@@ -1568,6 +1574,7 @@ IDENTITY
","
Data type with fixed precision and scale.
This data type is recommended for storing currency values.
See also java.math.BigDecimal.
","
DECIMAL(20, 2)
"
...
...
@@ -1575,8 +1582,9 @@ DECIMAL(20, 2)
"Data Types","DOUBLE Type","
{DOUBLE [PRECISION] | FLOAT | FLOAT4 | FLOAT8}
","
Floating point number
(java.lang.Double)
.
Floating point number.
Should not be used to represent currency values, because of rounding problems.
See also java.lang.Double.
","
DOUBLE
"
...
...
@@ -1584,8 +1592,9 @@ DOUBLE
"Data Types","REAL Type","
REAL
","
Single precision floating point number
(java.lang.Float)
.
Single precision floating point number.
Should not be used to represent currency values, because of rounding problems.
See also java.lang.Float.
","
REAL
"
...
...
@@ -1594,6 +1603,7 @@ REAL
TIME
","
The format is hh:mm:ss.
See also java.sql.Time.
","
TIME
"
...
...
@@ -1602,6 +1612,7 @@ TIME
DATE
","
The format is yyyy-MM-dd.
See also java.sql.Date.
","
DATE
"
...
...
@@ -1610,6 +1621,7 @@ DATE
{TIMESTAMP | DATETIME | SMALLDATETIME}
","
The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
See also java.sql.Timestamp.
","
TIMESTAMP
"
...
...
@@ -1646,6 +1658,7 @@ VARCHAR2 | NVARCHAR | NVARCHAR2 | VARCHAR_CASESENSITIVE}
Unicode String. Use two single quotes ('') to create a quote.
There is no maximum precision. The maximum size is the memory available.
For large text data CLOB should be used.
See also java.lang.String.
","
VARCHAR(255)
"
...
...
h2/src/main/org/h2/schema/Constant.java
浏览文件 @
3169053d
...
...
@@ -25,7 +25,7 @@ public class Constant extends SchemaObjectBase {
private
ValueExpression
expression
;
public
Constant
(
Schema
schema
,
int
id
,
String
name
)
{
super
(
schema
,
id
,
name
,
Trace
.
SCHEMA
);
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
SCHEMA
);
}
public
String
getCreateSQLForCopy
(
Table
table
,
String
quotedName
)
{
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
3169053d
...
...
@@ -50,7 +50,7 @@ public class Schema extends DbObjectBase {
private
HashSet
temporaryUniqueNames
=
new
HashSet
();
public
Schema
(
Database
database
,
int
id
,
String
schemaName
,
User
owner
,
boolean
system
)
{
super
(
database
,
id
,
schemaName
,
Trace
.
SCHEMA
);
initDbObjectBase
(
database
,
id
,
schemaName
,
Trace
.
SCHEMA
);
this
.
owner
=
owner
;
this
.
system
=
system
;
}
...
...
h2/src/main/org/h2/schema/SchemaObjectBase.java
浏览文件 @
3169053d
...
...
@@ -14,8 +14,8 @@ public abstract class SchemaObjectBase extends DbObjectBase implements SchemaObj
private
Schema
schema
;
protected
SchemaObjectBase
(
Schema
schema
,
int
id
,
String
name
,
String
traceModule
)
{
super
(
schema
.
getDatabase
(),
id
,
name
,
traceModule
);
protected
void
init
SchemaObjectBase
(
Schema
schema
,
int
id
,
String
name
,
String
traceModule
)
{
initDbObjectBase
(
schema
.
getDatabase
(),
id
,
name
,
traceModule
);
this
.
schema
=
schema
;
}
...
...
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
3169053d
...
...
@@ -27,7 +27,7 @@ public class Sequence extends SchemaObjectBase {
private
boolean
belongsToTable
;
public
Sequence
(
Schema
schema
,
int
id
,
String
name
,
boolean
belongsToTable
)
{
super
(
schema
,
id
,
name
,
Trace
.
SEQUENCE
);
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
SEQUENCE
);
this
.
belongsToTable
=
belongsToTable
;
}
...
...
h2/src/main/org/h2/schema/TriggerObject.java
浏览文件 @
3169053d
...
...
@@ -39,7 +39,7 @@ public class TriggerObject extends SchemaObjectBase {
private
Trigger
triggerCallback
;
public
TriggerObject
(
Schema
schema
,
int
id
,
String
name
,
Table
table
)
{
super
(
schema
,
id
,
name
,
Trace
.
TRIGGER
);
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
TRIGGER
);
this
.
table
=
table
;
setTemporary
(
table
.
getTemporary
());
}
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
3169053d
...
...
@@ -76,11 +76,12 @@ public class WebServer implements Service {
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa"
,
"Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<db>|"
,
"Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://<host>:<port>/<db>|"
,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa"
,
"Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa"
,
"Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa"
,
"Generic H
SQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa"
,
"Generic H
2 (Server)|org.h2.Driver|jdbc:h2:tcp://localhost/~/test|sa"
,
// this will be listed on top for new installations
"Generic H2|org.h2.Driver|jdbc:h2:~/test|sa"
,
"Generic H2
(Embedded)
|org.h2.Driver|jdbc:h2:~/test|sa"
,
};
/*
...
...
h2/src/main/org/h2/store/DiskFile.java
浏览文件 @
3169053d
...
...
@@ -645,7 +645,6 @@ public class DiskFile implements CacheWriter {
}
else
{
if
(
SysProperties
.
REUSE_SPACE_QUICKLY
)
{
potentiallyFreePages
.
add
(
ObjectUtils
.
getInteger
(
page
));
reuseSpace
();
}
}
}
...
...
h2/src/main/org/h2/table/Table.java
浏览文件 @
3169053d
...
...
@@ -207,7 +207,7 @@ public abstract class Table extends SchemaObjectBase {
public
abstract
long
getRowCount
(
Session
session
)
throws
SQLException
;
public
Table
(
Schema
schema
,
int
id
,
String
name
,
boolean
persistent
)
{
super
(
schema
,
id
,
name
,
Trace
.
TABLE
);
initSchemaObjectBase
(
schema
,
id
,
name
,
Trace
.
TABLE
);
this
.
persistent
=
persistent
;
}
...
...
@@ -420,6 +420,8 @@ public abstract class Table extends SchemaObjectBase {
}
/**
* Get the best plan for the given search mask.
*
* @param masks - null means 'always false'
*/
public
PlanItem
getBestPlanItem
(
Session
session
,
int
[]
masks
)
throws
SQLException
{
...
...
h2/src/main/org/h2/table/TableData.java
浏览文件 @
3169053d
...
...
@@ -21,7 +21,6 @@ import org.h2.index.Cursor;
import
org.h2.index.HashIndex
;
import
org.h2.index.Index
;
import
org.h2.index.IndexType
;
import
org.h2.index.LinearHashIndex
;
import
org.h2.index.MultiVersionIndex
;
import
org.h2.index.ScanIndex
;
import
org.h2.index.TreeIndex
;
...
...
@@ -157,11 +156,7 @@ public class TableData extends Table implements RecordReader {
}
Index
index
;
if
(
isPersistent
()
&&
indexType
.
isPersistent
())
{
if
(
indexType
.
isHash
())
{
index
=
new
LinearHashIndex
(
session
,
this
,
indexId
,
indexName
,
cols
,
indexType
);
}
else
{
index
=
new
BtreeIndex
(
session
,
this
,
indexId
,
indexName
,
cols
,
indexType
,
headPos
);
}
}
else
{
if
(
indexType
.
isHash
())
{
index
=
new
HashIndex
(
this
,
indexId
,
indexName
,
cols
,
indexType
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论