-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Reichel <[email protected]>
- Loading branch information
1 parent
eb7e1b8
commit 45c7ef0
Showing
8 changed files
with
1,449 additions
and
1,449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
252 changes: 126 additions & 126 deletions
252
src/main/java/net/sf/jsqlparser/expression/operators/relational/LikeExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,126 @@ | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.expression.BinaryExpression; | ||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.expression.ExpressionVisitor; | ||
|
||
public class LikeExpression extends BinaryExpression { | ||
private boolean not = false; | ||
private boolean useBinary = false; | ||
private Expression escapeExpression = null; | ||
private KeyWord likeKeyWord = KeyWord.LIKE; | ||
|
||
public boolean isNot() { | ||
return not; | ||
} | ||
|
||
public void setNot(boolean b) { | ||
not = b; | ||
} | ||
|
||
public boolean isUseBinary() { | ||
return useBinary; | ||
} | ||
|
||
public LikeExpression setUseBinary(boolean useBinary) { | ||
this.useBinary = useBinary; | ||
return this; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public String getStringExpression() { | ||
return likeKeyWord.toString(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String retval = getLeftExpression() + " " + (not ? "NOT " : "") | ||
+ (likeKeyWord == KeyWord.SIMILAR_TO ? "SIMILAR TO" : likeKeyWord) + " " | ||
+ (useBinary ? "BINARY " : "") + getRightExpression(); | ||
if (escapeExpression != null) { | ||
retval += " ESCAPE " + escapeExpression; | ||
} | ||
return retval; | ||
} | ||
|
||
public Expression getEscape() { | ||
return escapeExpression; | ||
} | ||
|
||
public void setEscape(Expression escapeExpression) { | ||
this.escapeExpression = escapeExpression; | ||
} | ||
|
||
@Deprecated | ||
public boolean isCaseInsensitive() { | ||
return likeKeyWord == KeyWord.ILIKE; | ||
} | ||
|
||
@Deprecated | ||
public void setCaseInsensitive(boolean caseInsensitive) { | ||
this.likeKeyWord = KeyWord.ILIKE; | ||
} | ||
|
||
public KeyWord getLikeKeyWord() { | ||
return likeKeyWord; | ||
} | ||
|
||
public LikeExpression setLikeKeyWord(KeyWord likeKeyWord) { | ||
this.likeKeyWord = likeKeyWord; | ||
return this; | ||
} | ||
|
||
public LikeExpression setLikeKeyWord(String likeKeyWord) { | ||
this.likeKeyWord = KeyWord.from(likeKeyWord); | ||
return this; | ||
} | ||
|
||
public LikeExpression withEscape(Expression escape) { | ||
this.setEscape(escape); | ||
return this; | ||
} | ||
|
||
@Deprecated | ||
public LikeExpression withCaseInsensitive(boolean caseInsensitive) { | ||
this.setCaseInsensitive(caseInsensitive); | ||
return this; | ||
} | ||
|
||
public LikeExpression withNot(boolean not) { | ||
this.setNot(not); | ||
return this; | ||
} | ||
|
||
@Override | ||
public LikeExpression withLeftExpression(Expression arg0) { | ||
return (LikeExpression) super.withLeftExpression(arg0); | ||
} | ||
|
||
@Override | ||
public LikeExpression withRightExpression(Expression arg0) { | ||
return (LikeExpression) super.withRightExpression(arg0); | ||
} | ||
|
||
public enum KeyWord { | ||
LIKE, ILIKE, RLIKE, REGEXP_LIKE, REGEXP, SIMILAR_TO; | ||
|
||
public static KeyWord from(String keyword) { | ||
return Enum.valueOf(KeyWord.class, keyword.toUpperCase().replaceAll("\\s+", "_")); | ||
} | ||
} | ||
} | ||
/*- | ||
* #%L | ||
* JSQLParser library | ||
* %% | ||
* Copyright (C) 2004 - 2019 JSQLParser | ||
* %% | ||
* Dual licensed under GNU LGPL 2.1 or Apache License 2.0 | ||
* #L% | ||
*/ | ||
package net.sf.jsqlparser.expression.operators.relational; | ||
|
||
import net.sf.jsqlparser.expression.BinaryExpression; | ||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.expression.ExpressionVisitor; | ||
|
||
public class LikeExpression extends BinaryExpression { | ||
private boolean not = false; | ||
private boolean useBinary = false; | ||
private Expression escapeExpression = null; | ||
private KeyWord likeKeyWord = KeyWord.LIKE; | ||
|
||
public boolean isNot() { | ||
return not; | ||
} | ||
|
||
public void setNot(boolean b) { | ||
not = b; | ||
} | ||
|
||
public boolean isUseBinary() { | ||
return useBinary; | ||
} | ||
|
||
public LikeExpression setUseBinary(boolean useBinary) { | ||
this.useBinary = useBinary; | ||
return this; | ||
} | ||
|
||
@Override | ||
public <T, S> T accept(ExpressionVisitor<T> expressionVisitor, S context) { | ||
return expressionVisitor.visit(this, context); | ||
} | ||
|
||
@Deprecated | ||
@Override | ||
public String getStringExpression() { | ||
return likeKeyWord.toString(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String retval = getLeftExpression() + " " + (not ? "NOT " : "") | ||
+ (likeKeyWord == KeyWord.SIMILAR_TO ? "SIMILAR TO" : likeKeyWord) + " " | ||
+ (useBinary ? "BINARY " : "") + getRightExpression(); | ||
if (escapeExpression != null) { | ||
retval += " ESCAPE " + escapeExpression; | ||
} | ||
return retval; | ||
} | ||
|
||
public Expression getEscape() { | ||
return escapeExpression; | ||
} | ||
|
||
public void setEscape(Expression escapeExpression) { | ||
this.escapeExpression = escapeExpression; | ||
} | ||
|
||
@Deprecated | ||
public boolean isCaseInsensitive() { | ||
return likeKeyWord == KeyWord.ILIKE; | ||
} | ||
|
||
@Deprecated | ||
public void setCaseInsensitive(boolean caseInsensitive) { | ||
this.likeKeyWord = KeyWord.ILIKE; | ||
} | ||
|
||
public KeyWord getLikeKeyWord() { | ||
return likeKeyWord; | ||
} | ||
|
||
public LikeExpression setLikeKeyWord(KeyWord likeKeyWord) { | ||
this.likeKeyWord = likeKeyWord; | ||
return this; | ||
} | ||
|
||
public LikeExpression setLikeKeyWord(String likeKeyWord) { | ||
this.likeKeyWord = KeyWord.from(likeKeyWord); | ||
return this; | ||
} | ||
|
||
public LikeExpression withEscape(Expression escape) { | ||
this.setEscape(escape); | ||
return this; | ||
} | ||
|
||
@Deprecated | ||
public LikeExpression withCaseInsensitive(boolean caseInsensitive) { | ||
this.setCaseInsensitive(caseInsensitive); | ||
return this; | ||
} | ||
|
||
public LikeExpression withNot(boolean not) { | ||
this.setNot(not); | ||
return this; | ||
} | ||
|
||
@Override | ||
public LikeExpression withLeftExpression(Expression arg0) { | ||
return (LikeExpression) super.withLeftExpression(arg0); | ||
} | ||
|
||
@Override | ||
public LikeExpression withRightExpression(Expression arg0) { | ||
return (LikeExpression) super.withRightExpression(arg0); | ||
} | ||
|
||
public enum KeyWord { | ||
LIKE, ILIKE, RLIKE, REGEXP_LIKE, REGEXP, SIMILAR_TO; | ||
|
||
public static KeyWord from(String keyword) { | ||
return Enum.valueOf(KeyWord.class, keyword.toUpperCase().replaceAll("\\s+", "_")); | ||
} | ||
} | ||
} |
Oops, something went wrong.