本文整理汇总了Java中org.hsqldb.Session.setSchema方法的典型用法代码示例。如果您正苦于以下问题:Java Session.setSchema方法的具体用法?Java Session.setSchema怎么用?Java Session.setSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.Session
的用法示例。
在下文中一共展示了Session.setSchema方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readExistingData
import org.hsqldb.Session; //导入方法依赖的package包/类
protected void readExistingData(Session session)
throws IOException, HsqlException {
try {
String tablename = null;
// fredt - needed for forward referencing FK constraints
db.setReferentialIntegrity(false);
for (; isInsert || readLoggedStatement(session);
isInsert = false) {
if (statementType == SCHEMA_STATEMENT) {
session.setSchema(currentSchema);
continue;
} else if (statementType == INSERT_STATEMENT) {
if (!rowIn.getTableName().equals(tablename)) {
tablename = rowIn.getTableName();
String schema = session.getSchemaName(currentSchema);
currentTable = db.schemaManager.getUserTable(session,
tablename, schema);
}
currentTable.insertFromScript(rowData);
}
}
db.setReferentialIntegrity(true);
} catch (Exception e) {
db.logger.appLog.logContext(e, null);
throw Trace.error(Trace.ERROR_IN_SCRIPT_FILE,
Trace.DatabaseScriptReader_readExistingData,
new Object[] {
new Integer(lineCount), e.toString()
});
}
}
示例2: readExistingData
import org.hsqldb.Session; //导入方法依赖的package包/类
protected void readExistingData(Session session) {
try {
String tablename = null;
// fredt - needed for forward referencing FK constraints
database.setReferentialIntegrity(false);
for (; isInsert || readLoggedStatement(session);
isInsert = false) {
if (statementType == SET_SCHEMA_STATEMENT) {
session.setSchema(currentSchema);
tablename = null;
continue;
} else if (statementType == INSERT_STATEMENT) {
if (!rowIn.getTableName().equals(tablename)) {
tablename = rowIn.getTableName();
String schema = session.getSchemaName(currentSchema);
currentTable =
database.schemaManager.getUserTable(tablename,
schema);
currentStore =
database.persistentStoreCollection.getStore(
currentTable);
}
try {
currentTable.insertFromScript(session, currentStore,
rowData);
} catch (HsqlException ex) {
handleException(ex);
}
} else {
throw Error.error(ErrorCode.ERROR_IN_SCRIPT_FILE,
statement);
}
}
} catch (Throwable t) {
database.logger.logSevereEvent("readExistingData failed "
+ lineCount, t);
throw Error.error(t, ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_read,
new Object[] {
Long.valueOf(lineCount), t.toString()
});
} finally {
database.setReferentialIntegrity(true);
}
}
示例3: readDDL
import org.hsqldb.Session; //导入方法依赖的package包/类
protected void readDDL(Session session) throws IOException {
for (; readLoggedStatement(session); ) {
Statement cs = null;
Result result = null;
if (rowIn.getStatementType() == INSERT_STATEMENT) {
isInsert = true;
break;
}
try {
cs = session.compileStatement(statement);
result = session.executeCompiledStatement(cs,
ValuePool.emptyObjectArray);
if (cs.getType() == StatementTypes.CREATE_SCHEMA) {
HsqlName name = cs.getSchemalName();
session.setSchema(name.name);
}
} catch (HsqlException e) {
result = Result.newErrorResult(e);
}
if (result.isError()) {
// handle grants on math and library routines in old versions
if (cs == null) {}
else {
if (cs.getType() == StatementTypes.GRANT) {
continue;
}
}
//
}
if (result.isError()) {
db.logger.appLog.logContext(SimpleLog.LOG_ERROR,
result.getMainString());
throw Error.error(ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_readDDL,
new Object[] {
new Integer(lineCount), result.getMainString()
});
}
}
}
示例4: readExistingData
import org.hsqldb.Session; //导入方法依赖的package包/类
protected void readExistingData(Session session)
throws IOException {
try {
String tablename = null;
// fredt - needed for forward referencing FK constraints
db.setReferentialIntegrity(false);
for (; isInsert || readLoggedStatement(session);
isInsert = false) {
if (statementType == SET_SCHEMA_STATEMENT) {
session.setSchema(currentSchema);
continue;
} else if (statementType == INSERT_STATEMENT) {
if (!rowIn.getTableName().equals(tablename)) {
tablename = rowIn.getTableName();
String schema = session.getSchemaName(currentSchema);
currentTable = db.schemaManager.getUserTable(session,
tablename, schema);
currentStore = db.persistentStoreCollection.getStore(
currentTable);
}
currentTable.insertFromScript(currentStore, rowData);
}
}
db.setReferentialIntegrity(true);
} catch (Exception e) {
db.logger.appLog.logContext(e, null);
throw Error.error(
ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_readExistingData,
new Object[] {
new Integer(lineCount), e.toString()
});
}
}
示例5: readExistingData
import org.hsqldb.Session; //导入方法依赖的package包/类
protected void readExistingData(Session session) {
try {
String tablename = null;
// fredt - needed for forward referencing FK constraints
database.setReferentialIntegrity(false);
for (; isInsert || readLoggedStatement(session);
isInsert = false) {
if (statementType == SET_SCHEMA_STATEMENT) {
session.setSchema(currentSchema);
continue;
} else if (statementType == INSERT_STATEMENT) {
if (!rowIn.getTableName().equals(tablename)) {
tablename = rowIn.getTableName();
String schema = session.getSchemaName(currentSchema);
currentTable =
database.schemaManager.getUserTable(session,
tablename, schema);
currentStore =
database.persistentStoreCollection.getStore(
currentTable);
}
try {
currentTable.insertFromScript(session, currentStore,
rowData);
} catch (HsqlException ex) {
handleException(ex);
}
} else {
throw Error.error(ErrorCode.ERROR_IN_SCRIPT_FILE,
statement);
}
}
database.setReferentialIntegrity(true);
} catch (Throwable t) {
database.logger.logSevereEvent("readExistingData failed", t);
throw Error.error(t, ErrorCode.ERROR_IN_SCRIPT_FILE,
ErrorCode.M_DatabaseScriptReader_read,
new Object[] {
new Integer(lineCount), t.toString()
});
}
}