/***************************************************************************** Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ /**************************************************//** @file include/read0read.ic Cursor read Created 2/16/1997 Heikki Tuuri *******************************************************/ /*********************************************************************//** Gets the nth trx id in a read view. Upstream code stores array of trx_ids in the descending order. Percona Server keeps it in the ascending order for performance reasons. Let us keep the semantics. @return trx id */ UNIV_INLINE trx_id_t read_view_get_nth_trx_id( /*=====================*/ const read_view_t* view, /*!< in: read view */ ulint n) /*!< in: position */ { ut_ad(n < view->n_descr); return(view->descriptors[view->n_descr - 1 - n]); } /*********************************************************************//** Sets the nth trx id in a read view. Upstream code stores array of trx_ids in the descending order. Percona Server keeps it in the ascending order for performance reasons. Let us keep the semantics. */ UNIV_INLINE void read_view_set_nth_trx_id( /*=====================*/ read_view_t* view, /*!< in: read view */ ulint n, /*!< in: position */ trx_id_t trx_id) /*!< in: trx id to set */ { ut_ad(n < view->n_descr); view->descriptors[view->n_descr - 1 - n] = trx_id; } /*********************************************************************//** Checks if a read view sees the specified transaction. @return TRUE if sees */ UNIV_INLINE ibool read_view_sees_trx_id( /*==================*/ const read_view_t* view, /*!< in: read view */ trx_id_t trx_id) /*!< in: trx id */ { if (trx_id < view->up_limit_id) { return(TRUE); } if (trx_id >= view->low_limit_id) { return(FALSE); } /* Do a binary search over this view's descriptors array */ return(trx_find_descriptor(view->descriptors, view->n_descr, trx_id) == NULL); }