Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Fix sql server checks in connection info
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius de Bruijn committed Jun 12, 2020
1 parent 8ef4c80 commit db85127
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/connector/connection_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ impl ConnectionInfo {
let url_result: Result<Url, _> = 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?;
Expand Down

0 comments on commit db85127

Please sign in to comment.