1
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
17
@file storage/perfschema/cursor_by_user.cc
18
Cursor CURSOR_BY_USER (implementation).
21
#include "my_global.h"
22
#include "cursor_by_user.h"
25
cursor_by_user::cursor_by_user(const PFS_engine_table_share *share)
26
: PFS_engine_table(share, &m_pos),
27
m_pos(0), m_next_pos(0)
30
void cursor_by_user::reset_position(void)
33
m_next_pos.m_index= 0;
36
int cursor_by_user::rnd_next(void)
40
for (m_pos.set_at(&m_next_pos);
41
m_pos.m_index < user_max;
44
pfs= &user_array[m_pos.m_index];
45
if (pfs->m_lock.is_populated())
48
m_next_pos.set_after(&m_pos);
53
return HA_ERR_END_OF_FILE;
57
cursor_by_user::rnd_pos(const void *pos)
62
DBUG_ASSERT(m_pos.m_index < user_max);
63
pfs= &user_array[m_pos.m_index];
64
if (pfs->m_lock.is_populated())
70
return HA_ERR_RECORD_DELETED;