"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hsqldb/src/org/hsqldb/Session.java" between
hsqldb-2.6.0.zip and hsqldb-2.6.1.zip

About: HSQLDB (HyperSQL DataBase) is a SQL relational database engine written in Java. It supports nearly full ANSI-92 SQL (BNF format) and full core SQL:2008.

Session.java  (hsqldb-2.6.0):Session.java  (hsqldb-2.6.1)
skipping to change at line 77 skipping to change at line 77
import org.hsqldb.types.ClobDataID; import org.hsqldb.types.ClobDataID;
import org.hsqldb.types.TimeData; import org.hsqldb.types.TimeData;
import org.hsqldb.types.TimestampData; import org.hsqldb.types.TimestampData;
import org.hsqldb.types.Type; import org.hsqldb.types.Type;
import org.hsqldb.types.TypedComparator; import org.hsqldb.types.TypedComparator;
/** /**
* Implementation of SQL sessions. * Implementation of SQL sessions.
* *
* @author Fred Toussi (fredt@users dot sourceforge.net) * @author Fred Toussi (fredt@users dot sourceforge.net)
* @version 2.6.0 * @version 2.6.1
* @since 1.7.0 * @since 1.7.0
*/ */
public class Session implements SessionInterface { public class Session implements SessionInterface {
// //
private volatile boolean isClosed; private volatile boolean isClosed;
// //
public Database database; public Database database;
private final User sessionUser; private final User sessionUser;
skipping to change at line 199 skipping to change at line 199
sessionContext.isAutoCommit = autocommit ? Boolean.TRUE sessionContext.isAutoCommit = autocommit ? Boolean.TRUE
: Boolean.FALSE; : Boolean.FALSE;
sessionContext.isReadOnly = isReadOnlyDefault ? Boolean.TRUE sessionContext.isReadOnly = isReadOnlyDefault ? Boolean.TRUE
: Boolean.FALSE; : Boolean.FALSE;
parser = new ParserCommand(this, new Scanner()); parser = new ParserCommand(this, new Scanner());
setResultMemoryRowCount(database.getResultMaxMemoryRows()); setResultMemoryRowCount(database.getResultMaxMemoryRows());
resetSchema(); resetSchema();
sessionData = new SessionData(database, this); sessionData = new SessionData(database, this);
statementManager = new StatementManager(database); statementManager = new StatementManager(this);
timeoutManager = new TimeoutManager(); timeoutManager = new TimeoutManager();
} }
void resetSchema() { void resetSchema() {
loggedSchema = null; loggedSchema = null;
currentSchema = user.getInitialOrDefaultSchema(); currentSchema = user.getInitialOrDefaultSchema();
} }
/** /**
* Retrieves the session identifier for this Session. * Retrieves the session identifier for this Session.
skipping to change at line 983 skipping to change at line 983
sessionContext.currentMaxRows = maxRows; sessionContext.currentMaxRows = maxRows;
} }
Statement cs = cmd.statement; Statement cs = cmd.statement;
if (cs == null if (cs == null
|| cs.compileTimestamp || cs.compileTimestamp
< database.schemaManager.schemaChangeTimestamp) { < database.schemaManager.schemaChangeTimestamp) {
long csid = cmd.getStatementID(); long csid = cmd.getStatementID();
cs = statementManager.getStatement(this, csid); cs = statementManager.getStatement(csid);
cmd.setStatement(cs); cmd.setStatement(cs);
if (cs == null) { if (cs == null) {
// invalid sql has been removed already // invalid sql has been removed already
return Result.newErrorResult( return Result.newErrorResult(
Error.error(ErrorCode.X_07502)); Error.error(ErrorCode.X_07502));
} }
} }
skipping to change at line 1032 skipping to change at line 1032
Result result = executeDirectBatchStatement(cmd); Result result = executeDirectBatchStatement(cmd);
result = performPostExecute(cmd, result); result = performPostExecute(cmd, result);
return result; return result;
} }
case ResultConstants.PREPARE : { case ResultConstants.PREPARE : {
Statement cs; Statement cs;
try { try {
cs = statementManager.compile(this, cmd); cs = statementManager.compile(cmd);
} catch (Throwable t) { } catch (Throwable t) {
String errorString = cmd.getMainString(); String errorString = cmd.getMainString();
return Result.newErrorResult(t, errorString); return Result.newErrorResult(t, errorString);
} }
Result result = Result.newPrepareResponse(cs); Result result = Result.newPrepareResponse(cs);
if (cs.getType() == StatementTypes.SELECT_CURSOR if (cs.getType() == StatementTypes.SELECT_CURSOR
|| cs.getType() == StatementTypes.CALL) { || cs.getType() == StatementTypes.CALL) {
skipping to change at line 1476 skipping to change at line 1476
Statement cs; Statement cs;
int[] updateCounts; int[] updateCounts;
int count; int count;
cs = cmd.statement; cs = cmd.statement;
if (cs == null if (cs == null
|| cs.compileTimestamp || cs.compileTimestamp
< database.schemaManager.schemaChangeTimestamp) { < database.schemaManager.schemaChangeTimestamp) {
csid = cmd.getStatementID(); csid = cmd.getStatementID();
cs = statementManager.getStatement(this, csid); cs = statementManager.getStatement(csid);
if (cs == null) { if (cs == null) {
// invalid sql has been removed already // invalid sql has been removed already
return Result.newErrorResult(Error.error(ErrorCode.X_07502)); return Result.newErrorResult(Error.error(ErrorCode.X_07502));
} }
} }
count = 0; count = 0;
skipping to change at line 2329 skipping to change at line 2329
} }
} }
String getSetSchemaStatement() { String getSetSchemaStatement() {
return "SET SCHEMA " + currentSchema.statementName; return "SET SCHEMA " + currentSchema.statementName;
} }
// timeouts // timeouts
class TimeoutManager { class TimeoutManager {
AtomicInteger currentTimeout = new AtomicInteger(); volatile int currentTimeout;
volatile long checkTimestampSCN; volatile long checkTimestampSCN;
volatile boolean hasTimeout = false;
void startTimeout(int timeout) { void startTimeout(int timeout) {
if (timeout == 0) { if (timeout == 0) {
return; return;
} }
hasTimeout = true; boolean add = checkTimestampSCN == 0;
currentTimeout.set(timeout); currentTimeout = timeout + 1;
checkTimestampSCN = statementStartTimestamp; checkTimestampSCN = statementStartTimestamp;
database.timeoutRunner.addSession(Session.this); if (add) {
database.timeoutRunner.addSession(this);
}
} }
void endTimeout() { void endTimeout() {
currentTimeout = 0;
if (hasTimeout) {
currentTimeout.set(0);
checkTimestampSCN = 0;
hasTimeout = false;
}
} }
public boolean checkTimeout() { public boolean checkTimeout() {
if (!hasTimeout || checkTimestampSCN != statementStartTimestamp) { if (currentTimeout == 0) {
return false;
}
if (checkTimestampSCN != statementStartTimestamp) {
return false; return false;
} }
int result = currentTimeout.decrementAndGet(); currentTimeout--;
if (currentTimeout <= 0) {
currentTimeout = 0;
if (result < 0) {
currentTimeout.set(0);
database.txManager.resetSession( database.txManager.resetSession(
Session.this, Session.this, checkTimestampSCN, Session.this, Session.this, checkTimestampSCN,
TransactionManager.resetSessionStatement); TransactionManager.resetSessionStatement);
return true; return true;
} }
return false; return false;
} }
public boolean isClosed() {
return Session.this.isClosed;
}
} }
} }
 End of changes. 14 change blocks. 
22 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)