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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#[cfg(feature = "bundled")]
extern crate mysqlclient_src;

#[allow(dead_code)]
mod bindings {
    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_5_7_x,
        not(target_os = "windows"),
        any(target_arch = "x86_64", target_arch = "aarch64")
    ))]
    include!("../bindings/bindings_5_7_42_x86_64_linux.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_0_x,
        not(target_os = "windows"),
        any(target_arch = "x86_64", target_arch = "aarch64")
    ))]
    include!("../bindings/bindings_8_0_36_x86_64_linux.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_3_x,
        not(target_os = "windows"),
        any(target_arch = "x86_64", target_arch = "aarch64")
    ))]
    include!("../bindings/bindings_8_3_0_x86_64_linux.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_4_x,
        not(target_os = "windows"),
        any(target_arch = "x86_64", target_arch = "aarch64")
    ))]
    include!("../bindings/bindings_8_4_0_x86_64_linux.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mariadb_10_x,
        not(target_os = "windows"),
        any(target_arch = "x86_64", target_arch = "aarch64")
    ))]
    include!("../bindings/bindings_mariadb_10_11_x86_64_linux.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_0_x,
        target_os = "windows",
        target_arch = "x86_64"
    ))]
    include!("../bindings/bindings_8_0_36_x86_64_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_0_x,
        target_os = "windows",
        target_arch = "x86"
    ))]
    include!("../bindings/bindings_8_0_36_i868_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_3_x,
        target_os = "windows",
        target_arch = "x86_64"
    ))]
    include!("../bindings/bindings_8_3_0_x86_64_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_3_x,
        target_os = "windows",
        target_arch = "x86"
    ))]
    include!("../bindings/bindings_8_3_0_i868_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_4_x,
        target_os = "windows",
        target_arch = "x86_64"
    ))]
    include!("../bindings/bindings_8_4_0_x86_64_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mysql_8_4_x,
        target_os = "windows",
        target_arch = "x86"
    ))]
    include!("../bindings/bindings_8_4_0_i868_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mariadb_10_x,
        target_os = "windows",
        target_arch = "x86_64"
    ))]
    include!("../bindings/bindings_mariadb_10_11_x86_64_windows.rs");

    #[cfg(all(
        not(feature = "buildtime_bindgen"),
        mariadb_10_x,
        target_os = "windows",
        target_arch = "x86"
    ))]
    include!("../bindings/bindings_mariadb_10_11_i686_windows.rs");

    #[cfg(feature = "buildtime_bindgen")]
    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;
}