import org.hsqldb.Session; //导入方法依赖的package包/类
void processStatement(Session session) {
if (statement.startsWith("/*C")) {
int endid = statement.indexOf('*', 4);
sessionNumber = Integer.parseInt(statement.substring(3, endid));
statement = statement.substring(endid + 2);
sessionChanged = true;
statementType = SESSION_ID;
return;
}
sessionChanged = false;
rowIn.setSource(statement);
statementType = rowIn.getStatementType();
if (statementType == ANY_STATEMENT) {
rowData = null;
currentTable = null;
return;
} else if (statementType == COMMIT_STATEMENT) {
rowData = null;
currentTable = null;
return;
} else if (statementType == SET_SCHEMA_STATEMENT) {
rowData = null;
currentTable = null;
currentSchema = rowIn.getSchemaName();
return;
}
String name = rowIn.getTableName();
String schema = session.getCurrentSchemaHsqlName().name;
currentTable = database.schemaManager.getUserTable(session, name,
schema);
currentStore =
database.persistentStoreCollection.getStore(currentTable);
Type[] colTypes;
if (statementType == INSERT_STATEMENT) {
colTypes = currentTable.getColumnTypes();
} else if (currentTable.hasPrimaryKey()) {
colTypes = currentTable.getPrimaryKeyTypes();
} else {
colTypes = currentTable.getColumnTypes();
}
try {
rowData = rowIn.readData(colTypes);
} catch (IOException e) {
throw Error.error(e, ErrorCode.FILE_IO_ERROR, null);
}
}