/// Opens the stash stored at the specified path.
Opens the stash stored at the specified path.
Opens the stash stored at the specified path .
pub fn open(path: &Path) -> Result<Sqlite, StashError> {
        let mut conn = Connection::open(path)?;
        let tx = conn.transaction()?;
        let app_id: i32 = tx.query_row("PRAGMA application_id", params![], |row| row.get(0))?;
        if app_id == 0 {
            tx.execute_batch(&format!(
                "PRAGMA application_id = {APPLICATION_ID};
                 PRAGMA user_version = 1;"
            ))?;
            tx.execute_batch(SCHEMA)?;
        } else if app_id != APPLICATION_ID {
            return Err(StashError::from(format!(
                "invalid application id: {}",
                app_id
            )));
        }
        tx.commit()?;
        Ok(Sqlite { conn })
    }
pub fn open ( path : & Path ) -> Result < Sqlite , StashError > { let mut conn = Connection :: open ( path ) ? ; let tx = conn . transaction ( ) ? ; let app_id : i32 = tx . query_row ( " " , params ! [ ] , | row | row . get ( 0 ) ) ? ; if app_id == 0 { tx . execute_batch ( & format ! ( " " ) ) ? ; tx . execute_batch ( SCHEMA ) ? ; } else if app_id != APPLICATION_ID { return Err ( StashError :: from ( format ! ( " " app_id ) ) ) ; } tx . commit ( ) ? ; Ok ( Sqlite { conn } ) }
Opens the stash stored at the specified path.
Opens the stash stored at the specified path .
path
&Path