1 /* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
2 
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.
6 
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.
11 
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-1335 USA */
15 
16 #ifndef _ma_trnman_h
17 #define _ma_trnman_h
18 
19 /**
20    Sets table's trn and prints debug information
21    Links table into used_instances if new_trn is not 0
22 
23    @param tbl              MARIA_HA of table
24    @param newtrn           what to put into tbl->trn
25 */
26 
_ma_set_trn_for_table(MARIA_HA * tbl,TRN * newtrn)27 static inline void _ma_set_trn_for_table(MARIA_HA *tbl, TRN *newtrn)
28 {
29   DBUG_PRINT("info",("table: %p  trn: %p -> %p",
30                      tbl, tbl->trn, newtrn));
31 
32   /* check that we are not calling this twice in a row */
33   DBUG_ASSERT(newtrn->used_instances != (void*) tbl);
34 
35   tbl->trn= newtrn;
36   /* Link into used list */
37   tbl->trn_next= (MARIA_HA*) newtrn->used_instances;
38   newtrn->used_instances= tbl;
39 }
40 
41 
42 /*
43   Same as _ma_set_trn_for_table(), but don't link table into used_instance list
44   Used when we want to temporary set trn for a table in extra()
45 */
46 
_ma_set_tmp_trn_for_table(MARIA_HA * tbl,TRN * newtrn)47 static inline void _ma_set_tmp_trn_for_table(MARIA_HA *tbl, TRN *newtrn)
48 {
49   DBUG_PRINT("info",("table: %p  trn: %p -> %p",
50                      tbl, tbl->trn, newtrn));
51   tbl->trn= newtrn;
52 }
53 
54 
55 /*
56   Reset TRN in table
57 */
58 
_ma_reset_trn_for_table(MARIA_HA * tbl)59 static inline void _ma_reset_trn_for_table(MARIA_HA *tbl)
60 {
61   DBUG_PRINT("info",("table: %p  trn: %p -> NULL", tbl, tbl->trn));
62   tbl->trn= 0;
63 }
64 
65 #endif /* _ma_trnman_h */
66