-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: support AST to SQL text #56
Conversation
PTAL @GregoryIan @tiancaiamao |
It'll be nice if you can create an issue in the tidb repo to trace the process of this task. This can be referred. pingcap/tidb#7623 |
@kennytm PTAL again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tiancaiamao PTAL again, I moved |
PTAL @tiancaiamao @zz-jason |
If there are still some comments not addressed and you think they should be addressed, please do not comment a "LGTM" @tiancaiamao How about using the visitor model? Implement a visitor visits the AST tree, complement the sql during the traverse? Thus we don't need to introduce a |
I have considered this way, it's hard to implement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Restore
interface is necessary to implement AST to SQL
Maybe we can add a method to Node
, rather than define a Restorable
interface.
Got it! |
some struct which isn't a Node need implement Restorable too, such as DatabaseOption |
Using embed interface , you still need to implement So what's the difference if you define Node like this ?
|
And if you define the
|
LGTM |
PTAL @zz-jason @tiancaiamao |
# Conflicts: # parser_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(rest LGTM)
* ast2sql demo * add SQLSentence * mock func Restore * change copyright * add comment * add test * change tidb dependentment * fix error comment * use strings.Builder * fix test * add error return value for Recoverable * add error return value for Recoverable * add error return value for Recoverable * impl Restore of UnaryOperationExpr * integrate utils * switch tidb dependency * add comment * add comment * update unit test * fix Restore of DatabaseOption * fix Restore of DatabaseOption * fix Restore of DatabaseOption * update unit test * use errorf
* ast2sql demo * add SQLSentence * mock func Restore * change copyright * add comment * add test * change tidb dependentment * fix error comment * use strings.Builder * fix test * add error return value for Recoverable * add error return value for Recoverable * add error return value for Recoverable * impl Restore of UnaryOperationExpr * integrate utils * switch tidb dependency * add comment * add comment * update unit test * fix Restore of DatabaseOption * fix Restore of DatabaseOption * fix Restore of DatabaseOption * update unit test * use errorf
1、add Recoverable interface
2、add Recoverable implement example(CreateDatabaseStmt,DropDatabaseStmt,UnaryOperationExpr)
3、add stmt Recoverable test frame
4、replace the tidb dependency to github.com/leoppro/tidb temporarily,
github.com/leoppro/tidb forked from pingcap/tidb and impl the Recoverable interface for ValueExpr and ParamMarkerExpr, when it is stable,i will pull it to pingcap/tidb