1 /* Copyright (c) 2002, 2004-2006 MySQL AB
2    Use is subject to license terms
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; version 2 of the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335  USA */
16 
17 #include "myrg_def.h"
18 
myrg_records_in_range(MYRG_INFO * info,int inx,key_range * min_key,key_range * max_key)19 ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
20                               key_range *min_key, key_range *max_key)
21 {
22   ha_rows records=0, res;
23   MYRG_TABLE *table;
24 
25   for (table=info->open_tables ; table != info->end_table ; table++)
26   {
27     res= mi_records_in_range(table->table, inx, min_key, max_key);
28     if (res == HA_POS_ERROR)
29       return HA_POS_ERROR;
30     if (records > HA_POS_ERROR - res)
31       return HA_POS_ERROR-1;
32     records+=res;
33   }
34   return records;
35 }
36 
37