mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正运算符优先级别处理不当的问题
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@156 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -15,51 +15,66 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.ast.expr;
|
||||
|
||||
/**
|
||||
*
|
||||
* 二元操作符
|
||||
* @author wenshao 2011-5-20 下午12:32:02
|
||||
* @formatter:off
|
||||
*/
|
||||
public enum SQLBinaryOperator {
|
||||
Add("+", 70), Subtract("-", 70), Multiply("*", 60), Divide("/", 60), Concat("||", 140), BitwiseAnd("&", 90), BitwiseNot("!", 130), BitwiseOr("|", 100),
|
||||
BitwiseXor("^", 50), BooleanAnd("AND", 140), BooleanOr("OR", 160), BooleanXor("XOR", 150), Equality("=", 170), Assignment(":=", 169),
|
||||
GreaterThan(">", 110), GreaterThanOrEqual(">=", 110), Is("IS", 110), LessThan("<", 110), LessThanOrEqual("<=", 110), LessThanOrEqualOrGreaterThan("<=>",
|
||||
110),
|
||||
LessThanOrGreater("<>", 110), LeftShift("<<", 80), Like("LIKE", 110), RightShift(">>", 80), Modulus("%", 60), NotEqual("!=", 110), NotLessThan("!<", 110),
|
||||
NotGreaterThan("!>", 110), Union("UNION", 0), NotLike("NOT LIKE", 110), IsNot("IS NOT", 110), Escape("ESCAPE", 110), RegExp("REGEXP", 110),
|
||||
NotRegExp("NOT REGEXP", 110), COLLATE("COLLATE", 20);
|
||||
Union("UNION", 0),
|
||||
COLLATE("COLLATE", 20),
|
||||
BitwiseXor("^", 50),
|
||||
|
||||
Multiply("*", 60),
|
||||
Divide("/", 60),
|
||||
Modulus("%", 60),
|
||||
|
||||
Add("+", 70),
|
||||
Subtract("-", 70),
|
||||
|
||||
LeftShift("<<", 80),
|
||||
RightShift(">>", 80),
|
||||
|
||||
BitwiseAnd("&", 90),
|
||||
BitwiseOr("|", 100),
|
||||
|
||||
GreaterThan(">", 110),
|
||||
GreaterThanOrEqual(">=", 110),
|
||||
Is("IS", 110),
|
||||
LessThan("<", 110),
|
||||
LessThanOrEqual("<=", 110),
|
||||
LessThanOrEqualOrGreaterThan("<=>",110),
|
||||
LessThanOrGreater("<>", 110),
|
||||
Like("LIKE", 110),
|
||||
NotEqual("!=", 110),
|
||||
NotLessThan("!<", 110),
|
||||
NotGreaterThan("!>", 110),
|
||||
NotLike("NOT LIKE", 110),
|
||||
IsNot("IS NOT", 110),
|
||||
Escape("ESCAPE", 110),
|
||||
RegExp("REGEXP", 110),
|
||||
NotRegExp("NOT REGEXP", 110),
|
||||
Equality("=", 110),
|
||||
|
||||
BitwiseNot("!", 130),
|
||||
Concat("||", 140),
|
||||
|
||||
BooleanAnd("AND", 140),
|
||||
BooleanXor("XOR", 150),
|
||||
BooleanOr("OR", 160),
|
||||
Assignment(":=", 169),
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static int getPriority(SQLBinaryOperator operator) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// public static final int Add = 0;
|
||||
// public static final int Subtract = 26;
|
||||
// public static final int Multiply = 22;
|
||||
// public static final int Divide = 9;
|
||||
// public static final int Concat = 42;
|
||||
// public static final int Assign = 2;
|
||||
// public static final int BitwiseAnd = 3;
|
||||
// public static final int BitwiseNot = 4;
|
||||
// public static final int BitwiseOr = 5;
|
||||
// public static final int BitwiseXor = 6;
|
||||
// public static final int BooleanAnd = 7;
|
||||
// public static final int BooleanOr = 8;
|
||||
// public static final int Equality = 10;
|
||||
// public static final int GreaterThan = 11;
|
||||
// public static final int GreaterThanOrEqual = 12;
|
||||
// public static final int Is = 13;
|
||||
// public static final int LessThan = 14;
|
||||
// public static final int LessThanOrEqual = 15;
|
||||
// public static final int LessThanOrGreater = 16;
|
||||
// public static final int LeftShift = 17;
|
||||
// public static final int Like = 18;
|
||||
// public static final int RightShift = 19;
|
||||
// public static final int Modulus = 21;
|
||||
// public static final int NotEqual = 23;
|
||||
// public static final int NotLessThan = 24;
|
||||
// public static final int NotGreaterThan = 25;
|
||||
// public static final int Union = 27;
|
||||
// public static final int NotLike = 40;
|
||||
// public static final int IsNot = 41;
|
||||
// public static final int Escape = 43;
|
||||
//
|
||||
|
||||
public final String name;
|
||||
public final int priority;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user