/** * Create a join clause constraint segment. * * @param array $clause * @return string */ protected virtual string compileJoinConstraint(JoinClauseOptions clause) { if (clause.nested) { return(this.compileNestedJoinConstraint(clause)); } string first = this.wrap(clause.first); string second = ""; if (clause.where) { if (clause.operator1 == "in" || clause.operator1 == "not in") { second = "(" + string.Join(", ", ArrayUtil.repeat("?", (int)clause.second)) + ")"; } else { second = "?"; } } else { second = this.wrap(clause.second); } return(clause.boolean + " " + first + " " + clause.operator1 + " " + second); }
/** * Create a nested join clause constraint segment. * * @param array $clause * @return string */ protected virtual string compileNestedJoinConstraint(JoinClauseOptions clause) { string[] clauses = new string[0]; foreach (JoinClauseOptions nestedClause in clause.join._clauses) { clauses = ArrayUtil.push(clauses, this.compileJoinConstraint(nestedClause)); } clauses[0] = this.removeLeadingBoolean(clauses[0]); string clauses1 = string.Join(" ", clauses); return(clause.boolean + " " + clauses1); }