public static CriteriaOperator GetOrCriteria(params CriteriaOperator[] operators) { CriteriaOperatorCollection operatorCollection = new CriteriaOperatorCollection(); operatorCollection.AddRange(operators.Where(op => !Equals(op, null))); if (operatorCollection.Count == 0) { return(null); } if (operatorCollection.Count == 1) { return(operatorCollection[0]); } return(GetORCriteria(operatorCollection)); }
private SelectStatementResult SelectData(Query query, CriteriaOperatorCollection targets) { if (query.ConstantValues != null && query.OperandIndexes != null && query.ConstantValues.Count > 0) { CriteriaOperatorCollection customTargets = new CriteriaOperatorCollection(); if (query.OperandIndexes.Count == 0) { customTargets.Add(new OperandValue(1)); } else { CriteriaOperator[] trgts = new CriteriaOperator[query.OperandIndexes.Count]; for (int i = 0; i < targets.Count; i++) { if (query.OperandIndexes.ContainsKey(i)) { trgts[query.OperandIndexes[i]] = targets[i]; } } customTargets.AddRange(trgts); } SelectStatementResult queryResult = SelectDataSimple(query, customTargets, false)[0]; SelectStatementResultRow[] rows = new SelectStatementResultRow[queryResult.Rows.Length]; for (int ri = 0; ri < rows.Length; ri++) { object[] values = new object[targets.Count]; for (int i = 0; i < targets.Count; i++) { if (query.OperandIndexes.ContainsKey(i)) { values[i] = queryResult.Rows[ri].Values[query.OperandIndexes[i]]; } else { values[i] = query.ConstantValues[i].Value; } } rows[ri] = new SelectStatementResultRow(values); } return new SelectStatementResult(rows); } return SelectDataSimple(query, targets, false)[0]; }