Result.java (hsqldb-2.6.0) | : | Result.java (hsqldb-2.6.1) | ||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
* | * | |||
* An HSQLDB Result object encapsulates all requests (such as to alter or | * An HSQLDB Result object encapsulates all requests (such as to alter or | |||
* query session settings, to allocate and execute statements, etc.) and all | * query session settings, to allocate and execute statements, etc.) and all | |||
* responses (such as exception indications, update counts, result sets and | * responses (such as exception indications, update counts, result sets and | |||
* result set metadata). It also implements the HSQL wire protocol for | * result set metadata). It also implements the HSQL wire protocol for | |||
* communicating all such requests and responses across the network. | * communicating all such requests and responses across the network. | |||
* Uses a navigator for data. | * Uses a navigator for data. | |||
* | * | |||
* @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) | * @author Campbell Burnet (campbell-burnet@users dot sourceforge.net) | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.5.1 | * @version 2.6.1 | |||
* @since 1.9.0 | * @since 1.9.0 | |||
*/ | */ | |||
public class Result { | public class Result { | |||
public static final Result[] emptyArray = new Result[0]; | public static final Result[] emptyArray = new Result[0]; | |||
public static final ResultMetaData sessionAttributesMetaData; | public static final ResultMetaData sessionAttributesMetaData; | |||
static { | static { | |||
// calls to initialise some global statics | // calls to initialise some global statics | |||
skipping to change at line 257 | skipping to change at line 257 | |||
public static Result newResult(DataInputStream dataInput, | public static Result newResult(DataInputStream dataInput, | |||
RowInputInterface in) throws IOException { | RowInputInterface in) throws IOException { | |||
int readMode = dataInput.readByte(); | int readMode = dataInput.readByte(); | |||
return newResult(null, readMode, dataInput, in); | return newResult(null, readMode, dataInput, in); | |||
} | } | |||
public static Result newResult(Session session, int mode, | public static Result newResult(Session session, int mode, | |||
DataInputStream dataInput, | DataInputStream dataInput, | |||
RowInputInterface in) throws IOException { | RowInputInterface in) { | |||
try { | try { | |||
if (mode == ResultConstants.LARGE_OBJECT_OP) { | if (mode == ResultConstants.LARGE_OBJECT_OP) { | |||
return ResultLob.newLob(dataInput, false); | return ResultLob.newLob(dataInput, false); | |||
} | } | |||
Result result = newResult(session, dataInput, in, mode); | Result result = newResult(session, dataInput, in, mode); | |||
return result; | return result; | |||
} catch (IOException e) { | } catch (IOException e) { | |||
skipping to change at line 501 | skipping to change at line 501 | |||
break; | break; | |||
case ResultConstants.EXECUTE : | case ResultConstants.EXECUTE : | |||
result.updateCount = in.readInt(); | result.updateCount = in.readInt(); | |||
result.fetchSize = in.readInt(); | result.fetchSize = in.readInt(); | |||
result.statementID = in.readLong(); | result.statementID = in.readLong(); | |||
result.rsProperties = in.readByte(); | result.rsProperties = in.readByte(); | |||
result.queryTimeout = in.readShort(); | result.queryTimeout = in.readShort(); | |||
Statement statement = | Statement statement = | |||
session.statementManager.getStatement(session, | session.statementManager.getStatement(result.statementID); | |||
result.statementID); | ||||
if (statement == null) { | if (statement == null) { | |||
// invalid statement | // invalid statement | |||
result.mode = ResultConstants.EXECUTE_INVALID; | result.mode = ResultConstants.EXECUTE_INVALID; | |||
result.valueData = ValuePool.emptyObjectArray; | result.valueData = ValuePool.emptyObjectArray; | |||
break; | break; | |||
} | } | |||
skipping to change at line 853 | skipping to change at line 852 | |||
if (line == null) { | if (line == null) { | |||
break; | break; | |||
} | } | |||
result.getNavigator().add(new Object[]{ line }); | result.getNavigator().add(new Object[]{ line }); | |||
} | } | |||
return result; | return result; | |||
} | } | |||
public static Result newDoubleColumnResult(String colNameA, | public static Result newMultiColumnResult(String[] names, | |||
String colNameB) { | Type[] types) { | |||
Result result = newResult(ResultConstants.DATA); | Result result = newResult(ResultConstants.DATA); | |||
result.metaData = ResultMetaData.newDoubleColumnMetaData(colNameA, | result.metaData = ResultMetaData.newMetaData(names, types); | |||
colNameB); | ||||
result.navigator = new RowSetNavigatorClient(8); | result.navigator = new RowSetNavigatorClient(8); | |||
return result; | return result; | |||
} | } | |||
public static Result newPrepareResponse(Statement statement) { | public static Result newPrepareResponse(Statement statement) { | |||
Result r = newResult(ResultConstants.PREPARE_ACK); | Result r = newResult(ResultConstants.PREPARE_ACK); | |||
r.statement = statement; | r.statement = statement; | |||
skipping to change at line 1628 | skipping to change at line 1626 | |||
for (int i = 0; i < sql.length; i++) { | for (int i = 0; i < sql.length; i++) { | |||
String[] s = new String[1]; | String[] s = new String[1]; | |||
s[0] = sql[i]; | s[0] = sql[i]; | |||
initialiseNavigator().add(s); | initialiseNavigator().add(s); | |||
} | } | |||
} | } | |||
public void addRow(String[] sql) { | ||||
if (sql == null) { | ||||
return; | ||||
} | ||||
initialiseNavigator().add(sql); | ||||
} | ||||
private static Object[] readSimple(RowInputInterface in, | private static Object[] readSimple(RowInputInterface in, | |||
ResultMetaData meta) | ResultMetaData meta) | |||
throws IOException { | throws IOException { | |||
int size = in.readInt(); | int size = in.readInt(); | |||
return in.readData(meta.columnTypes); | return in.readData(meta.columnTypes); | |||
} | } | |||
private static void writeSimple(RowOutputInterface out, | private static void writeSimple(RowOutputInterface out, | |||
End of changes. 7 change blocks. | ||||
18 lines changed or deleted | 7 lines changed or added |