wxString pgOperator::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Operator: ") + GetQuotedFullIdentifier() + wxT("(") + GetOperands() + wxT(")\n\n") + wxT("-- DROP OPERATOR ") + GetQuotedFullIdentifier() + wxT("(") + GetOperands() + wxT(");\n\n") wxT("CREATE OPERATOR ") + GetQuotedFullIdentifier() + wxT("(\n PROCEDURE = ") + GetOperatorFunction(); AppendIfFilled(sql, wxT(",\n LEFTARG = "), qtTypeIdent(GetLeftType())); AppendIfFilled(sql, wxT(",\n RIGHTARG = "), qtTypeIdent(GetRightType())); AppendIfFilled(sql, wxT(",\n COMMUTATOR = "), GetCommutator()); AppendIfFilled(sql, wxT(",\n RESTRICT = "), GetRestrictFunction()); AppendIfFilled(sql, wxT(",\n JOIN = "), GetJoinFunction()); if (GetHashJoins()) sql += wxT(",\n HASHES"); if (GetMergeJoins()) sql += wxT(",\n MERGES"); if (!GetDatabase()->BackendMinimumVersion(8, 3)) { AppendIfFilled(sql, wxT(",\n SORT1 = "), GetLeftSortOperator()); AppendIfFilled(sql, wxT(",\n SORT2 = "), GetRightSortOperator()); AppendIfFilled(sql, wxT(",\n LTCMP = "), GetLessOperator()); AppendIfFilled(sql, wxT(",\n GTCMP = "), GetGreaterOperator()); } sql += wxT(");\n"); if (!GetComment().IsNull()) sql += wxT("COMMENT ON OPERATOR ") + GetQuotedFullIdentifier() + wxT("(") + GetOperands() + wxT(") IS ") + qtDbString(GetComment()) + wxT(";\n"); } return sql; }
ExpressionNode *OperatorNode::CannonizeOperandsOrder() { if (IsAND() || IsOR() || GetType() == EXPR_EQUALITY || GetType() == EXPR_DISEQUALITY || GetType() == EXPR_ARRAY_PARTIAL_EQUALITY) { std::vector<Expression> new_operands = GetOperands(); std::vector<Expression>::iterator i, iend = new_operands.end(); for (i = new_operands.begin(); i != iend; i++) i->CannonizeOperandsOrder(); if (!IsOR()) sort(new_operands.begin(), new_operands.end(), Expression::_PTR_LT); return SetOperands(new_operands); } return Clone(); }