Skip to content
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

Roughest implementation of stored procedures #306

Merged
merged 1 commit into from Feb 22, 2021

Conversation

Hydrocharged
Copy link
Contributor

No need to go into detail regarding what doesn't work (a lot), but it's groundwork to iterate on.

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks quite good. Still missing a lot obviously but this is a good start to build on and you should get it in.

@@ -78,6 +79,7 @@ var OnceAfterDefault = []Rule{
{"resolve_insert_rows", resolveInsertRows},
{"apply_triggers", applyTriggers},
{"apply_row_update_accumulators", applyUpdateAccumulators},
{"apply_procedures", applyProcedures},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like in general you need to this come before the row update accumulator step (but I'm not sure how MySQL reports row update stats for CALL statements)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So looking into this a bit more...wow MySQL does some strange stuff here. Basically for INSERT, UPDATE, & DELETE, it only looks at the last statement and returns that. However, if you have a SELECT anywhere, then that is returned instead. But if you have multiple SELECTs, then they are all returned. Testing around, it seems that not all MySQL clients even support multiple result sets from a query, so they just return the last SELECT, but others will return each one.

sql/analyzer/stored_procedures.go Show resolved Hide resolved
sql/plan/call.go Show resolved Hide resolved
@Hydrocharged Hydrocharged force-pushed the daylon/stored-procedures branch 2 times, most recently from 40821d7 to 95159c8 Compare February 22, 2021 04:56
@Hydrocharged Hydrocharged merged commit e994b98 into master Feb 22, 2021
@Hydrocharged Hydrocharged deleted the daylon/stored-procedures branch February 22, 2021 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants