001    package railo.runtime.sql.exp.op;
002    
003    import railo.runtime.sql.exp.Expression;
004    import railo.runtime.sql.exp.ExpressionSupport;
005    
006    public class Operation3 extends ExpressionSupport implements Operation {
007    
008            private Expression exp;
009            private Expression left;
010            private Expression right;
011            private int operator;
012    
013    
014            public Operation3(Expression exp, Expression left, Expression right, int operator) {
015                    this.exp=exp;
016                    this.left=left;
017                    this.right=right;
018                    this.operator=operator;
019            }
020    
021            public String toString(boolean noAlias) {
022                    // like escape
023                    if(Operation.OPERATION3_LIKE==operator){
024                            if(!hasAlias() || noAlias) {
025                                    return exp.toString(true)+" like "+
026                                                    left.toString(true)+" escape "+
027                                                    right.toString(true);
028                            }
029                            return toString(true)+" as "+getAlias();
030                    }
031                    // between
032                    if(!hasAlias() || noAlias) {
033                            return exp.toString(true)+" between "+left.toString(true)+" and "+right.toString(true);
034                    }
035                    return toString(true)+" as "+getAlias();
036            }
037    
038            /**
039             * @return the exp
040             */
041            public Expression getExp() {
042                    return exp;
043            }
044    
045            /**
046             * @return the left
047             */
048            public Expression getLeft() {
049                    return left;
050            }
051    
052            /**
053             * @return the operator
054             */
055            public int getOperator() {
056                    return operator;
057            }
058    
059            /**
060             * @return the right
061             */
062            public Expression getRight() {
063                    return right;
064            }
065    }