odbc_api/
driver_complete_option.rs

1/// Specifies how the driver and driver manager complete the incoming connection string. See
2/// [`crate::Environment::driver_connect`].
3#[derive(Clone, Copy, Debug)]
4pub enum DriverCompleteOption {
5    /// Do not show a prompt to the user. This implies that the connection string, must already
6    /// provide all information needed to Connect to the data source, otherwise the operation fails.
7    /// This is the only supported variant on non windows platforms
8    NoPrompt,
9    /// Always show a prompt to the user.
10    #[cfg(all(target_os = "windows", feature = "prompt"))]
11    Prompt,
12    /// Only show a prompt to the user if the information in the connection string is not sufficient
13    /// to connect to the data source.
14    #[cfg(all(target_os = "windows", feature = "prompt"))]
15    Complete,
16    /// Like complete, but the user may not change any information already provided within the
17    /// connection string.
18    #[cfg(all(target_os = "windows", feature = "prompt"))]
19    CompleteRequired,
20}
21
22impl DriverCompleteOption {
23    pub fn as_sys(&self) -> odbc_sys::DriverConnectOption {
24        match self {
25            DriverCompleteOption::NoPrompt => odbc_sys::DriverConnectOption::NoPrompt,
26            #[cfg(all(target_os = "windows", feature = "prompt"))]
27            DriverCompleteOption::Prompt => odbc_sys::DriverConnectOption::Prompt,
28            #[cfg(all(target_os = "windows", feature = "prompt"))]
29            DriverCompleteOption::Complete => odbc_sys::DriverConnectOption::Complete,
30            #[cfg(all(target_os = "windows", feature = "prompt"))]
31            DriverCompleteOption::CompleteRequired => {
32                odbc_sys::DriverConnectOption::CompleteRequired
33            }
34        }
35    }
36}