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.
4444
4545## Extensions in the latest SNAPSHOT version 1.2
4646
47+ * support for bitwise not ** ~ **
4748* support for ** drop view**
4849* support for indexed JDBC parameters at multiple places
4950* allowed ** index** as object name
Original file line number Diff line number Diff line change 2424import net .sf .jsqlparser .parser .ASTNodeAccessImpl ;
2525
2626/**
27- * It represents a "-" or "+" before an expression
27+ * It represents a "-" or "+" or "~" before an expression
2828 */
2929public class SignedExpression extends ASTNodeAccessImpl implements Expression {
3030
@@ -42,8 +42,8 @@ public char getSign() {
4242
4343 public final void setSign (char sign ) {
4444 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" );
4747 }
4848 }
4949
Original file line number Diff line number Diff line change @@ -2420,7 +2420,7 @@ Expression PrimaryExpression() #PrimaryExpression:
24202420 ColDataType type = null;
24212421}
24222422{
2423- [sign="+" | sign="-"]
2423+ [sign="+" | sign="-" | sign="~" ]
24242424(
24252425 <K_NULL> { retval = new NullValue(); }
24262426
Original file line number Diff line number Diff line change @@ -116,4 +116,19 @@ public void testUpdateWithFunctions() throws JSQLParserException {
116116 public void testUpdateIssue508LeftShift () throws JSQLParserException {
117117 assertSqlCanBeParsedAndDeparsed ("UPDATE user SET num = 1 << 1 WHERE id = 1" );
118118 }
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+ }
119134}
You can’t perform that action at this time.
0 commit comments