pub fn read_watch_list(set_path: &str) -> rusqlite::Result<Vec<Watchlist>> {
    // Open the database
    let conn = Connection::open(set_path)?;

    // Prepare the query for the watchlist
    let mut stmt = conn.prepare("SELECT * FROM watchlist")?;
    // Execute the query. Returns the values into a Watchlist Struct
    let stored_watch_list = stmt.query_map(NO_PARAMS, |row| {
        Ok(Watchlist::new().build(row.get(1)?, row.get(2)?))
    })?;
    // Push the returned values into a Vector
    let mut watch_list = Vec::new();
    for item in stored_watch_list {
        watch_list.push(item?)
    }
    // Return the watchlist
    Ok(watch_list)
}
/// Function that returns the values inside the watchlist table
Function that returns the values inside the watchlist table
Function that returns the values inside the watchlist table
pub fn read_watch_list(set_path: &str) -> rusqlite::Result<Vec<Watchlist>> {
    // Open the database
    let conn = Connection::open(set_path)?;
    // Prepare the query for the watchlist
    let mut stmt = conn.prepare("SELECT * FROM watchlist")?;
    // Execute the query. Returns the values into a Watchlist Struct
    let stored_watch_list = stmt.query_map(NO_PARAMS, |row| {
        Ok(Watchlist::new().build(row.get(1)?, row.get(2)?))
    })?;
    // Push the returned values into a Vector
    let mut watch_list = Vec::new();
    for item in stored_watch_list {
        watch_list.push(item?)
    }
    // Return the watchlist
    Ok(watch_list)
}
pub fn read_watch_list ( set_path : & str ) -> rusqlite :: Result < Vec < Watchlist > > { // Open the database let conn = Connection :: open ( set_path ) ? ; // Prepare the query for the watchlist let mut stmt = conn . prepare ( " " ) ? ; // Execute the query. Returns the values into a Watchlist Struct let stored_watch_list = stmt . query_map ( NO_PARAMS , | row | { Ok ( Watchlist :: new ( ) . build ( row . get ( 1 ) ? , row . get ( 2 ) ? ) ) } ) ? ; // Push the returned values into a Vector let mut watch_list = Vec :: new ( ) ; for item in stored_watch_list { watch_list . push ( item ? ) } // Return the watchlist Ok ( watch_list ) }
Function that returns the values inside the watchlist table
Function that returns the values inside the watchlist table
set_path
&str
set_path
&str