本文整理汇总了Java中org.hsqldb.navigator.RowSetNavigator.beforeFirst方法的典型用法代码示例。如果您正苦于以下问题:Java RowSetNavigator.beforeFirst方法的具体用法?Java RowSetNavigator.beforeFirst怎么用?Java RowSetNavigator.beforeFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.navigator.RowSetNavigator
的用法示例。
在下文中一共展示了RowSetNavigator.beforeFirst方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fireAfterTriggers
import org.hsqldb.navigator.RowSetNavigator; //导入方法依赖的package包/类
void fireAfterTriggers(Session session, int trigVecIndex, RowSetNavigator rowSet) {
if (!database.isReferentialIntegrity()) {
return;
}
TriggerDef[] trigVec = triggerLists[trigVecIndex];
for (int i = 0, size = trigVec.length; i < size; i++) {
TriggerDef td = trigVec[i];
boolean sqlTrigger = td instanceof TriggerDefSQL;
if (td.hasOldTable()) {
//
}
if (td.isForEachRow()) {
while (rowSet.hasNext()) {
Object[] oldData = null;
Object[] newData = null;
switch (td.triggerType) {
case Trigger.DELETE_AFTER_ROW:
oldData = rowSet.getNext();
if (!sqlTrigger) {
oldData = (Object[]) ArrayUtil.duplicateArray(oldData);
}
break;
case Trigger.INSERT_AFTER_ROW:
newData = rowSet.getNext();
if (!sqlTrigger) {
newData = (Object[]) ArrayUtil.duplicateArray(newData);
}
break;
}
td.pushPair(session, oldData, newData);
}
rowSet.beforeFirst();
} else {
td.pushPair(session, null, null);
}
}
}
示例2: getResult
import org.hsqldb.navigator.RowSetNavigator; //导入方法依赖的package包/类
/**
* Executes an INSERT_SELECT statement. It is assumed that the argument
* is of the correct type.
*
* @return the result of executing the statement
*/
Result getResult(Session session) {
Table table = baseTable;
Result resultOut = null;
RowSetNavigator generatedNavigator = null;
PersistentStore store = session.sessionData.getRowStore(baseTable);
if (generatedIndexes != null) {
resultOut = Result.newUpdateCountResult(generatedResultMetaData,
0);
generatedNavigator = resultOut.getChainedResult().getNavigator();
}
RowSetNavigator newDataNavigator = queryExpression == null
? getInsertValuesNavigator(session)
: getInsertSelectNavigator(session);
Expression checkCondition = null;
RangeIteratorBase checkIterator = null;
if (targetTable != baseTable) {
QuerySpecification select =
((TableDerived) targetTable).getQueryExpression()
.getMainSelect();
checkCondition = select.checkQueryCondition;
if (checkCondition != null) {
checkIterator = select.rangeVariables[0].getIterator(session);
}
}
while (newDataNavigator.hasNext()) {
Object[] data = newDataNavigator.getNext();
if (checkCondition != null) {
checkIterator.currentData = data;
boolean check = checkCondition.testCondition(session);
if (!check) {
throw Error.error(ErrorCode.X_44000);
}
}
table.insertRow(session, store, data);
if (generatedNavigator != null) {
Object[] generatedValues = getGeneratedColumns(data);
generatedNavigator.add(generatedValues);
}
}
newDataNavigator.beforeFirst();
table.fireAfterTriggers(session, Trigger.INSERT_AFTER,
newDataNavigator);
if (resultOut == null) {
resultOut =
Result.getUpdateCountResult(newDataNavigator.getSize());
} else {
resultOut.setUpdateCount(newDataNavigator.getSize());
}
return resultOut;
}