mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
20877d83fd
* Add extension support for SQLite While SQLite supports loading extensions at run-time via either the C API or the SQL interface, they strongly recommend [1] only enabling the C API so that SQL injections don't allow attackers to run arbitrary extension code. Here we take the most conservative approach, we enable only the C function, and then only when the user requests extensions be loaded in their `SqliteConnectOptions`, and disable it again once we're done loading those requested modules. We don't add any support for loading extensions via environment variables or connection strings. Extensions in the options are stored as an IndexMap as the load order can have side effects, they will be loaded in the order they are supplied by the caller. Extensions with custom entry points are supported, but a default API is exposed as most users will interact with extensions using the defaults. [1]: https://sqlite.org/c3ref/enable_load_extension.html * Add extension testing for SQlite Extends x.py to download an appropriate shared object file for supported operating systems, and uses wget to fetch one into the GitHub Actions context for use by CI. Overriding LD_LIBRARY_PATH for only this specific DB minimises the impact on the rest of the suite. |
||
---|---|---|
.. | ||
any | ||
certs | ||
keys | ||
migrate | ||
mssql | ||
mysql | ||
postgres | ||
sqlite | ||
ui | ||
.dockerignore | ||
.env | ||
.gitignore | ||
docker-compose.yml | ||
docker.py | ||
README.md | ||
ui-tests.rs | ||
x.py |
Running Tests
SQLx uses docker to run many compatible database systems for integration testing. You'll need to install docker to run the full suite. You can validate your docker installation with:
$ docker run hello-world
Start the databases with docker-compose
before running tests:
$ docker-compose up
Run all tests against all supported databases using:
$ ./x.py
If you see test failures, or want to run a more specific set of tests against a specific database, you can specify both the features to be tests and the DATABASE_URL. e.g.
$ DATABASE_URL=mysql://root:password@127.0.0.1:49183/sqlx cargo test --no-default-features --features macros,offline,any,all-types,mysql,runtime-async-std-native-tls