Skip to content

Commit 458102f

Browse files
author
Justin Decker
committed
ado string support for mssql
1 parent 70cdd62 commit 458102f

File tree

1 file changed

+6
-2
lines changed
  • connectorx/src/sources/mssql

1 file changed

+6
-2
lines changed

connectorx/src/sources/mssql/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ pub fn mssql_config(url: &Url) -> Config {
9494
impl MsSQLSource {
9595
#[throws(MsSQLSourceError)]
9696
pub fn new(rt: Arc<Runtime>, conn: &str, nconn: usize) -> Self {
97-
let url = Url::parse(conn)?;
98-
let config = mssql_config(&url)?;
97+
// If it doesn't look like a URL, then it might be an ADO string
98+
let config = if let Ok(url) = Url::parse(conn) {
99+
mssql_config(&url)?
100+
} else {
101+
Config::from_ado_string(conn)?
102+
};
99103
let manager = bb8_tiberius::ConnectionManager::new(config);
100104
let pool = rt.block_on(Pool::builder().max_size(nconn as u32).build(manager))?;
101105

0 commit comments

Comments
 (0)