1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#[cfg(feature = "bundled")]
extern crate mysqlclient_src;

#[allow(dead_code)]
mod bindings {
    include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}

pub use self::bindings::*;

// the following type devs are compatibility shims for diesel

#[cfg(all(not(mysql_5_7_x), not(mariadb_10_x)))]
pub type my_bool = bool;

#[cfg(all(not(mysql_5_7_x), not(mariadb_10_x)))]
pub const FALSE: my_bool = false;
#[cfg(all(not(mysql_5_7_x), not(mariadb_10_x)))]
pub const TRUE: my_bool = true;

#[cfg(any(mysql_5_7_x, mariadb_10_x))]
pub const FALSE: my_bool = 0;

#[cfg(any(mysql_5_7_x, mariadb_10_x))]
pub const TRUE: my_bool = 1;

pub const SUPPORTS_MYSQL_SSL_MODE: bool = !cfg!(mariadb_10_x);

#[cfg(mariadb_10_x)]
#[repr(u32)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub enum mysql_ssl_mode {
    SSL_MODE_DISABLED = 1,
    SSL_MODE_PREFERRED = 2,
    SSL_MODE_REQUIRED = 3,
    SSL_MODE_VERIFY_CA = 4,
    SSL_MODE_VERIFY_IDENTITY = 5,
}

#[cfg(mariadb_10_x)]
pub mod mysql_option {
    /// that's not supported, do not use it
    pub const MYSQL_OPT_SSL_MODE: crate::bindings::mysql_option =
        crate::bindings::mysql_option::MYSQL_SERVER_PUBLIC_KEY;
    pub const MYSQL_OPT_SSL_CA: crate::bindings::mysql_option =
        crate::bindings::mysql_option::MYSQL_OPT_SSL_CA;
    pub const MYSQL_OPT_SSL_CERT: crate::bindings::mysql_option =
        crate::bindings::mysql_option::MYSQL_OPT_SSL_CERT;
    pub const MYSQL_OPT_SSL_KEY: crate::bindings::mysql_option =
        crate::bindings::mysql_option::MYSQL_OPT_SSL_KEY;
    pub const MYSQL_SET_CHARSET_NAME: crate::bindings::mysql_option =
        crate::bindings::mysql_option::MYSQL_SET_CHARSET_NAME;
}