Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f7bac66f
提交
f7bac66f
authored
11月 27, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use the result interface instead of the class (prepare for server side cursors).
上级
ef9a67cb
隐藏空白字符变更
内嵌
并排
正在显示
39 个修改的文件
包含
128 行增加
和
143 行删除
+128
-143
Command.java
h2/src/main/org/h2/command/Command.java
+22
-30
CommandContainer.java
h2/src/main/org/h2/command/CommandContainer.java
+4
-5
CommandList.java
h2/src/main/org/h2/command/CommandList.java
+4
-5
Prepared.java
h2/src/main/org/h2/command/Prepared.java
+4
-5
AlterTableAlterColumn.java
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
+2
-3
Analyze.java
h2/src/main/org/h2/command/ddl/Analyze.java
+2
-2
DefineCommand.java
h2/src/main/org/h2/command/ddl/DefineCommand.java
+2
-2
BackupCommand.java
h2/src/main/org/h2/command/dml/BackupCommand.java
+2
-2
Call.java
h2/src/main/org/h2/command/dml/Call.java
+3
-3
Delete.java
h2/src/main/org/h2/command/dml/Delete.java
+2
-3
ExecuteProcedure.java
h2/src/main/org/h2/command/dml/ExecuteProcedure.java
+3
-4
ExplainPlan.java
h2/src/main/org/h2/command/dml/ExplainPlan.java
+3
-3
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+3
-4
Merge.java
h2/src/main/org/h2/command/dml/Merge.java
+3
-4
NoOperation.java
h2/src/main/org/h2/command/dml/NoOperation.java
+2
-2
Query.java
h2/src/main/org/h2/command/dml/Query.java
+2
-1
RunScriptCommand.java
h2/src/main/org/h2/command/dml/RunScriptCommand.java
+2
-2
ScriptCommand.java
h2/src/main/org/h2/command/dml/ScriptCommand.java
+5
-3
Select.java
h2/src/main/org/h2/command/dml/Select.java
+2
-1
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+5
-4
Set.java
h2/src/main/org/h2/command/dml/Set.java
+2
-3
TransactionCommand.java
h2/src/main/org/h2/command/dml/TransactionCommand.java
+2
-3
Update.java
h2/src/main/org/h2/command/dml/Update.java
+2
-3
ConstraintCheck.java
h2/src/main/org/h2/constraint/ConstraintCheck.java
+2
-3
ConstraintReferential.java
h2/src/main/org/h2/constraint/ConstraintReferential.java
+2
-3
ConditionExists.java
h2/src/main/org/h2/expression/ConditionExists.java
+2
-3
ConditionInSelect.java
h2/src/main/org/h2/expression/ConditionInSelect.java
+2
-3
Subquery.java
h2/src/main/org/h2/expression/Subquery.java
+2
-3
TableFunction.java
h2/src/main/org/h2/expression/TableFunction.java
+2
-1
FunctionCursor.java
h2/src/main/org/h2/index/FunctionCursor.java
+3
-4
FunctionIndex.java
h2/src/main/org/h2/index/FunctionIndex.java
+2
-3
IndexCondition.java
h2/src/main/org/h2/index/IndexCondition.java
+2
-2
IndexCursor.java
h2/src/main/org/h2/index/IndexCursor.java
+2
-2
ViewCursor.java
h2/src/main/org/h2/index/ViewCursor.java
+3
-4
ViewIndex.java
h2/src/main/org/h2/index/ViewIndex.java
+2
-2
LocalResult.java
h2/src/main/org/h2/result/LocalResult.java
+0
-5
ResultInterface.java
h2/src/main/org/h2/result/ResultInterface.java
+8
-0
ResultRemote.java
h2/src/main/org/h2/result/ResultRemote.java
+4
-0
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+7
-8
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
;
import
java.sql.SQLException
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
...
...
@@ -16,7 +15,6 @@ import org.h2.expression.ParameterInterface;
import
org.h2.message.Message
;
import
org.h2.message.Trace
;
import
org.h2.message.TraceObject
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.util.MemoryUtils
;
import
org.h2.util.ObjectArray
;
...
...
@@ -88,7 +86,7 @@ public abstract class Command implements CommandInterface {
*
* @return an empty result set
*/
public
abstract
LocalResult
queryMeta
()
throws
SQLException
;
public
abstract
ResultInterface
queryMeta
()
throws
SQLException
;
/**
* Execute an updating statement, if this is possible.
...
...
@@ -107,30 +105,23 @@ public abstract class Command implements CommandInterface {
* @return the local result set
* @throws SQLException if the command is not a query
*/
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
throw
Message
.
getSQLException
(
ErrorCode
.
METHOD_ONLY_ALLOWED_FOR_QUERY
);
}
public
final
LocalResult
getMetaDataLocal
()
throws
SQLException
{
return
queryMeta
();
}
public
final
ResultInterface
getMetaData
()
throws
SQLException
{
return
queryMeta
();
}
public
ResultInterface
executeQuery
(
int
maxrows
,
boolean
scrollable
)
throws
SQLException
{
return
executeQueryLocal
(
maxrows
);
}
/**
* Execute a query and return
a local result se
t.
* Execute a query and return
the resul
t.
* This method prepares everything and calls {@link #query(int)} finally.
*
* @param maxrows the maximum number of rows to return
* @return the local result set
* @param scrollable if the result set must be scrollable (ignored)
* @return the result set
*/
public
LocalResult
executeQueryLocal
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
executeQuery
(
int
maxrows
,
boolean
scrollable
)
throws
SQLException
{
startTime
=
System
.
currentTimeMillis
();
Database
database
=
session
.
getDatabase
();
Object
sync
=
database
.
isMultiThreaded
()
?
(
Object
)
session
:
(
Object
)
database
;
...
...
@@ -190,7 +181,6 @@ public abstract class Command implements CommandInterface {
trace
.
info
(
"slow query: "
+
time
);
}
}
session
.
getDatabase
().
afterWriting
();
}
public
int
executeUpdate
()
throws
SQLException
{
...
...
@@ -199,6 +189,8 @@ public abstract class Command implements CommandInterface {
MemoryUtils
.
allocateReserveMemory
();
Object
sync
=
database
.
isMultiThreaded
()
?
(
Object
)
session
:
(
Object
)
database
;
session
.
waitIfExclusiveModeEnabled
();
boolean
callStop
=
true
;
session
.
getDatabase
().
beforeWriting
();
synchronized
(
sync
)
{
int
rollback
=
session
.
getLogId
();
session
.
setCurrentCommand
(
this
,
startTime
);
...
...
@@ -238,25 +230,25 @@ public abstract class Command implements CommandInterface {
if
(
e
.
getErrorCode
()
==
ErrorCode
.
DEADLOCK_1
)
{
session
.
rollback
();
}
else
if
(
e
.
getErrorCode
()
==
ErrorCode
.
OUT_OF_MEMORY
)
{
// try to rollback, saving memory
try
{
session
.
rollbackTo
(
rollback
,
true
);
}
catch
(
SQLException
e2
)
{
if
(
e2
.
getErrorCode
()
==
ErrorCode
.
OUT_OF_MEMORY
)
{
// if rollback didn't work, there is a serious problem:
// the transaction may be applied partially
// in this case we need to panic:
// close the database
session
.
getDatabase
().
shutdownImmediately
();
}
throw
e2
;
}
// there is a serious problem:
// the transaction may be applied partially
// in this case we need to panic:
// close the database
callStop
=
false
;
session
.
getDatabase
().
shutdownImmediately
();
throw
e
;
}
else
{
session
.
rollbackTo
(
rollback
,
false
);
}
throw
e
;
}
finally
{
stop
();
try
{
if
(
callStop
)
{
stop
();
}
}
finally
{
session
.
getDatabase
().
afterWriting
();
}
}
}
}
...
...
h2/src/main/org/h2/command/CommandContainer.java
浏览文件 @
f7bac66f
...
...
@@ -7,10 +7,9 @@
package
org
.
h2
.
command
;
import
java.sql.SQLException
;
import
org.h2.expression.Parameter
;
import
org.h2.expression.ParameterInterface
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.util.ObjectArray
;
import
org.h2.value.Value
;
...
...
@@ -74,12 +73,12 @@ public class CommandContainer extends Command {
return
updateCount
;
}
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
recompileIfRequired
();
// TODO query time: should keep lock time separate from running time
start
();
prepared
.
checkParameters
();
LocalResult
result
=
prepared
.
query
(
maxrows
);
ResultInterface
result
=
prepared
.
query
(
maxrows
);
prepared
.
trace
(
startTime
,
result
.
getRowCount
());
return
result
;
}
...
...
@@ -88,7 +87,7 @@ public class CommandContainer extends Command {
return
prepared
.
isReadOnly
();
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
return
prepared
.
queryMeta
();
}
...
...
h2/src/main/org/h2/command/CommandList.java
浏览文件 @
f7bac66f
...
...
@@ -7,9 +7,8 @@
package
org
.
h2
.
command
;
import
java.sql.SQLException
;
import
org.h2.expression.ParameterInterface
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.util.ObjectArray
;
/**
...
...
@@ -45,8 +44,8 @@ public class CommandList extends Command {
return
updateCount
;
}
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
LocalResult
result
=
command
.
query
(
maxrows
);
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
ResultInterface
result
=
command
.
query
(
maxrows
);
executeRemaining
();
return
result
;
}
...
...
@@ -63,7 +62,7 @@ public class CommandList extends Command {
return
false
;
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
return
command
.
queryMeta
();
}
...
...
h2/src/main/org/h2/command/Prepared.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
;
import
java.sql.SQLException
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Database
;
...
...
@@ -17,7 +16,7 @@ import org.h2.expression.Parameter;
import
org.h2.index.Index
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.StatementBuilder
;
import
org.h2.value.Value
;
...
...
@@ -81,9 +80,9 @@ public abstract class Prepared {
/**
* Get an empty result set containing the meta data.
*
* @return
an empty
result set
* @return
the
result set
*/
public
abstract
LocalResult
queryMeta
()
throws
SQLException
;
public
abstract
ResultInterface
queryMeta
()
throws
SQLException
;
/**
* Check if this command is read only.
...
...
@@ -202,7 +201,7 @@ public abstract class Prepared {
* @return the result set
* @throws SQLException if it is not a query
*/
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
throw
Message
.
getSQLException
(
ErrorCode
.
METHOD_ONLY_ALLOWED_FOR_QUERY
);
}
...
...
h2/src/main/org/h2/command/ddl/AlterTableAlterColumn.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
.
ddl
;
import
java.sql.SQLException
;
import
org.h2.command.Parser
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -21,7 +20,7 @@ import org.h2.expression.Expression;
import
org.h2.index.Index
;
import
org.h2.index.IndexType
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.schema.Schema
;
import
org.h2.schema.SchemaObject
;
import
org.h2.schema.Sequence
;
...
...
@@ -412,7 +411,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
private
void
checkNoNullValues
()
throws
SQLException
{
String
sql
=
"SELECT COUNT(*) FROM "
+
table
.
getSQL
()
+
" WHERE "
+
oldColumn
.
getSQL
()
+
" IS NULL"
;
Prepared
command
=
session
.
prepare
(
sql
);
LocalResult
result
=
command
.
query
(
0
);
ResultInterface
result
=
command
.
query
(
0
);
result
.
next
();
if
(
result
.
currentRow
()[
0
].
getInt
()
>
0
)
{
throw
Message
.
getSQLException
(
ErrorCode
.
COLUMN_CONTAINS_NULL_VALUES_1
,
oldColumn
.
getSQL
());
...
...
h2/src/main/org/h2/command/ddl/Analyze.java
浏览文件 @
f7bac66f
...
...
@@ -11,7 +11,7 @@ import org.h2.command.Prepared;
import
org.h2.engine.Constants
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
import
org.h2.table.TableData
;
...
...
@@ -50,7 +50,7 @@ public class Analyze extends DefineCommand {
}
String
sql
=
buff
.
toString
();
Prepared
command
=
session
.
prepare
(
sql
);
LocalResult
result
=
command
.
query
(
0
);
ResultInterface
result
=
command
.
query
(
0
);
result
.
next
();
for
(
int
j
=
0
;
j
<
columns
.
length
;
j
++)
{
int
selectivity
=
result
.
currentRow
()[
j
].
getInt
();
...
...
h2/src/main/org/h2/command/ddl/DefineCommand.java
浏览文件 @
f7bac66f
...
...
@@ -8,7 +8,7 @@ package org.h2.command.ddl;
import
org.h2.command.Prepared
;
import
org.h2.engine.Session
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
/**
* This class represents a non-transaction statement, for example a CREATE or
...
...
@@ -33,7 +33,7 @@ public abstract class DefineCommand extends Prepared {
return
false
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/BackupCommand.java
浏览文件 @
f7bac66f
...
...
@@ -23,7 +23,7 @@ import org.h2.expression.Expression;
import
org.h2.log.LogFile
;
import
org.h2.log.LogSystem
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.store.DiskFile
;
import
org.h2.store.FileLister
;
import
org.h2.store.PageStore
;
...
...
@@ -179,7 +179,7 @@ public class BackupCommand extends Prepared {
return
false
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/Call.java
浏览文件 @
f7bac66f
...
...
@@ -8,13 +8,13 @@ package org.h2.command.dml;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.util.ObjectArray
;
import
org.h2.value.Value
;
...
...
@@ -33,7 +33,7 @@ public class Call extends Prepared {
super
(
session
);
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
LocalResult
result
=
new
LocalResult
(
session
,
expressions
,
1
);
result
.
done
();
return
result
;
...
...
@@ -56,7 +56,7 @@ public class Call extends Prepared {
}
}
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
setCurrentRowNumber
(
1
);
Value
v
=
value
.
getValue
(
session
);
if
(
v
.
getType
()
==
Value
.
RESULT_SET
)
{
...
...
h2/src/main/org/h2/command/dml/Delete.java
浏览文件 @
f7bac66f
...
...
@@ -7,13 +7,12 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Right
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.log.UndoLogRecord
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.RowList
;
import
org.h2.table.PlanItem
;
...
...
@@ -108,7 +107,7 @@ public class Delete extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/ExecuteProcedure.java
浏览文件 @
f7bac66f
...
...
@@ -7,13 +7,12 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Procedure
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.Parameter
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.util.ObjectArray
;
/**
...
...
@@ -64,7 +63,7 @@ public class ExecuteProcedure extends Prepared {
return
prepared
.
update
();
}
public
final
LocalResult
query
(
int
limit
)
throws
SQLException
{
public
ResultInterface
query
(
int
limit
)
throws
SQLException
{
setParameters
();
Prepared
prepared
=
procedure
.
getPrepared
();
return
prepared
.
query
(
limit
);
...
...
@@ -74,7 +73,7 @@ public class ExecuteProcedure extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
Prepared
prepared
=
procedure
.
getPrepared
();
return
prepared
.
queryMeta
();
}
...
...
h2/src/main/org/h2/command/dml/ExplainPlan.java
浏览文件 @
f7bac66f
...
...
@@ -7,12 +7,12 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.value.Value
;
import
org.h2.value.ValueString
;
...
...
@@ -38,11 +38,11 @@ public class ExplainPlan extends Prepared {
command
.
prepare
();
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
return
query
(-
1
);
}
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
Column
column
=
new
Column
(
"PLAN"
,
Value
.
STRING
);
ExpressionColumn
expr
=
new
ExpressionColumn
(
session
.
getDatabase
(),
column
);
Expression
[]
expressions
=
new
Expression
[]
{
...
...
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Command
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -19,7 +18,7 @@ import org.h2.expression.Parameter;
import
org.h2.index.PageIndex
;
import
org.h2.log.UndoLogRecord
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
...
...
@@ -123,7 +122,7 @@ public class Insert extends Prepared {
count
++;
}
}
else
{
LocalResult
rows
=
query
.
query
(
0
);
ResultInterface
rows
=
query
.
query
(
0
);
count
=
0
;
table
.
fireBefore
(
session
);
table
.
lock
(
session
,
true
,
false
);
...
...
@@ -225,7 +224,7 @@ public class Insert extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/Merge.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Command
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -18,7 +17,7 @@ import org.h2.expression.Parameter;
import
org.h2.index.Index
;
import
org.h2.log.UndoLogRecord
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.table.Column
;
import
org.h2.table.Table
;
...
...
@@ -127,7 +126,7 @@ public class Merge extends Prepared {
count
++;
}
}
else
{
LocalResult
rows
=
query
.
query
(
0
);
ResultInterface
rows
=
query
.
query
(
0
);
count
=
0
;
table
.
fireBefore
(
session
);
table
.
lock
(
session
,
true
,
false
);
...
...
@@ -269,7 +268,7 @@ public class Merge extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/NoOperation.java
浏览文件 @
f7bac66f
...
...
@@ -8,7 +8,7 @@ package org.h2.command.dml;
import
org.h2.command.Prepared
;
import
org.h2.engine.Session
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
/**
* Represents an empty statement or a statement that has no effect.
...
...
@@ -39,7 +39,7 @@ public class NoOperation extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/Query.java
浏览文件 @
f7bac66f
...
...
@@ -21,6 +21,7 @@ import org.h2.expression.Parameter;
import
org.h2.expression.ValueExpression
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.SortOrder
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.Table
;
...
...
@@ -214,7 +215,7 @@ public abstract class Query extends Prepared {
return
params
;
}
public
LocalResult
query
(
int
limit
)
throws
SQLException
{
public
ResultInterface
query
(
int
limit
)
throws
SQLException
{
if
(!
session
.
getDatabase
().
getOptimizeReuseResults
())
{
return
queryWithoutCache
(
limit
);
}
...
...
h2/src/main/org/h2/command/dml/RunScriptCommand.java
浏览文件 @
f7bac66f
...
...
@@ -14,7 +14,7 @@ import org.h2.command.Prepared;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.util.ScriptReader
;
/**
...
...
@@ -73,7 +73,7 @@ public class RunScriptCommand extends ScriptBase {
this
.
charset
=
charset
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/ScriptCommand.java
浏览文件 @
f7bac66f
...
...
@@ -36,6 +36,7 @@ import org.h2.index.Cursor;
import
org.h2.index.Index
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.schema.Constant
;
import
org.h2.schema.Schema
;
...
...
@@ -103,7 +104,7 @@ public class ScriptCommand extends ScriptBase {
this
.
drop
=
drop
;
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
LocalResult
r
=
createResult
();
r
.
done
();
return
r
;
...
...
@@ -115,7 +116,7 @@ public class ScriptCommand extends ScriptBase {
return
new
LocalResult
(
session
,
expressions
,
1
);
}
public
LocalResult
query
(
int
maxrows
)
throws
SQLException
{
public
ResultInterface
query
(
int
maxrows
)
throws
SQLException
{
session
.
getUser
().
checkAdmin
();
reset
();
try
{
...
...
@@ -318,7 +319,8 @@ public class ScriptCommand extends ScriptBase {
private
int
writeLobStream
(
ValueLob
v
)
throws
IOException
,
SQLException
{
if
(!
tempLobTableCreated
)
{
add
(
"CREATE TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT, PART INT, CDATA VARCHAR, BDATA BINARY, PRIMARY KEY(ID, PART))"
,
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
;
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
f7bac66f
...
...
@@ -28,6 +28,7 @@ import org.h2.index.Index;
import
org.h2.index.IndexType
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.SearchRow
;
import
org.h2.result.SortOrder
;
import
org.h2.table.Column
;
...
...
@@ -515,7 +516,7 @@ public class Select extends Query {
result
.
addRow
(
row
);
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
LocalResult
result
=
new
LocalResult
(
session
,
expressions
,
visibleColumnCount
);
result
.
done
();
return
result
;
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
f7bac66f
...
...
@@ -19,6 +19,7 @@ import org.h2.expression.Parameter;
import
org.h2.expression.ValueExpression
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.result.SortOrder
;
import
org.h2.table.Column
;
import
org.h2.table.ColumnResolver
;
...
...
@@ -92,7 +93,7 @@ public class SelectUnion extends Query {
return
values
;
}
public
LocalResult
queryMeta
()
throws
SQLException
{
public
ResultInterface
queryMeta
()
throws
SQLException
{
ObjectArray
<
Expression
>
leftExpressions
=
left
.
getExpressions
();
int
columnCount
=
left
.
getColumnCount
();
LocalResult
result
=
new
LocalResult
(
session
,
leftExpressions
,
columnCount
);
...
...
@@ -131,8 +132,8 @@ public class SelectUnion extends Query {
default
:
Message
.
throwInternalError
(
"type="
+
unionType
);
}
LocalResult
l
=
left
.
query
(
0
);
LocalResult
r
=
right
.
query
(
0
);
ResultInterface
l
=
left
.
query
(
0
);
ResultInterface
r
=
right
.
query
(
0
);
l
.
reset
();
r
.
reset
();
switch
(
unionType
)
{
...
...
@@ -330,7 +331,7 @@ public class SelectUnion extends Query {
return
buff
.
toString
();
}
public
LocalResult
query
(
int
limit
)
throws
SQLException
{
public
ResultInterface
query
(
int
limit
)
throws
SQLException
{
// union doesn't always know the parameter list of the left and right queries
return
queryWithoutCache
(
limit
);
}
...
...
h2/src/main/org/h2/command/dml/Set.java
浏览文件 @
f7bac66f
...
...
@@ -8,7 +8,6 @@ package org.h2.command.dml;
import
java.sql.SQLException
;
import
java.text.Collator
;
import
org.h2.command.Prepared
;
import
org.h2.compress.Compressor
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -19,7 +18,7 @@ import org.h2.engine.Setting;
import
org.h2.expression.Expression
;
import
org.h2.expression.ValueExpression
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.schema.Schema
;
import
org.h2.table.Table
;
import
org.h2.tools.CompressTool
;
...
...
@@ -370,7 +369,7 @@ public class Set extends Prepared {
return
false
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/TransactionCommand.java
浏览文件 @
f7bac66f
...
...
@@ -7,13 +7,12 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Database
;
import
org.h2.engine.Session
;
import
org.h2.log.LogSystem
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
/**
* Represents a transactional statement.
...
...
@@ -207,7 +206,7 @@ public class TransactionCommand extends Prepared {
this
.
transactionName
=
string
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/command/dml/Update.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
command
.
dml
;
import
java.sql.SQLException
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Right
;
...
...
@@ -16,7 +15,7 @@ import org.h2.expression.Expression;
import
org.h2.expression.Parameter
;
import
org.h2.expression.ValueExpression
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.RowList
;
import
org.h2.table.Column
;
...
...
@@ -177,7 +176,7 @@ public class Update extends Prepared {
return
true
;
}
public
LocalResult
queryMeta
()
{
public
ResultInterface
queryMeta
()
{
return
null
;
}
...
...
h2/src/main/org/h2/constraint/ConstraintCheck.java
浏览文件 @
f7bac66f
...
...
@@ -7,13 +7,12 @@
package
org
.
h2
.
constraint
;
import
java.sql.SQLException
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Session
;
import
org.h2.expression.Expression
;
import
org.h2.index.Index
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.schema.Schema
;
import
org.h2.table.Column
;
...
...
@@ -117,7 +116,7 @@ public class ConstraintCheck extends Constraint {
return
;
}
String
sql
=
"SELECT 1 FROM "
+
filter
.
getTable
().
getSQL
()
+
" WHERE NOT("
+
expr
.
getSQL
()
+
")"
;
LocalResult
r
=
session
.
prepare
(
sql
).
query
(
1
);
ResultInterface
r
=
session
.
prepare
(
sql
).
query
(
1
);
if
(
r
.
next
())
{
throw
Message
.
getSQLException
(
ErrorCode
.
CHECK_CONSTRAINT_VIOLATED_1
,
getName
());
}
...
...
h2/src/main/org/h2/constraint/ConstraintReferential.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
constraint
;
import
java.sql.SQLException
;
import
org.h2.command.Parser
;
import
org.h2.command.Prepared
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -17,7 +16,7 @@ import org.h2.expression.Parameter;
import
org.h2.index.Cursor
;
import
org.h2.index.Index
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.schema.Schema
;
...
...
@@ -627,7 +626,7 @@ public class ConstraintReferential extends Constraint {
}
buff
.
append
(
')'
);
String
sql
=
buff
.
toString
();
LocalResult
r
=
session
.
prepare
(
sql
).
query
(
1
);
ResultInterface
r
=
session
.
prepare
(
sql
).
query
(
1
);
if
(
r
.
next
())
{
throw
Message
.
getSQLException
(
ErrorCode
.
REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1
,
getShortDescription
());
...
...
h2/src/main/org/h2/expression/ConditionExists.java
浏览文件 @
f7bac66f
...
...
@@ -7,10 +7,9 @@
package
org
.
h2
.
expression
;
import
java.sql.SQLException
;
import
org.h2.command.dml.Query
;
import
org.h2.engine.Session
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.value.Value
;
...
...
@@ -29,7 +28,7 @@ public class ConditionExists extends Condition {
public
Value
getValue
(
Session
session
)
throws
SQLException
{
query
.
setSession
(
session
);
LocalResult
result
=
query
.
query
(
1
);
ResultInterface
result
=
query
.
query
(
1
);
session
.
addTemporaryResult
(
result
);
boolean
r
=
result
.
getRowCount
()
>
0
;
return
ValueBoolean
.
get
(
r
);
...
...
h2/src/main/org/h2/expression/ConditionInSelect.java
浏览文件 @
f7bac66f
...
...
@@ -7,7 +7,6 @@
package
org
.
h2
.
expression
;
import
java.sql.SQLException
;
import
org.h2.command.dml.Query
;
import
org.h2.command.dml.Select
;
import
org.h2.constant.ErrorCode
;
...
...
@@ -17,7 +16,7 @@ import org.h2.engine.Session;
import
org.h2.index.Index
;
import
org.h2.index.IndexCondition
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.table.TableView
;
...
...
@@ -46,7 +45,7 @@ public class ConditionInSelect extends Condition {
public
Value
getValue
(
Session
session
)
throws
SQLException
{
query
.
setSession
(
session
);
LocalResult
rows
=
query
.
query
(
0
);
ResultInterface
rows
=
query
.
query
(
0
);
session
.
addTemporaryResult
(
rows
);
boolean
hasNull
=
false
;
boolean
result
=
all
;
...
...
h2/src/main/org/h2/expression/Subquery.java
浏览文件 @
f7bac66f
...
...
@@ -7,12 +7,11 @@
package
org
.
h2
.
expression
;
import
java.sql.SQLException
;
import
org.h2.command.dml.Query
;
import
org.h2.constant.ErrorCode
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.TableFilter
;
import
org.h2.value.Value
;
...
...
@@ -33,7 +32,7 @@ public class Subquery extends Expression {
public
Value
getValue
(
Session
session
)
throws
SQLException
{
query
.
setSession
(
session
);
LocalResult
result
=
query
.
query
(
2
);
ResultInterface
result
=
query
.
query
(
2
);
try
{
int
rowcount
=
result
.
getRowCount
();
if
(
rowcount
>
1
)
{
...
...
h2/src/main/org/h2/expression/TableFunction.java
浏览文件 @
f7bac66f
...
...
@@ -13,6 +13,7 @@ import org.h2.engine.Database;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.MathUtils
;
...
...
@@ -124,7 +125,7 @@ public class TableFunction extends Function {
return
vr
;
}
private
SimpleResultSet
getSimpleResultSet
(
LocalResult
rs
,
int
maxrows
)
throws
SQLException
{
private
SimpleResultSet
getSimpleResultSet
(
ResultInterface
rs
,
int
maxrows
)
throws
SQLException
{
int
columnCount
=
rs
.
getVisibleColumnCount
();
SimpleResultSet
simple
=
new
SimpleResultSet
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
...
...
h2/src/main/org/h2/index/FunctionCursor.java
浏览文件 @
f7bac66f
...
...
@@ -7,9 +7,8 @@
package
org
.
h2
.
index
;
import
java.sql.SQLException
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.value.Value
;
...
...
@@ -19,11 +18,11 @@ import org.h2.value.Value;
*/
public
class
FunctionCursor
implements
Cursor
{
private
LocalResult
result
;
private
ResultInterface
result
;
private
Value
[]
values
;
private
Row
row
;
FunctionCursor
(
LocalResult
result
)
{
FunctionCursor
(
ResultInterface
result
)
{
this
.
result
=
result
;
}
...
...
h2/src/main/org/h2/index/FunctionIndex.java
浏览文件 @
f7bac66f
...
...
@@ -7,11 +7,10 @@
package
org
.
h2
.
index
;
import
java.sql.SQLException
;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.Session
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.table.FunctionTable
;
...
...
@@ -24,7 +23,7 @@ import org.h2.table.IndexColumn;
public
class
FunctionIndex
extends
BaseIndex
{
private
FunctionTable
functionTable
;
private
LocalResult
result
;
private
ResultInterface
result
;
public
FunctionIndex
(
FunctionTable
functionTable
,
IndexColumn
[]
columns
)
{
initBaseIndex
(
functionTable
,
0
,
null
,
columns
,
IndexType
.
createNonUnique
(
true
));
...
...
h2/src/main/org/h2/index/IndexCondition.java
浏览文件 @
f7bac66f
...
...
@@ -17,7 +17,7 @@ import org.h2.expression.Expression;
import
org.h2.expression.ExpressionColumn
;
import
org.h2.expression.ExpressionVisitor
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.table.Column
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.StatementBuilder
;
...
...
@@ -155,7 +155,7 @@ public class IndexCondition {
* @param session the session
* @return the result
*/
public
LocalResult
getCurrentResult
(
Session
session
)
throws
SQLException
{
public
ResultInterface
getCurrentResult
(
Session
session
)
throws
SQLException
{
return
expressionQuery
.
query
(
0
);
}
...
...
h2/src/main/org/h2/index/IndexCursor.java
浏览文件 @
f7bac66f
...
...
@@ -11,7 +11,7 @@ import java.util.HashSet;
import
org.h2.engine.Session
;
import
org.h2.expression.Comparison
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.result.SortOrder
;
...
...
@@ -37,7 +37,7 @@ public class IndexCursor implements Cursor {
private
Column
inColumn
;
private
int
inListIndex
;
private
Value
[]
inList
;
private
LocalResult
inResult
;
private
ResultInterface
inResult
;
private
HashSet
<
Value
>
inResultTested
;
public
void
setIndex
(
Index
index
)
{
...
...
h2/src/main/org/h2/index/ViewCursor.java
浏览文件 @
f7bac66f
...
...
@@ -7,9 +7,8 @@
package
org
.
h2
.
index
;
import
java.sql.SQLException
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.table.Table
;
...
...
@@ -22,10 +21,10 @@ import org.h2.value.ValueNull;
public
class
ViewCursor
implements
Cursor
{
private
Table
table
;
private
LocalResult
result
;
private
ResultInterface
result
;
private
Row
current
;
ViewCursor
(
Table
table
,
LocalResult
result
)
{
ViewCursor
(
Table
table
,
ResultInterface
result
)
{
this
.
table
=
table
;
this
.
result
=
result
;
}
...
...
h2/src/main/org/h2/index/ViewIndex.java
浏览文件 @
f7bac66f
...
...
@@ -13,7 +13,7 @@ import org.h2.engine.Session;
import
org.h2.expression.Comparison
;
import
org.h2.expression.Parameter
;
import
org.h2.message.Message
;
import
org.h2.result.
LocalResult
;
import
org.h2.result.
ResultInterface
;
import
org.h2.result.Row
;
import
org.h2.result.SearchRow
;
import
org.h2.table.Column
;
...
...
@@ -189,7 +189,7 @@ public class ViewIndex extends BaseIndex {
}
}
}
LocalResult
result
=
query
.
query
(
0
);
ResultInterface
result
=
query
.
query
(
0
);
return
new
ViewCursor
(
table
,
result
);
}
...
...
h2/src/main/org/h2/result/LocalResult.java
浏览文件 @
f7bac66f
...
...
@@ -367,11 +367,6 @@ public class LocalResult implements ResultInterface {
}
}
/**
* Check if this result set is buffered using a temporary file.
*
* @return true if it is
*/
public
boolean
needToClose
()
{
return
disk
!=
null
;
}
...
...
h2/src/main/org/h2/result/ResultInterface.java
浏览文件 @
f7bac66f
...
...
@@ -59,6 +59,14 @@ public interface ResultInterface {
*/
int
getRowCount
();
/**
* Check if this result set should be closed, for example because it is
* buffered using a temporary file.
*
* @return true if close should be called.
*/
boolean
needToClose
();
/**
* Close the result and delete any temporary files
*/
...
...
h2/src/main/org/h2/result/ResultRemote.java
浏览文件 @
f7bac66f
...
...
@@ -248,4 +248,8 @@ public class ResultRemote implements ResultInterface {
this
.
fetchSize
=
fetchSize
;
}
public
boolean
needToClose
()
{
return
true
;
}
}
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
f7bac66f
...
...
@@ -11,7 +11,6 @@ import java.io.PrintWriter;
import
java.io.StringWriter
;
import
java.net.Socket
;
import
java.sql.SQLException
;
import
org.h2.command.Command
;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.SysProperties
;
...
...
@@ -25,8 +24,8 @@ import org.h2.expression.ParameterInterface;
import
org.h2.expression.ParameterRemote
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.message.Message
;
import
org.h2.result.LocalResult
;
import
org.h2.result.ResultColumn
;
import
org.h2.result.ResultInterface
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.SmallMap
;
import
org.h2.util.StringUtils
;
...
...
@@ -263,7 +262,7 @@ public class TcpServerThread implements Runnable {
int
id
=
transfer
.
readInt
();
int
objectId
=
transfer
.
readInt
();
Command
command
=
(
Command
)
cache
.
getObject
(
id
,
false
);
LocalResult
result
=
command
.
getMetaDataLocal
();
ResultInterface
result
=
command
.
getMetaData
();
cache
.
addObject
(
objectId
,
result
);
int
columnCount
=
result
.
getVisibleColumnCount
();
transfer
.
writeInt
(
SessionRemote
.
STATUS_OK
).
writeInt
(
columnCount
).
writeInt
(
0
);
...
...
@@ -281,7 +280,7 @@ public class TcpServerThread implements Runnable {
Command
command
=
(
Command
)
cache
.
getObject
(
id
,
false
);
setParameters
(
command
);
int
old
=
session
.
getModificationId
();
LocalResult
result
=
command
.
executeQueryLocal
(
maxRows
);
ResultInterface
result
=
command
.
executeQuery
(
maxRows
,
false
);
cache
.
addObject
(
objectId
,
result
);
int
columnCount
=
result
.
getVisibleColumnCount
();
int
state
=
getState
(
old
);
...
...
@@ -326,7 +325,7 @@ public class TcpServerThread implements Runnable {
case
SessionRemote
.
RESULT_FETCH_ROWS
:
{
int
id
=
transfer
.
readInt
();
int
count
=
transfer
.
readInt
();
LocalResult
result
=
(
LocalResult
)
cache
.
getObject
(
id
,
false
);
ResultInterface
result
=
(
ResultInterface
)
cache
.
getObject
(
id
,
false
);
transfer
.
writeInt
(
SessionRemote
.
STATUS_OK
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sendRow
(
result
);
...
...
@@ -336,13 +335,13 @@ public class TcpServerThread implements Runnable {
}
case
SessionRemote
.
RESULT_RESET
:
{
int
id
=
transfer
.
readInt
();
LocalResult
result
=
(
LocalResult
)
cache
.
getObject
(
id
,
false
);
ResultInterface
result
=
(
ResultInterface
)
cache
.
getObject
(
id
,
false
);
result
.
reset
();
break
;
}
case
SessionRemote
.
RESULT_CLOSE
:
{
int
id
=
transfer
.
readInt
();
LocalResult
result
=
(
LocalResult
)
cache
.
getObject
(
id
,
true
);
ResultInterface
result
=
(
ResultInterface
)
cache
.
getObject
(
id
,
true
);
if
(
result
!=
null
)
{
result
.
close
();
cache
.
freeObject
(
id
);
...
...
@@ -376,7 +375,7 @@ public class TcpServerThread implements Runnable {
return
SessionRemote
.
STATUS_OK_STATE_CHANGED
;
}
private
void
sendRow
(
LocalResult
result
)
throws
IOException
,
SQLException
{
private
void
sendRow
(
ResultInterface
result
)
throws
IOException
,
SQLException
{
if
(
result
.
next
())
{
transfer
.
writeBoolean
(
true
);
Value
[]
v
=
result
.
currentRow
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论