File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed
jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement/insert Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,10 @@ public String toString() {
255255 if (columns != null ) {
256256 sql .append (PlainSelect .getStringList (columns , true , true )).append (" " );
257257 }
258+
259+ if (outputClause !=null ) {
260+ sql .append (outputClause .toString ());
261+ }
258262
259263 if (select != null ) {
260264 sql .append (select );
Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ public void deParse(Insert insert) {
7676 }
7777 buffer .append (")" );
7878 }
79+
80+ if (insert .getOutputClause () != null ) {
81+ buffer .append (insert .getOutputClause ().toString ());
82+ }
7983
8084 if (insert .getSelect () != null ) {
8185 buffer .append (" " );
Original file line number Diff line number Diff line change @@ -1821,14 +1821,9 @@ Select SelectWithWithItems( ):
18211821 List<WithItem> with = null;
18221822}
18231823{
1824- // LOOKAHEAD(2) (
1825- // "(" with=WithList() select = Select( with ) ")" { select.withUsingWithBrackets(true); }
1826- //)
1827- //|
1828- //(
1829- [ with=WithList() ]
1830- select = Select( with )
1831- //)
1824+ (LOOKAHEAD(2) ( "(" with=WithList() select = Select( with ) ")" { select.withUsingWithBrackets(true); } )
1825+ |
1826+ ( [with=WithList()] select = Select( with ) ))
18321827 {
18331828 return select;
18341829 }
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ public void testInsertSelect() throws JSQLParserException {
254254 @ Test
255255 public void testInsertWithSelect () throws JSQLParserException {
256256 assertSqlCanBeParsedAndDeparsed ("INSERT INTO mytable (mycolumn) WITH a AS (SELECT mycolumn FROM mytable) SELECT mycolumn FROM a" , true );
257- // assertSqlCanBeParsedAndDeparsed("INSERT INTO mytable (mycolumn) (WITH a AS (SELECT mycolumn FROM mytable) SELECT mycolumn FROM a)", true);
257+ assertSqlCanBeParsedAndDeparsed ("INSERT INTO mytable (mycolumn) (WITH a AS (SELECT mycolumn FROM mytable) SELECT mycolumn FROM a)" , true );
258258 }
259259
260260 @ Test
@@ -446,7 +446,7 @@ public void testInsertUnionSelectIssue1491() throws JSQLParserException {
446446 );
447447 }
448448
449- // @Test
449+ @ Test
450450 public void testInsertOutputClause () throws JSQLParserException {
451451 assertSqlCanBeParsedAndDeparsed (
452452 "INSERT INTO dbo.EmployeeSales (LastName, FirstName, CurrentSales) \n " +
You can’t perform that action at this time.
0 commit comments