Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8bd9aeaa
提交
8bd9aeaa
authored
12月 09, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
javadoc
上级
1d66e95d
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
484 行增加
和
41 行删除
+484
-41
AggregateFunction.java
h2/src/main/org/h2/api/AggregateFunction.java
+9
-7
DatabaseEventListener.java
h2/src/main/org/h2/api/DatabaseEventListener.java
+21
-3
Trigger.java
h2/src/main/org/h2/api/Trigger.java
+14
-3
CommandInterface.java
h2/src/main/org/h2/command/CommandInterface.java
+40
-0
CreateTrigger.java
h2/src/main/org/h2/command/ddl/CreateTrigger.java
+1
-1
Compressor.java
h2/src/main/org/h2/compress/Compressor.java
+39
-1
SysProperties.java
h2/src/main/org/h2/constant/SysProperties.java
+1
-0
Constants.java
h2/src/main/org/h2/engine/Constants.java
+5
-7
SessionInterface.java
h2/src/main/org/h2/engine/SessionInterface.java
+50
-0
FunctionCall.java
h2/src/main/org/h2/expression/FunctionCall.java
+51
-0
ParameterInterface.java
h2/src/main/org/h2/expression/ParameterInterface.java
+18
-0
BtreeLeaf.java
h2/src/main/org/h2/index/BtreeLeaf.java
+2
-2
BtreeNode.java
h2/src/main/org/h2/index/BtreeNode.java
+2
-2
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+29
-1
DataHandler.java
h2/src/main/org/h2/store/DataHandler.java
+98
-2
RecordReader.java
h2/src/main/org/h2/store/RecordReader.java
+8
-0
ColumnResolver.java
h2/src/main/org/h2/table/ColumnResolver.java
+43
-1
Cache.java
h2/src/main/org/h2/util/Cache.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-0
TestTriggersConstraints.java
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
+4
-4
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+45
-5
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+2
-1
没有找到文件。
h2/src/main/org/h2/api/AggregateFunction.java
浏览文件 @
8bd9aeaa
...
@@ -42,6 +42,8 @@ public interface AggregateFunction {
...
@@ -42,6 +42,8 @@ public interface AggregateFunction {
/**
/**
* This method returns the computed aggregate value.
* This method returns the computed aggregate value.
*
* @return the aggregated value
*/
*/
Object
getResult
()
throws
SQLException
;
Object
getResult
()
throws
SQLException
;
}
}
h2/src/main/org/h2/api/DatabaseEventListener.java
浏览文件 @
8bd9aeaa
...
@@ -14,7 +14,25 @@ import java.util.EventListener;
...
@@ -14,7 +14,25 @@ import java.util.EventListener;
*/
*/
public
interface
DatabaseEventListener
extends
EventListener
{
public
interface
DatabaseEventListener
extends
EventListener
{
int
STATE_SCAN_FILE
=
0
,
STATE_CREATE_INDEX
=
1
,
STATE_RECOVER
=
2
,
STATE_BACKUP_FILE
=
3
;
/**
* This state is used when scanning the data or index file.
*/
int
STATE_SCAN_FILE
=
0
;
/**
* This state is used when re-creating an index.
*/
int
STATE_CREATE_INDEX
=
1
;
/**
* This state is used when re-applying the transaction log or rolling back uncommitted transactions.
*/
int
STATE_RECOVER
=
2
;
/**
* This state is used during the BACKUP command.
*/
int
STATE_BACKUP_FILE
=
3
;
/**
/**
* This method is called just after creating the object.
* This method is called just after creating the object.
...
...
h2/src/main/org/h2/api/Trigger.java
浏览文件 @
8bd9aeaa
...
@@ -9,13 +9,24 @@ import java.sql.SQLException;
...
@@ -9,13 +9,24 @@ import java.sql.SQLException;
/**
/**
* A class that implements this interface can be used as a trigger.
* A class that implements this interface can be used as a trigger.
*
* @author Thomas
*/
*/
public
interface
Trigger
{
public
interface
Trigger
{
int
INSERT
=
1
,
UPDATE
=
2
,
DELETE
=
4
;
/**
* The trigger is called for INSERT statements.
*/
int
INSERT
=
1
;
/**
* The trigger is called for UPDATE statements.
*/
int
UPDATE
=
2
;
/**
* The trigger is called for DELETE statements.
*/
int
DELETE
=
4
;
/**
/**
* This method is called by the database engine once when initializing the trigger.
* This method is called by the database engine once when initializing the trigger.
...
...
h2/src/main/org/h2/command/CommandInterface.java
浏览文件 @
8bd9aeaa
...
@@ -13,11 +13,51 @@ import org.h2.util.ObjectArray;
...
@@ -13,11 +13,51 @@ import org.h2.util.ObjectArray;
* Represents a SQL statement.
* Represents a SQL statement.
*/
*/
public
interface
CommandInterface
{
public
interface
CommandInterface
{
/**
* Check if this is a query.
*
* @return true if it is a query
*/
boolean
isQuery
();
boolean
isQuery
();
/**
* Get the parameters (if any).
*
* @return the parameters
*/
ObjectArray
getParameters
();
ObjectArray
getParameters
();
/**
* Execute the query.
*
* @param maxRows the maximum number of rows returned
* @param scrollable if the result set must be scrollable
* @return the result
*/
ResultInterface
executeQuery
(
int
maxRows
,
boolean
scrollable
)
throws
SQLException
;
ResultInterface
executeQuery
(
int
maxRows
,
boolean
scrollable
)
throws
SQLException
;
/**
* Execute the statement
*
* @return the update count
*/
int
executeUpdate
()
throws
SQLException
;
int
executeUpdate
()
throws
SQLException
;
/**
* Close the statement.
*/
void
close
();
void
close
();
/**
* Cancel the statement if it is still processing.
*/
void
cancel
();
void
cancel
();
/**
* Get an empty result set containing the meta data of the result.
*
* @return the empty result
*/
ResultInterface
getMetaData
()
throws
SQLException
;
ResultInterface
getMetaData
()
throws
SQLException
;
}
}
h2/src/main/org/h2/command/ddl/CreateTrigger.java
浏览文件 @
8bd9aeaa
...
@@ -89,8 +89,8 @@ public class CreateTrigger extends SchemaCommand {
...
@@ -89,8 +89,8 @@ public class CreateTrigger extends SchemaCommand {
trigger
.
setNoWait
(
noWait
);
trigger
.
setNoWait
(
noWait
);
trigger
.
setQueueSize
(
queueSize
);
trigger
.
setQueueSize
(
queueSize
);
trigger
.
setRowBased
(
rowBased
);
trigger
.
setRowBased
(
rowBased
);
trigger
.
setTriggerClassName
(
session
,
triggerClassName
);
trigger
.
setTypeMask
(
typeMask
);
trigger
.
setTypeMask
(
typeMask
);
trigger
.
setTriggerClassName
(
session
,
triggerClassName
);
db
.
addSchemaObject
(
session
,
trigger
);
db
.
addSchemaObject
(
session
,
trigger
);
table
.
addTrigger
(
trigger
);
table
.
addTrigger
(
trigger
);
return
0
;
return
0
;
...
...
h2/src/main/org/h2/compress/Compressor.java
浏览文件 @
8bd9aeaa
...
@@ -11,10 +11,48 @@ import java.sql.SQLException;
...
@@ -11,10 +11,48 @@ import java.sql.SQLException;
*/
*/
public
interface
Compressor
{
public
interface
Compressor
{
int
NO
=
0
,
LZF
=
1
,
DEFLATE
=
2
;
/**
* No compression is used.
*/
int
NO
=
0
;
/**
* The LZF compression algorithm is used
*/
int
LZF
=
1
;
/**
* The DEFLATE compression algorithm is used.
*/
int
DEFLATE
=
2
;
/**
* Get the compression algorithm type.
*
* @return the type
*/
int
getAlgorithm
();
int
getAlgorithm
();
/**
* Compress a number of bytes.
*
* @param in the input data
* @param inLen the number of bytes to compress
* @param out the output area
* @param outPos the offset at the output array
* @return the size of the compressed data
*/
int
compress
(
byte
[]
in
,
int
inLen
,
byte
[]
out
,
int
outPos
);
int
compress
(
byte
[]
in
,
int
inLen
,
byte
[]
out
,
int
outPos
);
/**
* Expand a number of compressed bytes.
* @param in the compressed data
* @param inPos the offset at the input array
* @param inLen the number of bytes to read
* @param out the output area
* @param outPos the offset at the output array
* @param outLen the size of the uncompressed data
*/
void
expand
(
byte
[]
in
,
int
inPos
,
int
inLen
,
byte
[]
out
,
int
outPos
,
int
outLen
)
throws
SQLException
;
void
expand
(
byte
[]
in
,
int
inPos
,
int
inLen
,
byte
[]
out
,
int
outPos
,
int
outLen
)
throws
SQLException
;
void
setOptions
(
String
options
)
throws
SQLException
;
void
setOptions
(
String
options
)
throws
SQLException
;
}
}
h2/src/main/org/h2/constant/SysProperties.java
浏览文件 @
8bd9aeaa
...
@@ -72,6 +72,7 @@ public class SysProperties {
...
@@ -72,6 +72,7 @@ public class SysProperties {
public
static
final
boolean
NEW_DISPLAY_SIZE
=
getBooleanSetting
(
"h2.newDisplaySize"
,
true
);
public
static
final
boolean
NEW_DISPLAY_SIZE
=
getBooleanSetting
(
"h2.newDisplaySize"
,
true
);
public
static
final
int
DEFAULT_MAX_OPERATION_MEMORY
=
getIntSetting
(
"h2.defaultMaxOperationMemory"
,
100000
);
public
static
final
int
DEFAULT_MAX_OPERATION_MEMORY
=
getIntSetting
(
"h2.defaultMaxOperationMemory"
,
100000
);
public
static
final
String
ALLOWED_CLASSES
=
getStringSetting
(
"h2.allowedClasses"
,
"*"
);
public
static
final
String
ALLOWED_CLASSES
=
getStringSetting
(
"h2.allowedClasses"
,
"*"
);
public
static
final
int
MIN_COLUMN_NAME_MAP
=
getIntSetting
(
"h2.minColumnNameMap"
,
3
);
private
static
boolean
getBooleanSetting
(
String
name
,
boolean
defaultValue
)
{
private
static
boolean
getBooleanSetting
(
String
name
,
boolean
defaultValue
)
{
String
s
=
getProperty
(
name
);
String
s
=
getProperty
(
name
);
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
8bd9aeaa
...
@@ -66,8 +66,6 @@ import org.h2.constant.SysProperties;
...
@@ -66,8 +66,6 @@ import org.h2.constant.SysProperties;
* - Add to freshmeat
* - Add to freshmeat
* - Upload to http://code.google.com/p/h2database/downloads/list
* - Upload to http://code.google.com/p/h2database/downloads/list
* - svn copy: .../svn/trunk .../svn/tags/version-1.0.x; Version 1.0.x (yyyy-mm-dd)
* - svn copy: .../svn/trunk .../svn/tags/version-1.0.x; Version 1.0.x (yyyy-mm-dd)
*
* @author Thomas
*/
*/
/**
/**
* Constants are fixed values that are used in the whole database code.
* Constants are fixed values that are used in the whole database code.
...
...
h2/src/main/org/h2/engine/SessionInterface.java
浏览文件 @
8bd9aeaa
...
@@ -14,12 +14,62 @@ import org.h2.store.DataHandler;
...
@@ -14,12 +14,62 @@ import org.h2.store.DataHandler;
* A local or remote session. A session represents a database connection.
* A local or remote session. A session represents a database connection.
*/
*/
public
interface
SessionInterface
{
public
interface
SessionInterface
{
/**
* Parse a command and prepare it for execution.
*
* @param sql the SQL statement
* @return the prepared command
*/
CommandInterface
prepareCommand
(
String
sql
)
throws
SQLException
;
CommandInterface
prepareCommand
(
String
sql
)
throws
SQLException
;
/**
* Roll back pending transactions and close the session.
*/
void
close
()
throws
SQLException
;
void
close
()
throws
SQLException
;
/**
* Get the trace object
*
* @return the trace object
*/
Trace
getTrace
();
Trace
getTrace
();
/**
* Check if close was called.
*
* @return if the session has been closed
*/
boolean
isClosed
();
boolean
isClosed
();
/**
* Open a new session.
*
* @param ci the connection parameters
* @return the new session
*/
SessionInterface
createSession
(
ConnectionInfo
ci
)
throws
SQLException
;
SessionInterface
createSession
(
ConnectionInfo
ci
)
throws
SQLException
;
/**
* Get the number of disk operations before power failure is simulated.
* This is used for testing. If not set, 0 is returned
*
* @return the number of operations, or 0
*/
int
getPowerOffCount
();
int
getPowerOffCount
();
/**
* Set the number of disk operations before power failure is simulated.
* To disable the countdown, use 0.
*
* @param i the number of operations
*/
void
setPowerOffCount
(
int
i
)
throws
SQLException
;
void
setPowerOffCount
(
int
i
)
throws
SQLException
;
/**
* Get the data handler object.
*
* @return the data handler
*/
DataHandler
getDataHandler
();
DataHandler
getDataHandler
();
}
}
h2/src/main/org/h2/expression/FunctionCall.java
浏览文件 @
8bd9aeaa
...
@@ -16,13 +16,64 @@ import org.h2.value.ValueResultSet;
...
@@ -16,13 +16,64 @@ import org.h2.value.ValueResultSet;
*/
*/
public
interface
FunctionCall
{
public
interface
FunctionCall
{
/**
* Get the name of the function.
*
* @return the name
*/
String
getName
();
String
getName
();
/**
* Get the number of parameters.
*
* @return the number of parameters
*/
int
getParameterCount
()
throws
SQLException
;
int
getParameterCount
()
throws
SQLException
;
/**
* Get an empty result set with the column names set.
*
* @param session the session
* @param nullArgs the argument list (some arguments may be null)
* @return the empty result set
*/
ValueResultSet
getValueForColumnList
(
Session
session
,
Expression
[]
nullArgs
)
throws
SQLException
;
ValueResultSet
getValueForColumnList
(
Session
session
,
Expression
[]
nullArgs
)
throws
SQLException
;
/**
* Get the data type.
*
* @return the data type
*/
int
getType
();
int
getType
();
/**
* Optimize the function if possible.
*
* @param session the session
* @return the optimized expression
*/
Expression
optimize
(
Session
session
)
throws
SQLException
;
Expression
optimize
(
Session
session
)
throws
SQLException
;
/**
* Calculate the result.
*
* @param session the session
* @return the result
*/
Value
getValue
(
Session
session
)
throws
SQLException
;
Value
getValue
(
Session
session
)
throws
SQLException
;
/**
* Get the function arguments.
*
* @return argument list
*/
Expression
[]
getArgs
();
Expression
[]
getArgs
();
/**
* Get the SQL snippet of the function (including arguments).
*
* @return the SQL snippet.
*/
String
getSQL
();
String
getSQL
();
}
}
h2/src/main/org/h2/expression/ParameterInterface.java
浏览文件 @
8bd9aeaa
...
@@ -12,7 +12,25 @@ import org.h2.value.Value;
...
@@ -12,7 +12,25 @@ import org.h2.value.Value;
* The interface for client side (remote) and server side parameters.
* The interface for client side (remote) and server side parameters.
*/
*/
public
interface
ParameterInterface
{
public
interface
ParameterInterface
{
/**
* Set the value of the parameter.
*
* @param value the new value
*/
void
setValue
(
Value
value
);
void
setValue
(
Value
value
);
/**
* Get the value of the parameter if set.
*
* @return the value or null
*/
Value
getParamValue
()
throws
SQLException
;
Value
getParamValue
()
throws
SQLException
;
/**
* Check if the value is set.
*
* @throws SQLException if not set.
*/
void
checkSet
()
throws
SQLException
;
void
checkSet
()
throws
SQLException
;
}
}
h2/src/main/org/h2/index/BtreeLeaf.java
浏览文件 @
8bd9aeaa
...
@@ -23,9 +23,9 @@ import org.h2.value.Value;
...
@@ -23,9 +23,9 @@ import org.h2.value.Value;
* An outer page of a btree index.
* An outer page of a btree index.
*
*
* Page format:
* Page format:
* <pre>
* L { P(pointers) | D(data) } data.len { data[0].pos [data[0]], ... }
* L { P(pointers) | D(data) } data.len { data[0].pos [data[0]], ... }
*
* </pre>
* @author Thomas
*/
*/
public
class
BtreeLeaf
extends
BtreePage
{
public
class
BtreeLeaf
extends
BtreePage
{
...
...
h2/src/main/org/h2/index/BtreeNode.java
浏览文件 @
8bd9aeaa
...
@@ -23,9 +23,9 @@ import org.h2.value.Value;
...
@@ -23,9 +23,9 @@ import org.h2.value.Value;
* An inner page of a b-tree index.
* An inner page of a b-tree index.
*
*
* Page format:
* Page format:
* <pre>
* N children.len children[0..len] data.len { data[0].pos [data[0]], ... }
* N children.len children[0..len] data.len { data[0].pos [data[0]], ... }
*
*</pre>
* @author Thomas
*/
*/
public
class
BtreeNode
extends
BtreePage
{
public
class
BtreeNode
extends
BtreePage
{
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
8bd9aeaa
...
@@ -21,9 +21,11 @@ import java.sql.Statement;
...
@@ -21,9 +21,11 @@ import java.sql.Statement;
import
java.sql.Time
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Constants
;
import
org.h2.engine.SessionInterface
;
import
org.h2.engine.SessionInterface
;
import
org.h2.message.Message
;
import
org.h2.message.Message
;
...
@@ -69,6 +71,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -69,6 +71,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
private
boolean
wasNull
;
private
boolean
wasNull
;
private
Value
[]
insertRow
;
private
Value
[]
insertRow
;
private
Value
[]
updateRow
;
private
Value
[]
updateRow
;
private
HashMap
columnNameMap
;
JdbcResultSet
(
SessionInterface
session
,
JdbcConnection
conn
,
JdbcStatement
stat
,
ResultInterface
result
,
int
id
,
boolean
closeStatement
,
boolean
scrollable
)
{
JdbcResultSet
(
SessionInterface
session
,
JdbcConnection
conn
,
JdbcStatement
stat
,
ResultInterface
result
,
int
id
,
boolean
closeStatement
,
boolean
scrollable
)
{
setTrace
(
session
.
getTrace
(),
TraceObject
.
RESULT_SET
,
id
);
setTrace
(
session
.
getTrace
(),
TraceObject
.
RESULT_SET
,
id
);
...
@@ -2819,6 +2822,31 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2819,6 +2822,31 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
if
(
columnName
==
null
)
{
if
(
columnName
==
null
)
{
throw
Message
.
getInvalidValueException
(
"columnName"
,
null
);
throw
Message
.
getInvalidValueException
(
"columnName"
,
null
);
}
}
if
(
columnCount
>=
SysProperties
.
MIN_COLUMN_NAME_MAP
)
{
if
(
columnNameMap
==
null
)
{
HashMap
map
=
new
HashMap
(
columnCount
);
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
String
c
=
result
.
getAlias
(
i
).
toUpperCase
();
map
.
put
(
c
,
ObjectUtils
.
getInteger
(
i
));
String
tabName
=
result
.
getTableName
(
i
);
if
(
tabName
!=
null
)
{
String
colName
=
result
.
getColumnName
(
i
);
if
(
colName
!=
null
)
{
c
=
tabName
+
"."
+
colName
;
if
(!
map
.
containsKey
(
c
))
{
map
.
put
(
c
,
ObjectUtils
.
getInteger
(
i
));
}
}
}
}
columnNameMap
=
map
;
}
Integer
index
=
(
Integer
)
columnNameMap
.
get
(
columnName
.
toUpperCase
());
if
(
index
==
null
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
COLUMN_NOT_FOUND_1
,
columnName
);
}
return
index
.
intValue
()
+
1
;
}
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(
columnName
.
equalsIgnoreCase
(
result
.
getAlias
(
i
)))
{
if
(
columnName
.
equalsIgnoreCase
(
result
.
getAlias
(
i
)))
{
return
i
+
1
;
return
i
+
1
;
...
@@ -2829,7 +2857,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -2829,7 +2857,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
String
table
=
columnName
.
substring
(
0
,
idx
);
String
table
=
columnName
.
substring
(
0
,
idx
);
String
col
=
columnName
.
substring
(
idx
+
1
);
String
col
=
columnName
.
substring
(
idx
+
1
);
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(
table
.
equals
(
result
.
getTableName
(
i
))
&&
col
.
equalsIgnoreCase
(
result
.
getColumnName
(
i
)))
{
if
(
table
.
equals
IgnoreCase
(
result
.
getTableName
(
i
))
&&
col
.
equalsIgnoreCase
(
result
.
getColumnName
(
i
)))
{
return
i
+
1
;
return
i
+
1
;
}
}
}
}
...
...
h2/src/main/org/h2/store/DataHandler.java
浏览文件 @
8bd9aeaa
...
@@ -13,21 +13,117 @@ import org.h2.value.Value;
...
@@ -13,21 +13,117 @@ import org.h2.value.Value;
* The most important implementing class is a database.
* The most important implementing class is a database.
*/
*/
public
interface
DataHandler
{
public
interface
DataHandler
{
/**
* Check if text storage is used.
*
* @return if text storage is used.
*/
boolean
getTextStorage
();
boolean
getTextStorage
();
/**
* Get the database path.
*
* @return the database path
*/
String
getDatabasePath
();
String
getDatabasePath
();
/**
* Open a file at the given location.
*
* @param name the file name
* @param mode the mode
* @param mustExist whether the file must already exist
* @return the file
*/
FileStore
openFile
(
String
name
,
String
mode
,
boolean
mustExist
)
throws
SQLException
;
FileStore
openFile
(
String
name
,
String
mode
,
boolean
mustExist
)
throws
SQLException
;
/**
* Calculate the checksum for the byte array.
*
* @param data the byte array
* @param start the starting offset
* @param end the end offset
* @return the checksum
*/
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
);
int
getChecksum
(
byte
[]
data
,
int
start
,
int
end
);
/**
* Check if the simulated power failure occured.
* This call will decrement the countdown.
*
* @throws SQLException if the simulated power failure occured
*/
void
checkPowerOff
()
throws
SQLException
;
void
checkPowerOff
()
throws
SQLException
;
/**
* Check if writing is allowed.
*
* @throws SQLException if it is not allowed
*/
void
checkWritingAllowed
()
throws
SQLException
;
void
checkWritingAllowed
()
throws
SQLException
;
/**
* Free up disk space if possible.
* This method is called if more space is needed.
*
* @throws SQLException if no more space could be freed
*/
void
freeUpDiskSpace
()
throws
SQLException
;
void
freeUpDiskSpace
()
throws
SQLException
;
/**
* Called when the checksum was invalid.
*
* @throws SQLException if this should not be ignored
*/
void
handleInvalidChecksum
()
throws
SQLException
;
void
handleInvalidChecksum
()
throws
SQLException
;
/**
* Compare two values.
*
* @param a the first value
* @param b the second value
* @return 0 for equal, 1 if a is larger than b, and -1 otherwise
*/
int
compareTypeSave
(
Value
a
,
Value
b
)
throws
SQLException
;
int
compareTypeSave
(
Value
a
,
Value
b
)
throws
SQLException
;
/**
* Get the maximum length of a in-place large object
*
* @return the maximum size
*/
int
getMaxLengthInplaceLob
();
int
getMaxLengthInplaceLob
();
/**
* Get the compression algorithm used for large objects.
*
* @param type the data type (CLOB or BLOB)
* @return the compression algorithm, or null
*/
String
getLobCompressionAlgorithm
(
int
type
);
String
getLobCompressionAlgorithm
(
int
type
);
// only temporarily, until LOB_FILES_IN_DIRECTORIES is enabled
/**
* Get the next object id.
* This method is not required if LOB_FILES_IN_DIRECTORIES is enabled.
*
* @param needFresh if a fresh id is required
* @param dataFile true if the id is for the data file
* @return the new id
*/
int
allocateObjectId
(
boolean
needFresh
,
boolean
dataFile
);
int
allocateObjectId
(
boolean
needFresh
,
boolean
dataFile
);
/**
* Create a temporary file and return the file name.
*
* @return the file name
*/
String
createTempFile
()
throws
SQLException
;
String
createTempFile
()
throws
SQLException
;
/**
* Get the synchronization object for lob operations.
*
* @return the synchronization object
*/
Object
getLobSyncObject
();
Object
getLobSyncObject
();
}
}
h2/src/main/org/h2/store/RecordReader.java
浏览文件 @
8bd9aeaa
...
@@ -11,5 +11,13 @@ import org.h2.engine.Session;
...
@@ -11,5 +11,13 @@ import org.h2.engine.Session;
* A record reader is able to create a {@link Record} from a {@link DataPage}.
* A record reader is able to create a {@link Record} from a {@link DataPage}.
*/
*/
public
interface
RecordReader
{
public
interface
RecordReader
{
/**
* Read a record from the data page.
*
* @param session the session
* @param s the data page
* @return the record
*/
Record
read
(
Session
session
,
DataPage
s
)
throws
SQLException
;
Record
read
(
Session
session
,
DataPage
s
)
throws
SQLException
;
}
}
h2/src/main/org/h2/table/ColumnResolver.java
浏览文件 @
8bd9aeaa
...
@@ -15,12 +15,54 @@ import org.h2.value.Value;
...
@@ -15,12 +15,54 @@ import org.h2.value.Value;
*/
*/
public
interface
ColumnResolver
{
public
interface
ColumnResolver
{
/**
* Get the table alias.
*
* @return the table alias
*/
String
getTableAlias
();
String
getTableAlias
();
/**
* Get the column list.
*
* @return the column list
*/
Column
[]
getColumns
();
Column
[]
getColumns
();
/**
* Get the list of system columns, if any.
*
* @return the system columns
*/
Column
[]
getSystemColumns
();
Column
[]
getSystemColumns
();
/**
* Get the schema name.
*
* @return the schema name
*/
String
getSchemaName
();
String
getSchemaName
();
/**
* Get the value for the given column.
*
* @param column the column
* @return the value
*/
Value
getValue
(
Column
column
)
throws
SQLException
;
Value
getValue
(
Column
column
)
throws
SQLException
;
/**
* Get the table filter.
*
* @return the table filter
*/
TableFilter
getTableFilter
();
TableFilter
getTableFilter
();
/**
* Get the select statement.
*
* @return the select statement
*/
Select
getSelect
();
Select
getSelect
();
}
}
h2/src/main/org/h2/util/Cache.java
浏览文件 @
8bd9aeaa
...
@@ -62,7 +62,7 @@ public interface Cache {
...
@@ -62,7 +62,7 @@ public interface Cache {
* This will not move the item to the front of the list.
* This will not move the item to the front of the list.
*
*
* @param pos the unique key of the element
* @param pos the unique key of the element
* @return
* @return
the element or null
*/
*/
CacheObject
find
(
int
pos
);
CacheObject
find
(
int
pos
);
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
8bd9aeaa
...
@@ -152,6 +152,7 @@ java org.h2.test.TestAll timer
...
@@ -152,6 +152,7 @@ java org.h2.test.TestAll timer
/*
/*
History:
History:
The performance has been improved for ResultSet methods with column name.
The method Trigger.init has been changed: the parameters 'before' and 'type', have been added to the init method.
The method Trigger.init has been changed: the parameters 'before' and 'type', have been added to the init method.
C:\temp\test\db
C:\temp\test\db
...
...
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
浏览文件 @
8bd9aeaa
...
@@ -145,11 +145,11 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
...
@@ -145,11 +145,11 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
if
(!
"TEST"
.
equals
(
tableName
))
{
if
(!
"TEST"
.
equals
(
tableName
))
{
throw
new
Error
(
"supposed to be TEST"
);
throw
new
Error
(
"supposed to be TEST"
);
}
}
if
(
!
before
)
{
if
(
(
triggerName
.
endsWith
(
"AFTER"
)
&&
before
)
||
(
triggerName
.
endsWith
(
"BEFORE"
)
&&
!
before
)
)
{
throw
new
Error
(
"before:"
+
before
);
throw
new
Error
(
"
triggerName: "
+
triggerName
+
"
before:"
+
before
);
}
}
if
(
type
!=
INSERT
)
{
if
(
(
triggerName
.
startsWith
(
"UPD"
)
&&
type
!=
UPDATE
)
||
(
triggerName
.
startsWith
(
"INS"
)
&&
type
!=
INSERT
)
||
(
triggerName
.
startsWith
(
"DEL"
)
&&
type
!=
DELETE
)
)
{
throw
new
Error
(
"type:"
+
type
);
throw
new
Error
(
"t
riggerName: "
+
triggerName
+
" t
ype:"
+
type
);
}
}
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
8bd9aeaa
...
@@ -35,6 +35,8 @@ public class TestResultSet extends TestBase {
...
@@ -35,6 +35,8 @@ public class TestResultSet extends TestBase {
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
testFindColumn
();
testColumnLength
();
testColumnLength
();
testArray
();
testArray
();
testLimitMaxRows
();
testLimitMaxRows
();
...
@@ -58,6 +60,44 @@ public class TestResultSet extends TestBase {
...
@@ -58,6 +60,44 @@ public class TestResultSet extends TestBase {
}
}
private
void
testFindColumn
()
throws
Exception
{
trace
(
"testFindColumn"
);
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR)"
);
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
check
(
rs
.
findColumn
(
"ID"
),
1
);
check
(
rs
.
findColumn
(
"NAME"
),
2
);
check
(
rs
.
findColumn
(
"id"
),
1
);
check
(
rs
.
findColumn
(
"name"
),
2
);
check
(
rs
.
findColumn
(
"Id"
),
1
);
check
(
rs
.
findColumn
(
"Name"
),
2
);
check
(
rs
.
findColumn
(
"TEST.ID"
),
1
);
check
(
rs
.
findColumn
(
"TEST.NAME"
),
2
);
check
(
rs
.
findColumn
(
"Test.Id"
),
1
);
check
(
rs
.
findColumn
(
"Test.Name"
),
2
);
stat
.
execute
(
"DROP TABLE TEST"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT, NAME VARCHAR, DATA VARCHAR)"
);
rs
=
stat
.
executeQuery
(
"SELECT * FROM TEST"
);
check
(
rs
.
findColumn
(
"ID"
),
1
);
check
(
rs
.
findColumn
(
"NAME"
),
2
);
check
(
rs
.
findColumn
(
"DATA"
),
3
);
check
(
rs
.
findColumn
(
"id"
),
1
);
check
(
rs
.
findColumn
(
"name"
),
2
);
check
(
rs
.
findColumn
(
"data"
),
3
);
check
(
rs
.
findColumn
(
"Id"
),
1
);
check
(
rs
.
findColumn
(
"Name"
),
2
);
check
(
rs
.
findColumn
(
"Data"
),
3
);
check
(
rs
.
findColumn
(
"TEST.ID"
),
1
);
check
(
rs
.
findColumn
(
"TEST.NAME"
),
2
);
check
(
rs
.
findColumn
(
"TEST.DATA"
),
3
);
check
(
rs
.
findColumn
(
"Test.Id"
),
1
);
check
(
rs
.
findColumn
(
"Test.Name"
),
2
);
check
(
rs
.
findColumn
(
"Test.Data"
),
3
);
stat
.
execute
(
"DROP TABLE TEST"
);
}
private
void
testColumnLength
()
throws
Exception
{
private
void
testColumnLength
()
throws
Exception
{
trace
(
"testColumnDisplayLength"
);
trace
(
"testColumnDisplayLength"
);
ResultSet
rs
;
ResultSet
rs
;
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
8bd9aeaa
...
@@ -517,3 +517,4 @@ russian backward alexahin vlad ffffffffffff bfff ffffffff webapp undeploy initia
...
@@ -517,3 +517,4 @@ russian backward alexahin vlad ffffffffffff bfff ffffffff webapp undeploy initia
llc computing oliver road inaccessible android velasques duplicates eduardo chunk brazilian near langpair xrmd xmkd
llc computing oliver road inaccessible android velasques duplicates eduardo chunk brazilian near langpair xrmd xmkd
encapsulates negating igor midnight fulfill prefixes communicates nesting convenience negated resides optimizing principal applets dobrovolskyi
encapsulates negating igor midnight fulfill prefixes communicates nesting convenience negated resides optimizing principal applets dobrovolskyi
involves ukrainian chile machines restricting summer aliased backus naur multiples avl operates grow normalized rijndael
involves ukrainian chile machines restricting summer aliased backus naur multiples avl operates grow normalized rijndael
countdown
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论