From db8512766f036b08ca18a6c96628c34ef9deae0d Mon Sep 17 00:00:00 2001 From: Julius de Bruijn Date: Fri, 12 Jun 2020 18:23:12 +0200 Subject: [PATCH] Fix sql server checks in connection info --- src/connector/connection_info.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/connector/connection_info.rs b/src/connector/connection_info.rs index 42e5a76e6..2dc2b0473 100644 --- a/src/connector/connection_info.rs +++ b/src/connector/connection_info.rs @@ -44,23 +44,23 @@ impl ConnectionInfo { let url_result: Result = url_str.parse(); // Non-URL database strings are interpreted as SQLite file paths. - #[cfg(any(feature = "sqlite", feature = "mssql"))] - { - match url_str { - s if s.starts_with("file") || s.starts_with("sqlite") => { - if url_result.is_err() { - let params = SqliteParams::try_from(s)?; + match url_str { + #[cfg(feature = "sqlite")] + s if s.starts_with("file") || s.starts_with("sqlite") => { + if url_result.is_err() { + let params = SqliteParams::try_from(s)?; - return Ok(ConnectionInfo::Sqlite { - file_path: params.file_path, - db_name: params.db_name.clone(), - }); - } - } - _ => { - return Ok(ConnectionInfo::Mssql(MssqlUrl::new(url_str)?)); + return Ok(ConnectionInfo::Sqlite { + file_path: params.file_path, + db_name: params.db_name.clone(), + }); } } + #[cfg(feature = "mssql")] + s if s.starts_with("jdbc:sqlserver") || s.starts_with("sqlserver") => { + return Ok(ConnectionInfo::Mssql(MssqlUrl::new(url_str)?)); + } + _ => (), } let url = url_result?;