mysql-client-bindings-rs

A more complete autogenerated Rust bindings for mysql/mariadb client library #include <mysql.h>

Navigation

Limitations

Works and tested only on UNIX systems.

Tested on Ubuntu 20.04 (and corresponding docker image), mysql:8.0.24 and mariadb:10 docker images.

Any further contributions are welcome in order to

Build

For build, you need to install corresponding client libraries,
depends on needed features (default path if you choose this crate as a dependency at your Cargo.toml), or you need only docker (path #2) if you want to build is locally by some reason or in order to reproduce these bindings.

#1 Build on host system

In order to generate bindings on host you need to:

  1. Install bindgen dependencies
  2. Install needed client libraries

Then, if you want to just use this crate as a dependency, put in to your Cargo.toml and select mysql or mariadb as a feature.

If you want to create standalone bindings: - mysql - cargo build --release (mysql is default feature) - mariadb - cargo build --release --no-default-features --features mariadb

#2 Docker

In order to generate standalone bindings through docker you need to:

  1. Install docker
  2. Adjust docker settings

    2.1 Add your user in docker group in order to use docker as non-root user - sudo usermod -aG docker $USER

    2.2 If you want to continue using docker, add docker to systemctl in order to start it on the boot

  3. Run build script - it will rebuild both kind of bindings for you and store them at ./src directory.

Usage

Ensure that your Cargo.toml contains dependency with needed feature, and you have installed needed libraries, listed at section Build: ```toml

...

[dependencies] mysql-client-bindings-rs = { version = "0.1.0", git = "https://github.com/chamoretto/mysql-client-bindings-rs" } ```

Then add use, it would be wise to use a shorter alias: rust use mysql_client_bindings_rs as mysql; // alias use mysql::{UDF_INIT, UDF_ARGS}; // whatever you need

Differences from mysqlclient-sys


License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.