rust/hedgewars-server/src/server/database.rs
changeset 15532 f1205f33bf5b
parent 15531 ede5f4ec48f3
child 15795 40929af15167
equal deleted inserted replaced
15531:ede5f4ec48f3 15532:f1205f33bf5b
    84         } else {
    84         } else {
    85             Err(DriverError::SetupError.into())
    85             Err(DriverError::SetupError.into())
    86         }
    86         }
    87     }
    87     }
    88 
    88 
       
    89     pub fn get_checker_account(
       
    90         &mut self,
       
    91         nick: &str,
       
    92         checker_password: &str,
       
    93     ) -> Result<bool, Error> {
       
    94         if let Some(pool) = &self.pool {
       
    95             if let Some(row) = pool.first_exec(GET_ACCOUNT_QUERY, params! { "username" => nick })? {
       
    96                 let (mut password, _, _) = from_row_opt::<(String, i32, i32)>(row)?;
       
    97                 Ok(checker_password == password)
       
    98             } else {
       
    99                 Ok(false)
       
   100             }
       
   101         } else {
       
   102             Err(DriverError::SetupError.into())
       
   103         }
       
   104     }
       
   105 
    89     pub fn store_stats(&mut self, stats: &ServerStatistics) -> Result<(), Error> {
   106     pub fn store_stats(&mut self, stats: &ServerStatistics) -> Result<(), Error> {
    90         if let Some(pool) = &self.pool {
   107         if let Some(pool) = &self.pool {
    91             for mut stmt in pool.prepare(STORE_STATS_QUERY).into_iter() {
   108             for mut stmt in pool.prepare(STORE_STATS_QUERY).into_iter() {
    92                 stmt.execute(params! {
   109                 stmt.execute(params! {
    93                     "players" => stats.players,
   110                     "players" => stats.players,