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


Java ArrayUtil.haveCommonElement方法代码示例

本文整理汇总了Java中org.hsqldb.lib.ArrayUtil.haveCommonElement方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtil.haveCommonElement方法的具体用法?Java ArrayUtil.haveCommonElement怎么用?Java ArrayUtil.haveCommonElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hsqldb.lib.ArrayUtil的用法示例。


在下文中一共展示了ArrayUtil.haveCommonElement方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performIntegrityChecks

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
static void performIntegrityChecks(Session session, Table table,
                                   Object[] oldData, Object[] newData,
                                   int[] updatedColumns) {

    if (newData == null) {
        return;
    }

    for (int i = 0, size = table.checkConstraints.length; i < size; i++) {
        table.checkConstraints[i].checkInsert(session, table, newData,
                                              oldData == null);
    }

    if (!session.database.isReferentialIntegrity()) {
        return;
    }

    for (int i = 0, size = table.fkConstraints.length; i < size; i++) {
        boolean    check = oldData == null;
        Constraint c     = table.fkConstraints[i];

        if (!check) {
            check = ArrayUtil.haveCommonElement(c.getRefColumns(),
                                                updatedColumns);
        }

        if (check) {
            c.checkInsert(session, table, newData, oldData == null);
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:32,代码来源:StatementDML.java

示例2: collectFKReadLocks

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/** columnMap is null for deletes */
void collectFKReadLocks(int[] columnMap, OrderedHashSet set) {

    for (int i = 0; i < fkMainConstraints.length; i++) {
        Constraint constraint  = fkMainConstraints[i];
        Table      ref         = constraint.getRef();
        int[]      mainColumns = constraint.getMainColumns();

        if (ref == this) {
            continue;
        }

        if (columnMap == null) {
            if (constraint.core.hasDeleteAction) {
                int[] cols =
                    constraint.getDeleteAction()
                    == SchemaObject.ReferentialAction.CASCADE ? null
                                                              : constraint
                                                                  .getRefColumns();

                if (set.add(ref.getName())) {
                    ref.collectFKReadLocks(cols, set);
                }
            }
        } else if (ArrayUtil.haveCommonElement(columnMap, mainColumns)) {
            if (set.add(ref.getName())) {
                ref.collectFKReadLocks(constraint.getRefColumns(), set);
            }
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:32,代码来源:Table.java

示例3: collectFKWriteLocks

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/** columnMap is null for deletes */
void collectFKWriteLocks(int[] columnMap, OrderedHashSet set) {

    for (int i = 0; i < fkMainConstraints.length; i++) {
        Constraint constraint  = fkMainConstraints[i];
        Table      ref         = constraint.getRef();
        int[]      mainColumns = constraint.getMainColumns();

        if (ref == this) {
            continue;
        }

        if (columnMap == null) {
            if (constraint.core.hasDeleteAction) {
                int[] cols =
                    constraint.getDeleteAction()
                    == SchemaObject.ReferentialAction.CASCADE ? null
                                                              : constraint
                                                                  .getRefColumns();

                if (set.add(ref.getName())) {
                    ref.collectFKWriteLocks(cols, set);
                }
            }
        } else if (ArrayUtil.haveCommonElement(columnMap, mainColumns)) {
            if (constraint.core.hasUpdateAction) {
                if (set.add(ref.getName())) {
                    ref.collectFKWriteLocks(constraint.getRefColumns(),
                                            set);
                }
            }
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:35,代码来源:Table.java

示例4: fireBeforeTriggers

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 * Fires all row-level triggers of the given set (trigger type)
 */
void fireBeforeTriggers(Session session, int trigVecIndex, Object[] oldData, Object[] newData, int[] cols) {

    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 (cols != null && td.getUpdateColumnIndexes() != null && !ArrayUtil.haveCommonElement(td.getUpdateColumnIndexes(), cols, cols.length)) {
            continue;
        }

        if (td.isForEachRow()) {
            switch (td.triggerType) {

                case Trigger.UPDATE_BEFORE_ROW:
                case Trigger.DELETE_BEFORE_ROW:
                    if (!sqlTrigger) {
                        oldData = (Object[]) ArrayUtil.duplicateArray(oldData);
                    }
                    break;
            }

            td.pushPair(session, oldData, newData);
        } else {
            td.pushPair(session, null, null);
        }
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:37,代码来源:Table.java

示例5: collectFKReadLocks

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/** columnMap is null for deletes */
void collectFKReadLocks(int[] columnMap, OrderedHashSet set) {

    for (int i = 0; i < fkMainConstraints.length; i++) {
        Constraint constraint  = fkMainConstraints[i];
        Table      ref         = constraint.getRef();
        int[]      mainColumns = constraint.getMainColumns();

        if (ref == this) {
            continue;
        }

        if (columnMap == null) {
            if (constraint.core.hasDeleteAction) {
                int[] cols =
                    constraint.core.deleteAction
                    == SchemaObject.ReferentialAction.CASCADE ? null
                                                              : constraint
                                                                  .getRefColumns();

                if (set.add(ref.getName())) {
                    ref.collectFKReadLocks(cols, set);
                }
            }
        } else if (ArrayUtil.haveCommonElement(columnMap, mainColumns)) {
            if (set.add(ref.getName())) {
                ref.collectFKReadLocks(constraint.getRefColumns(), set);
            }
        }
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:32,代码来源:Table.java

示例6: collectFKWriteLocks

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/** columnMap is null for deletes */
void collectFKWriteLocks(int[] columnMap, OrderedHashSet set) {

    for (int i = 0; i < fkMainConstraints.length; i++) {
        Constraint constraint  = fkMainConstraints[i];
        Table      ref         = constraint.getRef();
        int[]      mainColumns = constraint.getMainColumns();

        if (ref == this) {
            continue;
        }

        if (columnMap == null) {
            if (constraint.core.hasDeleteAction) {
                int[] cols =
                    constraint.core.deleteAction
                    == SchemaObject.ReferentialAction.CASCADE ? null
                                                              : constraint
                                                                  .getRefColumns();

                if (set.add(ref.getName())) {
                    ref.collectFKWriteLocks(cols, set);
                }
            }
        } else if (ArrayUtil.haveCommonElement(columnMap, mainColumns)) {
            if (constraint.core.hasUpdateAction) {
                if (set.add(ref.getName())) {
                    ref.collectFKWriteLocks(constraint.getRefColumns(),
                                            set);
                }
            }
        }
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:35,代码来源:Table.java

示例7: collectTableNamesForRead

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
void collectTableNamesForRead(OrderedHashSet set) {

        if (baseTable.isView()) {
            getTriggerTableNames(set, false);
        } else if (!baseTable.isTemp()) {
            for (int i = 0; i < baseTable.fkConstraints.length; i++) {
                Constraint constraint = baseTable.fkConstraints[i];

                switch (type) {

                    case StatementTypes.UPDATE_WHERE : {
                        if (ArrayUtil.haveCommonElement(
                                constraint.getRefColumns(), updateColumnMap)) {
                            set.add(baseTable.fkConstraints[i].getMain()
                                .getName());
                        }

                        break;
                    }
                    case StatementTypes.INSERT : {
                        set.add(
                            baseTable.fkConstraints[i].getMain().getName());

                        break;
                    }
                    case StatementTypes.MERGE : {
                        if (updateColumnMap != null) {
                            if (ArrayUtil.haveCommonElement(
                                    constraint.getRefColumns(),
                                    updateColumnMap)) {
                                set.add(baseTable.fkConstraints[i].getMain()
                                    .getName());
                            }
                        }

                        if (insertExpression != null) {
                            set.add(baseTable.fkConstraints[i].getMain()
                                .getName());
                        }

                        break;
                    }
                }
            }

            if (type == StatementTypes.UPDATE_WHERE
                    || type == StatementTypes.MERGE) {
                baseTable.collectFKReadLocks(updateColumnMap, set);
            } else if (type == StatementTypes.DELETE_WHERE) {
                baseTable.collectFKReadLocks(null, set);
            }

            getTriggerTableNames(set, false);
        }

        for (int i = 0; i < rangeVariables.length; i++) {
            Table    rangeTable = rangeVariables[i].rangeTable;
            HsqlName name       = rangeTable.getName();

            if (rangeTable.isDataReadOnly() || rangeTable.isTemp()) {
                continue;
            }

            if (name.schema == SqlInvariants.SYSTEM_SCHEMA_HSQLNAME) {
                continue;
            }

            set.add(name);
        }

        for (int i = 0; i < subqueries.length; i++) {
            if (subqueries[i].queryExpression != null) {
                subqueries[i].queryExpression.getBaseTableNames(set);
            }
        }

        for (int i = 0; i < routines.length; i++) {
            set.addAll(routines[i].getTableNamesForRead());
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:81,代码来源:StatementDML.java

示例8: fireTriggers

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
/**
 *  Fires all row-level triggers of the given set (trigger type)
 *
 */
void fireTriggers(Session session, int trigVecIndex, Object[] oldData,
                  Object[] newData, int[] cols) {

    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 (cols != null && td.getUpdateColumnIndexes() != null
                && !ArrayUtil.haveCommonElement(
                    td.getUpdateColumnIndexes(), cols)) {
            continue;
        }

        if (td.isForEachRow()) {
            switch (td.triggerType) {

                case Trigger.INSERT_BEFORE_ROW :
                    break;

                case Trigger.INSERT_AFTER_ROW :
                    if (!sqlTrigger) {
                        newData =
                            (Object[]) ArrayUtil.duplicateArray(newData);
                    }
                    break;

                case Trigger.UPDATE_AFTER_ROW :
                    if (!sqlTrigger) {
                        oldData =
                            (Object[]) ArrayUtil.duplicateArray(oldData);
                        newData =
                            (Object[]) ArrayUtil.duplicateArray(newData);
                    }
                    break;

                case Trigger.UPDATE_BEFORE_ROW :
                case Trigger.DELETE_BEFORE_ROW :
                case Trigger.DELETE_AFTER_ROW :
                    if (!sqlTrigger) {
                        oldData =
                            (Object[]) ArrayUtil.duplicateArray(oldData);
                    }
                    break;
            }

            td.pushPair(session, oldData, newData);
        } else {
            td.pushPair(session, null, null);
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:62,代码来源:Table.java

示例9: addRefAction

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
synchronized boolean addRefAction(Session session, int[] colMap) {

        if (type == ACTION_NONE) {
            setAsAction(session, ACTION_REF);

            changeColumnMap = colMap;

            return true;
        }

        RowActionBase action = this;

        do {
            if (session == action.session) {
                if (action.type == ACTION_REF
                        && action.changeColumnMap == colMap
                        && action.commitTimestamp == 0) {
                    return false;
                }

                if (action.type == ACTION_INSERT) {
                    if (action.commitTimestamp == 0) {
                        return false;
                    }
                }
            } else {
                if (action.type == ACTION_DELETE
                        && action.commitTimestamp == 0) {
                    if (action.changeColumnMap == null
                            || ArrayUtil.haveCommonElement(
                                colMap, action.changeColumnMap)) {
                        if (!session.actionSet.isEmpty()) {
                            session.actionSet.clear();
                        }

                        session.actionSet.add(action);

                        return false;
                    }
                }
            }

            if (action.next == null) {
                break;
            }

            action = action.next;
        } while (true);

        RowActionBase newAction = new RowActionBase(session, ACTION_REF);

        newAction.changeColumnMap = colMap;
        action.next               = newAction;

        return true;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:57,代码来源:RowAction.java

示例10: addRefAction

import org.hsqldb.lib.ArrayUtil; //导入方法依赖的package包/类
synchronized boolean addRefAction(Session session, int[] colMap) {

        if (type == ACTION_NONE) {
            setAsAction(session, ACTION_REF);

            changeColumnMap = colMap;

            return true;
        }

        RowActionBase action = this;

        do {
            if (session == action.session) {
                if (action.type == ACTION_REF
                        && action.changeColumnMap == colMap
                        && action.commitTimestamp == 0) {
                    return false;
                }

                if (action.type == ACTION_INSERT) {
                    if (action.commitTimestamp == 0) {
                        return false;
                    }
                }
            } else {
                if (action.type == ACTION_DELETE
                        && action.commitTimestamp == 0) {
                    if (action.changeColumnMap == null
                            || ArrayUtil.haveCommonElement(
                                colMap, action.changeColumnMap)) {
                        if (!session.tempSet.isEmpty()) {
                            session.tempSet.clear();
                        }

                        session.tempSet.add(action);

                        return false;
                    }
                }
            }

            if (action.next == null) {
                break;
            }

            action = action.next;
        } while (true);

        RowActionBase newAction = new RowActionBase(session, ACTION_REF);

        newAction.changeColumnMap = colMap;
        action.next               = newAction;

        return true;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:57,代码来源:RowAction.java


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