当前位置: 首页>>代码示例>>Java>>正文


Java RowSetNavigator.beforeFirst方法代码示例

本文整理汇总了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);
            }
        }
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:51,代码来源:Table.java

示例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;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:73,代码来源:StatementInsert.java


注:本文中的org.hsqldb.navigator.RowSetNavigator.beforeFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。