Title: cross join不能成功转换 · Issue #7 · sqlparser/gsp_demo_java · GitHub
Open Graph Title: cross join不能成功转换 · Issue #7 · sqlparser/gsp_demo_java
X Title: cross join不能成功转换 · Issue #7 · sqlparser/gsp_demo_java
Description: 当cross join关联多个表的时候,不能成功转换。 test case: Select * from table_c as v cross join table_b, table_c 转换后: Select * from table_c as v cross join table_b, table_c 查看源码发现: private boolean hasJoin( TJoinList joins ) { if ( joins == null ) return fa...
Open Graph Description: 当cross join关联多个表的时候,不能成功转换。 test case: Select * from table_c as v cross join table_b, table_c 转换后: Select * from table_c as v cross join table_b, table_c 查看源码发现: private boolean hasJoin( TJoinList ...
X Description: 当cross join关联多个表的时候,不能成功转换。 test case: Select * from table_c as v cross join table_b, table_c 转换后: Select * from table_c as v cross join table_b, table_c 查看源码发现: private boolean hasJoin( TJoinList ...
Opengraph URL: https://github.com/sqlparser/gsp_demo_java/issues/7
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"cross join不能成功转换","articleBody":"当cross join关联多个表的时候,不能成功转换。\r\ntest case:\r\nSelect * from table_c as v cross join table_b, table_c\r\n转换后:\r\nSelect * from table_c as v cross join table_b, table_c\r\n\r\n\r\n查看源码发现:\r\n````\r\nprivate boolean hasJoin( TJoinList joins )\r\n\t{\r\n\t\tif ( joins == null )\r\n\t\t\treturn false;\r\n\t\tfor ( int i = 0; i \u003c joins.size( ); i++ )\r\n\t\t{\r\n\t\t\tif ( joins.getJoin( i ).getJoinItems( ) != null\r\n\t\t\t\t\t\u0026\u0026 joins.getJoin( i ).getJoinItems( ).size( ) \u003e 0 )\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n````\r\n当cross join关联表的时候, joins.getJoin( i ).getJoinItems( )不为null,并且size大于0直接返回了true,导致没有进入cross join的转换方法中,但是cross join的getJoinItems( )实际上应该为null,因为joins.getJoin(i).getJoinItems().getJoinItem(j).toString()为null,cross join的hasJoin校验应该为false,缺少这一步判断,所以会导致直接不能转换,修改源码为:\r\n````\r\nprivate boolean hasJoin(TJoinList joins) {\r\n if (joins == null)\r\n return false;\r\n for (int i = 0; i \u003c joins.size(); i++) {\r\n TJoinItemList joinItems = joins.getJoin(i).getJoinItems();\r\n if (null != joinItems \u0026\u0026 joinItems.size() \u003e 0) {\r\n for (int j = 0; j \u003c joinItems.size(); j++) {\r\n if (null == joinItems.getJoinItem(j).toString()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n````\r\n即可。","author":{"url":"https://github.com/CembZy","@type":"Person","name":"CembZy"},"datePublished":"2020-06-29T07:17:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/7/gsp_demo_java/issues/7"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5b9be6de-68f6-03c1-ecca-f5b7f0e5618e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95A4:42DE3:24F0DDE:2F18D8C:6975EF9D |
| html-safe-nonce | 32a54add961f84959cf4649b00c77288ec558d4676b7ec98b0ce1eb7c23a14a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUE0OjQyREUzOjI0RjBEREU6MkYxOEQ4Qzo2OTc1RUY5RCIsInZpc2l0b3JfaWQiOiIzNjgwNTgwODAzMTI2MjI2ODQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 12d5f16a600f4dda5190f0473d7792d72c081e192580370928b6dbd2492741f3 |
| hovercard-subject-tag | issue:647177781 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlparser/gsp_demo_java/7/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fcdcdd62eeb4cd5a28d6c92c97a6a80db08e12d7a0a2096c7dc55550953c1b6b/sqlparser/gsp_demo_java/issues/7 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fcdcdd62eeb4cd5a28d6c92c97a6a80db08e12d7a0a2096c7dc55550953c1b6b/sqlparser/gsp_demo_java/issues/7 |
| og:image:alt | 当cross join关联多个表的时候,不能成功转换。 test case: Select * from table_c as v cross join table_b, table_c 转换后: Select * from table_c as v cross join table_b, table_c 查看源码发现: private boolean hasJoin( TJoinList ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CembZy |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2bce766e7450b03e00b2fc5badd417927ce33a860e78cda3e4ecb9bbd1374cc6 |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlparser/gsp_demo_java git https://github.com/sqlparser/gsp_demo_java.git |
| octolytics-dimension-user_id | 1305435 |
| octolytics-dimension-user_login | sqlparser |
| octolytics-dimension-repository_id | 206196892 |
| octolytics-dimension-repository_nwo | sqlparser/gsp_demo_java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 206196892 |
| octolytics-dimension-repository_network_root_nwo | sqlparser/gsp_demo_java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fcca2b8ef702b5f7f91427a6e920fa44446fe312 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width