aa6d61477e
VAULT-5827 Don't prepare SQL queries before executing them We don't support proper prepared statements, i.e., preparing once and executing many times since we do our own templating. So preparing our queries does not really accomplish anything, and can have severe performance impacts (see https://github.com/hashicorp/vault-plugin-database-snowflake/issues/13 for example). This behavior seems to have been copy-pasted for many years but not for any particular reason that we have been able to find. First use was in https://github.com/hashicorp/vault/pull/15 So here we switch to new methods suffixed with `Direct` to indicate that they don't `Prepare` before running `Exec`, and switch everything here to use those. We maintain the older methods with the existing behavior (with `Prepare`) for backwards compatibility. |
||
---|---|---|
.. | ||
mssql-database-plugin | ||
mssql.go | ||
mssql_test.go | ||
README.md |
Testing
To run these tests, first start MSSQL in Docker. Please do make sure to view the EULA before accepting it as it includes limits on the number of users per company who can be using the image, and how it can be used in testing.
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
-p 1433:1433 --name sql1 \
-d mcr.microsoft.com/mssql/server:2017-latest
Then use the following env variables for testing:
export VAULT_ACC=1
export MSSQL_URL="sqlserver://SA:%3CYourStrong%21Passw0rd%3E@localhost:1433"
Note that the SA password passed into the Docker container differs from the one passed into the tests. It's the same password, but Go's libraries require it to be percent encoded.
Running all the tests at once against one Docker container will likely fail because they interact with each other. Consider running one test at a time.