File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
main/java/net/sf/jsqlparser/expression/operators/relational
test/java/net/sf/jsqlparser/expression Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public IsNullExpression(Expression leftExpression) {
2929
3030 public IsNullExpression (String columnName , boolean not ) {
3131 this .leftExpression = new Column (columnName );
32- this .not = useNotNull ;
32+ this .not = not ;
3333 }
3434
3535 public Expression getLeftExpression () {
Original file line number Diff line number Diff line change 1+ package net .sf .jsqlparser .expression ;
2+
3+ import net .sf .jsqlparser .JSQLParserException ;
4+ import net .sf .jsqlparser .schema .Column ;
5+ import net .sf .jsqlparser .statement .select .PlainSelect ;
6+ import net .sf .jsqlparser .statement .select .SelectItem ;
7+ import net .sf .jsqlparser .test .TestUtils ;
8+ import org .junit .jupiter .api .Test ;
9+
10+ import static org .junit .jupiter .api .Assertions .*;
11+
12+ class ArrayExpressionTest {
13+
14+ @ Test
15+ void testColumnArrayExpression () throws JSQLParserException {
16+ String sqlStr = "SELECT a[2+1] AS a" ;
17+ PlainSelect select = (PlainSelect ) TestUtils .assertSqlCanBeParsedAndDeparsed (sqlStr , true );
18+ SelectItem <?> selectItem = select .getSelectItem (0 );
19+
20+ Column column = selectItem .getExpression (Column .class );
21+ assertInstanceOf (ArrayConstructor .class , column .getArrayConstructor ());
22+ }
23+
24+ }
Original file line number Diff line number Diff line change @@ -20,4 +20,10 @@ void testNotNullExpression() throws JSQLParserException {
2020 String sqlStr = "select * from mytable where 1 notnull" ;
2121 TestUtils .assertSqlCanBeParsedAndDeparsed (sqlStr , true );
2222 }
23+
24+ @ Test
25+ void testStringConstructor () {
26+ IsNullExpression isNullExpression = new IsNullExpression ("x" , true );
27+ TestUtils .assertExpressionCanBeDeparsedAs (isNullExpression , "x IS NOT NULL" );
28+ }
2329}
You can’t perform that action at this time.
0 commit comments