File tree Expand file tree Collapse file tree 4 files changed +20
-4
lines changed
java/net/sf/jsqlparser/expression
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/test/update Expand file tree Collapse file tree 4 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ Also I would like to know about needed examples or documentation stuff.
44
44
45
45
## Extensions in the latest SNAPSHOT version 1.2
46
46
47
+ * support for bitwise not ** ~ **
47
48
* support for ** drop view**
48
49
* support for indexed JDBC parameters at multiple places
49
50
* allowed ** index** as object name
Original file line number Diff line number Diff line change 24
24
import net .sf .jsqlparser .parser .ASTNodeAccessImpl ;
25
25
26
26
/**
27
- * It represents a "-" or "+" before an expression
27
+ * It represents a "-" or "+" or "~" before an expression
28
28
*/
29
29
public class SignedExpression extends ASTNodeAccessImpl implements Expression {
30
30
@@ -42,8 +42,8 @@ public char getSign() {
42
42
43
43
public final void setSign (char sign ) {
44
44
this .sign = sign ;
45
- if (sign != '+' && sign != '-' ) {
46
- throw new IllegalArgumentException ("illegal sign character, only + - allowed" );
45
+ if (sign != '+' && sign != '-' && sign != '~' ) {
46
+ throw new IllegalArgumentException ("illegal sign character, only + - ~ allowed" );
47
47
}
48
48
}
49
49
Original file line number Diff line number Diff line change @@ -2420,7 +2420,7 @@ Expression PrimaryExpression() #PrimaryExpression:
2420
2420
ColDataType type = null;
2421
2421
}
2422
2422
{
2423
- [sign="+" | sign="-"]
2423
+ [sign="+" | sign="-" | sign="~" ]
2424
2424
(
2425
2425
<K_NULL> { retval = new NullValue(); }
2426
2426
Original file line number Diff line number Diff line change @@ -116,4 +116,19 @@ public void testUpdateWithFunctions() throws JSQLParserException {
116
116
public void testUpdateIssue508LeftShift () throws JSQLParserException {
117
117
assertSqlCanBeParsedAndDeparsed ("UPDATE user SET num = 1 << 1 WHERE id = 1" );
118
118
}
119
+
120
+ @ Test
121
+ public void testUpdateIssue338 () throws JSQLParserException {
122
+ assertSqlCanBeParsedAndDeparsed ("UPDATE mytable SET status = (status & ~1)" );
123
+ }
124
+
125
+ @ Test
126
+ public void testUpdateIssue338_1 () throws JSQLParserException {
127
+ assertSqlCanBeParsedAndDeparsed ("UPDATE mytable SET status = (status & 1)" );
128
+ }
129
+
130
+ @ Test
131
+ public void testUpdateIssue338_2 () throws JSQLParserException {
132
+ assertSqlCanBeParsedAndDeparsed ("UPDATE mytable SET status = (status + 1)" );
133
+ }
119
134
}
You can’t perform that action at this time.
0 commit comments