public function test_select_single_row_multiple_results() { try { $this->querier->select_single_row($this->test_table, array('*')); self::assertTrue(false, 'Only on row has been found but multiples shoud'); } catch (NotASingleRowFoundException $ex) { } }
public static function create_cookie($user_id) { $columns = array('autoconnect_key'); $condition = 'WHERE user_id=:user_id'; $parameters = array('user_id' => $user_id); $row = self::$querier->select_single_row(DB_TABLE_MEMBER, $columns, $condition, $parameters); $data = null; if (!empty($row['autoconnect_key'])) { $data = new AutoConnectData($user_id, $row['autoconnect_key']); } else { $data = self::change_key($user_id); } $data->save(); }
/** * @desc Retrieve a Menu Object from the database by its id * @param int $id the id of the Menu to retrieve from the database * @return Menu the requested Menu if it exists else, null */ public static function load($id) { try { $result = self::$querier->select_single_row(DB_TABLE_MENUS, self::$columns, 'WHERE id=:id', array('id' => $id)); return self::initialize($result); } catch (RowNotFoundException $ex) { return null; } }
private function find_failure_login_tried_id_by_username() { $columns = array('id', 'last_connection', 'connection_attemps'); $condition = 'WHERE login=:login AND session_id=:session_id'; $parameters = array('login' => $this->login, 'session_id' => AppContext::get_session()->get_session_id()); $row = $this->querier->select_single_row(DB_TABLE_INTERNAL_AUTHENTICATION_FAILURES, $columns, $condition, $parameters); $this->connection_attempts = $row['connection_attemps']; $this->last_connection_date = $row['last_connection']; return $row['id']; }