/*
Tests a row against this CHECK constraint.
777838
void checkCheckConstraint(Session session, Table table, Object[] data) {

/*
        if (session.compiledStatementExecutor.rangeIterators[1] == null) {
            session.compiledStatementExecutor.rangeIterators[1] =
                rangeVariable.getIterator(session);
        }
*/
        RangeIteratorBase it =
            (RangeIteratorBase) session.sessionContext.getCheckIterator();

        if (it == null) {
            it = rangeVariable.getIterator(session);

            session.sessionContext.setCheckIterator(it);
        }

        it.currentData = data;

        boolean nomatch = Boolean.FALSE.equals(check.getValue(session));

        it.currentData = null;

        if (nomatch) {
            String[] info = new String[] {
                name.name, table.tableName.name
            };

            throw Error.error(ErrorCode.X_23504, ErrorCode.CONSTRAINT, info);
        }
    }
145489
function(row) {
    var elRow = this.getTrEl(row) || this.getLastTrEl();
    if(elRow && (elRow.cells.length > 0)) {
        return elRow.cells[elRow.cells.length-1];
    }
    return null;
}
185765
public static <T> Constraint
            checking(Function<String, T> check, String messageOrKey, boolean isKey, String... extraMessageArgs) {
        return mkSimpleConstraint(((label, vString, messages) -> {
            logger.debug("checking for {}", vString);

            if (isEmptyStr(vString)) return null;
            else {
                try {
                    check.apply(vString);
                    return null;
                } catch (Exception ex) {
                    String msgTemplate = isKey ? messages.get(messageOrKey) : messageOrKey;
                    List<String> messageArgs = appendList(Arrays.asList(vString), extraMessageArgs);
                    return String.format(msgTemplate, messageArgs.toArray());
                }
            }
        }), null);
    }
1025515
protected function assertIndexesAreValid($row, $column, $height = 1, $width = 1)
    {
        Assert::assertIntegerBetween(0, $this->rows - $height, $row, 'row');
        Assert::assertIntegerBetween(0, $this->columns - $width, $column, 'column');
    }
853704
function checkIfFieldsExist(fieldStr,rows) {

    var ret = true;

    if(fieldStr.search(',') > -1 ) {
        var fieldArr = fieldStr.split(',');
        fieldArr.forEach(function (field) {
            if(ret) {
                if(rows.filter(function (r) {return r.Field === field;}).length == 0) {
                    ret = false;
                }
            }
        });
    } else {
        if(rows.filter(function (r) {return r.Field === fieldStr;}).length == 0) {
            ret = false;
        }
    }

    return ret;
}
976109
private function validateRow($row)
    {
        if ($row === false)
            return $row;
        $resolver = new OptionsResolver();
        $resolver->setRequired([
            'class',
            'columns',
        ]);
        $resolver->setAllowedTypes('class', 'string');
        $resolver->setAllowedTypes('columns', 'array');
        $row = $resolver->resolve($row);
        if (empty($row['columns']))
            trigger_error(sprintf('An array of columns is compulsory for each row.'), E_USER_ERROR);
        $row['columns'] = $this->validateColumns($row['columns']);
        return $row;
    }
738127
function processRow(row) {
        if (!row) row = {};
        for (var i = 0; i < hooks.length; i++) {
            if (hooks[i].call(row, req, row) === true) return false;
        }
        return true;
    }
295513
@Override
    public RowIterator findFirstRow(Session session, PersistentStore store,
                                    Object value, int compare) {

        readLock.lock();

        try {
            if (compare == OpTypes.SMALLER
                    || compare == OpTypes.SMALLER_EQUAL) {
                return findFirstRowNotNull(session, store);
            }

            boolean isEqual = compare == OpTypes.EQUAL
                              || compare == OpTypes.IS_NULL;
            NodeAVL x     = getAccessor(store);
            int     iTest = 1;

            if (compare == OpTypes.GREATER) {
                iTest = 0;
            }

            if (value == null && !isEqual) {
                return emptyIterator;
            }

            // this method returns the correct node only with the following conditions
            boolean check = compare == OpTypes.GREATER
                            || compare == OpTypes.EQUAL
                            || compare == OpTypes.GREATER_EQUAL;

            if (!check) {
                Error.runtimeError(ErrorCode.U_S0500, "Index.findFirst");
            }

            while (x != null) {
                boolean t = colTypes[0].compare(
                    value, x.getRow(store).getData()[colIndex[0]]) >= iTest;

                if (t) {
                    NodeAVL r = x.getRight(store);

                    if (r == null) {
                        break;
                    }

                    x = r;
                } else {
                    NodeAVL l = x.getLeft(store);

                    if (l == null) {
                        break;
                    }

                    x = l;
                }
            }

/*
        while (x != null
                && Column.compare(value, x.getData()[colIndex_0], colType_0)
                   >= iTest) {
            x = next(x);
        }
*/
            while (x != null) {
                Object colvalue = x.getRow(store).getData()[colIndex[0]];
                int    result   = colTypes[0].compare(value, colvalue);

                if (result >= iTest) {
                    x = next(store, x);
                } else {
                    if (isEqual) {
                        if (result != 0) {
                            x = null;
                        }
                    } else if (colvalue == null) {
                        x = next(store, x);

                        continue;
                    }

                    break;
                }
            }

// MVCC
            if (session == null || x == null) {
                return getIterator(session, store, x);
            }

            while (x != null) {
                Row row = x.getRow(store);

                if (compare == OpTypes.EQUAL
                        && colTypes[0].compare(
                            value, row.getData()[colIndex[0]]) != 0) {
                    x = null;

                    break;
                }

                if (session.database.txManager.canRead(session, row)) {
                    break;
                }

                x = next(store, x);
            }

            return getIterator(session, store, x);
        } finally {
            readLock.unlock();
        }
    }
