/// Open a database connection using the options provided on the command line.
Open a database connection using the options provided on the command line.
Open a database connection using the options provided on the command line .
fn open_connection<'e>(
    odbc_env: &'e Environment,
    opt: &ConnectOpts,
) -> Result<Connection<'e>, Error> {
    let conn = if let Some(dsn) = &opt.dsn {
        odbc_env.connect(
            &dsn,
            opt.user.as_deref().unwrap_or(""),
            opt.password.as_deref().unwrap_or(""),
        )?
    } else if let Some(connection_string) = &opt.connection_string {
        odbc_env.connect_with_connection_string(&connection_string)?
    } else {
        bail!("Please specify a data source either using --dsn or --connection-string.");
    };
    Ok(conn)
}
fn open_connection < ' e > ( odbc_env : & ' e Environment , opt : & ConnectOpts , ) -> Result < Connection < ' e > , Error > { let conn = if let Some ( dsn ) = & opt . dsn { odbc_env . connect ( & dsn , opt . user . as_deref ( ) . unwrap_or ( " " ) , opt . password . as_deref ( ) . unwrap_or ( " " ) , ) ? } else if let Some ( connection_string ) = & opt . connection_string { odbc_env . connect_with_connection_string ( & connection_string ) ? } else { bail ! ( " " ) ; } ; Ok ( conn ) }
Open a database connection using the options provided on the command line.
Open a database connection using the options provided on the command line .
odbc_env
&'e Environment
opt
&ConnectOpts