-
Notifications
You must be signed in to change notification settings - Fork 6
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
Multi statement mode doesn't handle procedures correctly #28
Comments
Hey @arvidfm, looks like using the I'm currently working on implementing |
Hi @arvidfm – James is out of the office for some time off for the next few weeks, so I'm picking up the rest of this one. I've got a very rough prototype working that adds support for the Thanks for the great feature request on this one! |
@fulghum Thanks for the update! Looking forward to it, it'll make Dolt integration a lot easier for us. Let me know if/once you have something you'd like me to try out and I'd be happy to jump on it. |
Hi @arvidfm, sorry for the delay on the update here... as I did more testing with my initial implementation, I realized there were some behavioral differences between it and the MySQL driver implementation, so I've spent some time digging in to the MySQL driver and I've pushed a new implementation that should behave more similarly. I'm still wrapping up some new tests for some of the MySQL driver behavior I found and I'm cleaning up some sample code, but if you'd like to give this implementation an early test drive, you can pull it from the |
@fulghum I gave it a spin, and from my preliminary testing it seems to work perfectly with our migrations, with the exception of one minor issue: If the query string contains a comment that's not followed by any further statements, you get an SELECT 1;
# comment not followed by statements This doesn't seem to be an issue when connecting to a Dolt server using the MySQL driver. |
Awesome! Thanks for such a fast turn around on some early testing help. 🙏 Good find on the case with the trailing comment. I will add that to my testing today and get that case working, too. |
Yesterday I added support for skipping over empty statements and some test coverage for that, too. I added a bunch more tests, and also hooked up the tests so that they can run against a MySQL DB using the MySQL driver, so that we can easily test that the Dolt driver has the same behavior as the MySQL driver. There was one last behavior difference that was bugging me... the MySQL driver will automatically skip over non-query result sets (e.g. if a multi-statement query contains an When you get a chance, feel free to try out the latest code on the Thanks again for the great feature request here. This was a fun one to work on, and will make the Dolt driver easier to use and more compatible with the MySQL driver. |
@fulghum Gave it a whirl, I also had it run against a MySQL server using the MySQL driver in tandem and compared the results (number of result sets returned, number of results, column names, result values etc), and everything seems to work perfectly! The only difference my comparison program even picked up is that the MySQL driver apparently returns strings as |
Awesome! 🎉 Thanks again for the help with the acceptance testing. I've merged in support for querying multiple result sets through the Feel free to let us know if you hit any snags or have other feature requests for us. Thanks for being a Dolt customer! 🙏 |
Amazing, thank you so much! |
The driver naively splits multi-statement queries by
;
, which doesn't match how Vitess and GMS process the queries: In particular, procedure definitions are not parsed as a single statement, andDELIMITER
statements are not respected.Additionally, the driver processes multi-statement queries by executing the statements directly in
Prepare
, which is unexpected behaviour.Demonstration of the issue; the below yields the error
Error 1105: syntax error at position 42 near '1'
when running the last query, but works correctly if connecting to a Dolt server using the MySQL driver:I had a quick look at it myself, but it wasn't obvious what the best approach would be - perhaps the easiest would be to implement
ExecContext
andQueryContext
and move the multi-statement processing there, maybe usingMysqlParser
from GMS to split the queries and callingQueryWithBindings
for each, if prepared multi-statement queries aren't a requirement? (They don't seem to be supported by MySQL anyway.) Would be nice if the result also implementeddriver.RowsNextResultSet
.The text was updated successfully, but these errors were encountered: