mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / myisammrg / myrg_extra.c
blob20367764d69237947e1fec2d9daa762d41e5ce6f
1 /* Copyright (c) 2000-2003, 2005-2007 MySQL AB
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 Extra functions we want to do with a database
18 - All flags, exept record-cache-flags, are set in all used databases
19 record-cache-flags are set in myrg_rrnd when we are changing database.
22 #include "myrg_def.h"
24 int myrg_extra(MYRG_INFO *info,enum ha_extra_function function,
25 void *extra_arg)
27 int error,save_error=0;
28 MYRG_TABLE *file;
29 DBUG_ENTER("myrg_extra");
30 DBUG_PRINT("info",("function: %lu", (ulong) function));
32 if (!info->children_attached)
33 DBUG_RETURN(1);
34 if (function == HA_EXTRA_CACHE)
36 info->cache_in_use=1;
37 info->cache_size= (extra_arg ? *(ulong*) extra_arg :
38 my_default_record_cache_size);
40 else
42 if (function == HA_EXTRA_NO_CACHE ||
43 function == HA_EXTRA_PREPARE_FOR_UPDATE)
44 info->cache_in_use=0;
45 if (function == HA_EXTRA_RESET_STATE)
47 info->current_table=0;
48 info->last_used_table=info->open_tables;
50 for (file=info->open_tables ; file != info->end_table ; file++)
52 if ((error=mi_extra(file->table, function, extra_arg)))
53 save_error=error;
56 DBUG_RETURN(save_error);
60 void myrg_extrafunc(MYRG_INFO *info, invalidator_by_filename inv)
62 MYRG_TABLE *file;
63 DBUG_ENTER("myrg_extrafunc");
65 for (file=info->open_tables ; file != info->end_table ; file++)
66 file->table->s->invalidator = inv;
68 DBUG_VOID_RETURN;
72 int myrg_reset(MYRG_INFO *info)
74 int save_error= 0;
75 MYRG_TABLE *file;
76 DBUG_ENTER("myrg_reset");
78 if (!info->children_attached)
79 DBUG_RETURN(1);
80 info->cache_in_use=0;
81 info->current_table=0;
82 info->last_used_table= info->open_tables;
84 for (file=info->open_tables ; file != info->end_table ; file++)
86 int error;
87 if ((error= mi_reset(file->table)))
88 save_error=error;
90 DBUG_RETURN(save_error);