inStream = new DataInputStream(request.getInputStream());
int databaseID = inStream.readInt();
long sessionID = inStream.readLong();
int mode = inStream.readByte();
Session session = DatabaseManager.getSession(databaseID,
sessionID);
Result resultIn = Result.newResult(session, mode, inStream,
rowIn);
resultIn.setDatabaseId(databaseID);
resultIn.setSessionId(sessionID);
Result resultOut;
if (resultIn.getType() == ResultConstants.CONNECT) {
try {
session = DatabaseManager.newSession(
dbType, dbPath, resultIn.getMainString(),
resultIn.getSubString(), new HsqlProperties(),
resultIn.getZoneString(),
resultIn.getUpdateCount());
resultIn.readAdditionalResults(null, inStream, rowIn);
resultOut = Result.newConnectionAcknowledgeResponse(
session.getDatabase(), session.getId(),
session.getDatabase().getDatabaseID());
} catch (HsqlException e) {
resultOut = Result.newErrorResult(e);
}
} else {
int dbId = resultIn.getDatabaseId();
long sessionId = resultIn.getSessionId();
session = DatabaseManager.getSession(dbId, sessionId);
resultIn.readLobResults(session, inStream, rowIn);
resultOut = session.execute(resultIn);
}
//
response.setContentType("application/octet-stream");
response.setContentLength(rowOut.size());