1337065
def match(self, row):
        
        return fnmatch.fnmatchcase(row[self._field], self._expression)
1323653
private void checkIndices(int row, int col) {
        if (row < 0 || col < 0 || row >= rows || col >= cols) {
            throw new IndexOutOfBoundsException();
        }
    }
645282
@Override
    public boolean checkCondition(IValue test) throws FilterException {
        Iterator iter = values.iterator();
        while (iter.hasNext()) {
            IValue value = (IValue) iter.next();
            if (value.containedBy(test)) {
                return true;
            }
        }
        return false;
    }
306886
void readCheckConstraintCondition(Constraint c) {

        readThis(Tokens.OPENBRACKET);
        startRecording();

        isCheckOrTriggerCondition = true;

        Expression condition = XreadBooleanValueExpression();

        isCheckOrTriggerCondition = false;

        Token[] tokens = getRecordedStatement();

        readThis(Tokens.CLOSEBRACKET);

        c.check          = condition;
        c.checkStatement = Token.getSQL(tokens);
    }
1111409
private void checkConstraint(
		SqlValidatorTable validatorTable,
		SqlUpdate update,
		RelDataType targetRowType) {
		final ModifiableViewTable modifiableViewTable =
			validatorTable.unwrap(ModifiableViewTable.class);
		if (modifiableViewTable != null) {
			final Table table = modifiableViewTable.unwrap(Table.class);
			final RelDataType tableRowType = table.getRowType(typeFactory);

			final Map<Integer, RexNode> projectMap =
				RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType,
					typeFactory);
			final Map<String, Integer> nameToIndex =
				SqlValidatorUtil.mapNameToIndex(tableRowType.getFieldList());

			// Validate update values against the view constraint.
			final List<SqlNode> targets = update.getTargetColumnList().getList();
			final List<SqlNode> sources = update.getSourceExpressionList().getList();
			for (final Pair<SqlNode, SqlNode> column : Pair.zip(targets, sources)) {
				final String columnName = ((SqlIdentifier) column.left).getSimple();
				final Integer columnIndex = nameToIndex.get(columnName);
				if (projectMap.containsKey(columnIndex)) {
					final RexNode columnConstraint = projectMap.get(columnIndex);
					final ValidationError validationError =
						new ValidationError(column.right,
							RESOURCE.viewConstraintNotSatisfied(columnName,
								Util.last(validatorTable.getQualifiedName())));
					RelOptUtil.validateValueAgainstConstraint(column.right,
						columnConstraint, validationError);
				}
			}
		}
	}
812091
function _validate_offset ($current_row) {
		if ( $this->sort_by === null && $this->offset !== null && $current_row < $this->offset ) return false;
		return true;
	}
502271
private boolean absoluteAdvanced(int row)
    {
        boolean retval = false;
        
        try
        {
            if (getRsAndStmt().m_rs != null)
            {
                if (row == 0)
                {
                    getRsAndStmt().m_rs.beforeFirst();
                }
                else
                {
                    retval = getRsAndStmt().m_rs.absolute(row);                        
                }
                m_current_row = row;
                setHasCalledCheck(false);
            }
        }
        catch (SQLException e)
        {
            advancedJDBCSupport = false;
        }
        return retval;
    }
794191
public boolean isInBounds(int row, int col) {
        return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();
    }
1356243
function assertThrows(test) {
    var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
    var contains = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];


    if (!Array.isArray(contains)) contains = [contains];

    var shouldErrorName = typeof error === 'string' ? error : error.name;

    var nonThrown = new Error('util.assertThrowsAsync(): Missing rejection' + (error ? ' with ' + error.name : ''));
    var ensureErrorMatches = function ensureErrorMatches(error) {
        // wrong type
        if (error.constructor.name != shouldErrorName) {
            return new Error('\n             util.assertThrowsAsync(): Wrong Error-type\n             - is    : ' + error.constructor.name + '\n             - should: ' + shouldErrorName + '\n             - error: ' + error.toString() + '\n             ');
        }
        // check if contains
        var errorString = error.toString();
        if (contains.length > 0 && (0, _utils.oneOfArrayNotInString)(contains, errorString)) {
            return new Error('\n               util.assertThrowsAsync(): Error does not contain\n               - should contain: ' + contains + '\n               - is string: ' + error.toString() + '\n             ');
        }
        return false;
    };

    return new Promise(function (res, rej) {
        var val = void 0;
        try {
            val = test();
        } catch (err) {
            var wrong = ensureErrorMatches(err);
            if (wrong) rej(wrong);else res(err);
            return;
        }
        if ((0, _isPromise2['default'])(val)) {
            val.then(function () {
                // has not thrown
                rej(nonThrown);
            })['catch'](function (err) {
                var wrong = ensureErrorMatches(err);
                if (wrong) rej(wrong);else res(err);
            });
        } else rej(nonThrown);
    });
}