-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
db.mysql: Add the exec family of methods #19132
Conversation
I guess I just need some help setting up the MySQL connection in the new test file. I tried to copy what was in the ORM test but I guess that didn't work. |
…using a docker container
Sorry, it is a deficiency in our current testing/CI setup, since we do not start external services like PostgreSQL or MySQL, the corresponding tests are skipped and not run. They can be run locally with: |
I'll think about a better setup, so that all the DB tests including the PostgreSQL and MySQL ones, are run on the CI, in at least one job. |
Thank you for the review and collaboration @spytheman |
As discussed in: #19098
This change adds
exec
,exec_one
,exec_none
,exec_param_many
, andexec_param
to db.mysql. These methods serve as simple abstractions on top of db.mysql returning values that the user can directly interact with.The purpose is to get a more consistent API across all of the db modules, which should allow the user to transition between databases with little change needed to the code (outside of setting up and closing a connection).
Each method (excluding
exec_none
) with either return row(s) or an error, which is consistent with other db modules. Rows are arrays of strings, representing each column in order.🤖 Generated by Copilot at 6655507
This pull request adds support for parameterized queries in the
mysql
module. It implements new methods for theDB
struct that use the C MySQL API to execute and fetch queries with or without parameters. It also adds a test function to themysql_test.v
file that checks the correctness and consistency of the new methods.🤖 Generated by Copilot at 6655507
DB
struct for executing parameterized queries and returning different types of results (link)mysql_test.v
that creates a temporary table, inserts data, and executes various queries using the new methods, asserting correctness and consistency (link)