IntKeyHashMap sessionMap = new IntKeyHashMap();
Session current = null;
int currentId = 0;
String statement;
int statementType;
Statement dummy = new StatementDML(StatementTypes.UPDATE_CURSOR,
StatementTypes.X_SQL_DATA_CHANGE,
null);
String databaseFile = database.getPath();
boolean fullReplay = database.getURLProperties().isPropertyTrue(
HsqlDatabaseProperties.hsqldb_full_log_replay);
dummy.setCompileTimestamp(Long.MAX_VALUE);
database.setReferentialIntegrity(false);
try {
StopWatch sw = new StopWatch();
while (scr.readLoggedStatement(current)) {
int sessionId = scr.getSessionNumber();
if (current == null || currentId != sessionId) {
currentId = sessionId;
current = (Session) sessionMap.get(currentId);
if (current == null) {
current =
database.getSessionManager().newSessionForLog(
database);
sessionMap.put(currentId, current);
}
}
if (current.isClosed()) {
sessionMap.remove(currentId);
continue;
}
Result result = null;
statementType = scr.getStatementType();
switch (statementType) {
case ScriptReaderBase.ANY_STATEMENT :
statement = scr.getLoggedStatement();
Statement cs;
try {
cs = current.compileStatement(statement);
if (database.getProperties().isVersion18()) {
// convert BIT columns in .log to BOOLEAN
if (cs.getType()
== StatementTypes.CREATE_TABLE) {
Table table =
(Table) ((StatementSchema) cs)
.getArguments()[0];