pub async fn create_mssql_database(jdbc_string: &str) -> Result<Quaint, AnyError> {
    let mut conn = connection_string::JdbcString::from_str(&format!("jdbc:{}", jdbc_string))?;

    let params = conn.properties_mut();
    match params.remove("database") {
        Some(ref db_name) if db_name != "master" => {
            params.insert("database".into(), "master".into());
            let conn = Quaint::new(&conn.to_string()).await?;
            conn.raw_cmd(&format!("DROP DATABASE IF EXISTS {}", db_name)).await?;
            conn.raw_cmd(&format!("CREATE DATABASE {}", db_name)).await?;
        }
        _ => (),
    }

    let conn = Quaint::new(jdbc_string).await?;
    conn.query_raw("select db_name() as name", &[]).await?;

    Ok(conn)
}
/// Create an MSSQL database from a JDBC connection string..
Create an MSSQL database from a JDBC connection string
Create an MSSQL database from a JDBC connection string
pub async fn create_mssql_database(jdbc_string: &str) -> Result<Quaint, AnyError> {
    let mut conn = connection_string::JdbcString::from_str(&format!("jdbc:{}", jdbc_string))?;
    let params = conn.properties_mut();
    match params.remove("database") {
        Some(ref db_name) if db_name != "master" => {
            params.insert("database".into(), "master".into());
            let conn = Quaint::new(&conn.to_string()).await?;
            conn.raw_cmd(&format!("DROP DATABASE IF EXISTS {}", db_name)).await?;
            conn.raw_cmd(&format!("CREATE DATABASE {}", db_name)).await?;
        }
        _ => (),
    }
    let conn = Quaint::new(jdbc_string).await?;
    conn.query_raw("select db_name() as name", &[]).await?;
    Ok(conn)
}
pub async fn create_mssql_database ( jdbc_string : & str ) -> Result < Quaint , AnyError > { let mut conn = connection_string :: JdbcString :: from_str ( & format ! ( " " jdbc_string ) ) ? ; let params = conn . properties_mut ( ) ; match params . remove ( " " ) { Some ( ref db_name ) if db_name != " " => { params . insert ( " " . into ( ) , " " . into ( ) ) ; let conn = Quaint :: new ( & conn . to_string ( ) ) . await ? ; conn . raw_cmd ( & format ! ( " " db_name ) ) . await ? ; conn . raw_cmd ( & format ! ( " " db_name ) ) . await ? ; } _ => ( ) , } let conn = Quaint :: new ( jdbc_string ) . await ? ; conn . query_raw ( " " , & [ ] ) . await ? ; Ok ( conn ) }
Create an MSSQL database from a JDBC connection string..
Create an MSSQL database from a JDBC connection string ..
jdbc_string
&str
jdbc_string
&str