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.
24 int myrg_extra(MYRG_INFO
*info
,enum ha_extra_function function
,
27 int error
,save_error
=0;
29 DBUG_ENTER("myrg_extra");
30 DBUG_PRINT("info",("function: %lu", (ulong
) function
));
32 if (!info
->children_attached
)
34 if (function
== HA_EXTRA_CACHE
)
37 info
->cache_size
= (extra_arg
? *(ulong
*) extra_arg
:
38 my_default_record_cache_size
);
42 if (function
== HA_EXTRA_NO_CACHE
||
43 function
== HA_EXTRA_PREPARE_FOR_UPDATE
)
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
)))
56 DBUG_RETURN(save_error
);
60 void myrg_extrafunc(MYRG_INFO
*info
, invalidator_by_filename inv
)
63 DBUG_ENTER("myrg_extrafunc");
65 for (file
=info
->open_tables
; file
!= info
->end_table
; file
++)
66 file
->table
->s
->invalidator
= inv
;
72 int myrg_reset(MYRG_INFO
*info
)
76 DBUG_ENTER("myrg_reset");
78 if (!info
->children_attached
)
81 info
->current_table
=0;
82 info
->last_used_table
= info
->open_tables
;
84 for (file
=info
->open_tables
; file
!= info
->end_table
; file
++)
87 if ((error
= mi_reset(file
->table
)))
90 DBUG_RETURN(save_error
);