File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/java/net/sf/jsqlparser/schema
test/java/net/sf/jsqlparser/schema Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,12 @@ private void setIndex(int idx, String value) {
102102 for (int i = 0 ; i < idx - size + 1 ; i ++) {
103103 partItems .add (null );
104104 }
105- partItems .set (idx , value );
105+
106+ if (value == null && idx == partItems .size () - 1 ) {
107+ partItems .remove (idx );
108+ } else {
109+ partItems .set (idx , value );
110+ }
106111 }
107112
108113 private String getIndex (int idx ) {
Original file line number Diff line number Diff line change 1515import net .sf .jsqlparser .statement .select .Select ;
1616import net .sf .jsqlparser .util .deparser .ExpressionDeParser ;
1717import net .sf .jsqlparser .util .deparser .SelectDeParser ;
18+ import static org .assertj .core .api .Assertions .assertThat ;
1819import static org .junit .Assert .assertEquals ;
1920import org .junit .Test ;
2021
@@ -62,4 +63,12 @@ public void visit(Table tableName) {
6263 deparser .visit ((PlainSelect ) select .getSelectBody ());
6364
6465 }
66+
67+ @ Test
68+ public void testTableRemoveNameParts () {
69+ Table table = new Table ("link" , "DICTIONARY" );
70+ assertThat (table .getFullyQualifiedName ()).isEqualTo ("link.DICTIONARY" );
71+ table .setSchemaName (null );
72+ assertThat (table .getFullyQualifiedName ()).isEqualTo ("DICTIONARY" );
73+ }
6574}
You can’t perform that action at this time.
0 commit comments