|
| 1 | +/* |
| 2 | + * Copyright © 2021-present Arcade Data Ltd (info@arcadedata.com) |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + * SPDX-FileCopyrightText: 2021-present Arcade Data Ltd (info@arcadedata.com) |
| 17 | + * SPDX-License-Identifier: Apache-2.0 |
| 18 | + */ |
| 19 | +/* Generated By:JJTree: Do not edit this line. OLikeOperator.java Version 4.3 */ |
| 20 | +/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_USERTYPE_VISIBILITY_PUBLIC=true */ |
| 21 | +package com.arcadedb.query.sql.parser; |
| 22 | + |
| 23 | +import com.arcadedb.database.DatabaseInternal; |
| 24 | +import com.arcadedb.query.sql.executor.MultiValue; |
| 25 | +import com.arcadedb.query.sql.executor.QueryHelper; |
| 26 | + |
| 27 | +public class ILikeOperator extends SimpleNode implements BinaryCompareOperator { |
| 28 | + public ILikeOperator(final int id) { |
| 29 | + super(id); |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public boolean execute(final DatabaseInternal database, final Object iLeft, final Object iRight) { |
| 34 | + if (MultiValue.isMultiValue(iLeft) || MultiValue.isMultiValue(iRight)) |
| 35 | + return false; |
| 36 | + |
| 37 | + if (iLeft == null || iRight == null) { |
| 38 | + return false; |
| 39 | + } |
| 40 | + return QueryHelper.like(iLeft.toString().toLowerCase(), iRight.toString().toLowerCase()); |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public String toString() { |
| 45 | + return "ILIKE"; |
| 46 | + } |
| 47 | + |
| 48 | + @Override |
| 49 | + public ILikeOperator copy() { |
| 50 | + return this; |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + public boolean equals(final Object obj) { |
| 55 | + return obj != null && obj.getClass().equals(this.getClass()); |
| 56 | + } |
| 57 | + |
| 58 | + @Override |
| 59 | + public int hashCode() { |
| 60 | + return getClass().hashCode(); |
| 61 | + } |
| 62 | +} |
| 63 | +/* JavaCC - OriginalChecksum=16d302abf0f85b404e57b964606952ca (do not edit this line) */ |
0 commit comments