Drizzled Public API Documentation

row0upd.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef row0upd_h
28 #define row0upd_h
29 
30 #include "univ.i"
31 #include "data0data.h"
32 #include "row0types.h"
33 #include "btr0types.h"
34 #include "dict0types.h"
35 #include "trx0types.h"
36 
37 #ifndef UNIV_HOTBACKUP
38 # include "btr0pcur.h"
39 # include "que0types.h"
40 # include "pars0types.h"
41 #endif /* !UNIV_HOTBACKUP */
42 
43 /*********************************************************************/
46 UNIV_INLINE
47 upd_t*
49 /*=======*/
50  ulint n,
51  mem_heap_t* heap);
52 /*********************************************************************/
56 UNIV_INLINE
57 ulint
59 /*=============*/
60  const upd_t* update);
61 #ifdef UNIV_DEBUG
62 /*********************************************************************/
65 UNIV_INLINE
67 upd_get_nth_field(
68 /*==============*/
69  const upd_t* update,
70  ulint n);
71 #else
72 # define upd_get_nth_field(update, n) ((update)->fields + (n))
73 #endif
74 #ifndef UNIV_HOTBACKUP
75 /*********************************************************************/
77 UNIV_INLINE
78 void
80 /*===================*/
81  upd_field_t* upd_field,
82  ulint field_no,
84  dict_index_t* index,
85  trx_t* trx);
86 /*********************************************************************/
89 UNIV_INLINE
90 const upd_field_t*
92 /*======================*/
93  const upd_t* update,
94  ulint no)
95  __attribute__((nonnull, pure));
96 /*********************************************************************/
100 UNIV_INTERN
101 byte*
103 /*==========================*/
104  dict_index_t* index,
105  trx_t* trx,
106  roll_ptr_t roll_ptr,
107  byte* log_ptr,
109  mtr_t* mtr);
110 /*********************************************************************/
113 UNIV_INLINE
114 void
116 /*===================*/
117  rec_t* rec,
118  page_zip_des_t* page_zip,
120  dict_index_t* index,
121  const ulint* offsets,
122  trx_t* trx,
123  roll_ptr_t roll_ptr);
124 /*********************************************************************/
126 UNIV_INTERN
127 void
129 /*==========================*/
130  dtuple_t* entry,
134  dict_index_t* index,
135  ulint type,
136  ib_uint64_t val);
137 /*********************************************************************/
140 UNIV_INTERN
141 upd_node_t*
143 /*============*/
144  mem_heap_t* heap);
145 /***********************************************************/
147 UNIV_INTERN
148 void
150 /*====================*/
151  const upd_t* update,
152  byte* log_ptr,
156  mtr_t* mtr);
157 /***********************************************************/
162 UNIV_INTERN
163 ibool
165 /*===================================*/
166  dict_index_t* index,
167  const ulint* offsets,
168  const upd_t* update);
169 #endif /* !UNIV_HOTBACKUP */
170 /***********************************************************/
176 UNIV_INTERN
177 void
179 /*=================*/
180  rec_t* rec,
181  dict_index_t* index,
182  const ulint* offsets,
183  const upd_t* update,
184  page_zip_des_t* page_zip);
186 #ifndef UNIV_HOTBACKUP
187 /***************************************************************/
192 UNIV_INTERN
193 upd_t*
195 /*====================================*/
196  dict_index_t* index,
197  const dtuple_t* entry,
198  const rec_t* rec,
199  trx_t* trx,
200  mem_heap_t* heap);
201 /***************************************************************/
207 UNIV_INTERN
208 upd_t*
210 /*============================*/
211  dict_index_t* index,
212  const dtuple_t* entry,
213  const rec_t* rec,
214  trx_t* trx,
215  mem_heap_t* heap);
216 /***********************************************************/
219 UNIV_INTERN
220 void
222 /*=========================================*/
223  dtuple_t* entry,
227  dict_index_t* index,
229  const upd_t* update,
232  ibool order_only,
236  mem_heap_t* heap)
238  __attribute__((nonnull));
239 /***********************************************************/
242 UNIV_INTERN
243 void
245 /*===============================*/
246  dtuple_t* entry,
250  dict_index_t* index,
252  const upd_t* update,
255  mem_heap_t* heap)
257  __attribute__((nonnull));
258 /***********************************************************/
260 UNIV_INTERN
261 void
263 /*============*/
264  dtuple_t* row,
269  row_ext_t** ext,
271  const dict_index_t* index,
272  const upd_t* update,
274  mem_heap_t* heap);
275 /***********************************************************/
282 UNIV_INTERN
283 ibool
285 /*=============================*/
286  const dtuple_t* row,
290  dict_index_t* index,
291  const upd_t* update);
294 /***********************************************************/
301 UNIV_INTERN
302 ibool
304 /*========================================*/
305  const dict_table_t* table,
306  const upd_t* update);
307 /***********************************************************/
311 UNIV_INTERN
312 que_thr_t*
314 /*=========*/
315  que_thr_t* thr);
316 #endif /* !UNIV_HOTBACKUP */
317 /*********************************************************************/
320 UNIV_INTERN
321 byte*
323 /*===================*/
324  byte* ptr,
325  byte* end_ptr,
326  ulint* pos,
327  trx_id_t* trx_id,
328  roll_ptr_t* roll_ptr);
329 /*********************************************************************/
332 UNIV_INTERN
333 void
335 /*===============================*/
336  rec_t* rec,
337  page_zip_des_t* page_zip,
338  const ulint* offsets,
339  ulint pos,
340  trx_id_t trx_id,
341  roll_ptr_t roll_ptr);
342 /*********************************************************************/
345 UNIV_INTERN
346 byte*
348 /*================*/
349  byte* ptr,
350  byte* end_ptr,
351  mem_heap_t* heap,
353  upd_t** update_out);
356 /* Update vector field */
358  unsigned field_no:16;
363 #ifndef UNIV_HOTBACKUP
364  unsigned orig_len:16;
367  que_node_t* exp;
371 #endif /* !UNIV_HOTBACKUP */
373 };
374 
375 /* Update vector structure */
376 struct upd_struct{
377  ulint info_bits;
379  ulint n_fields;
381 };
382 
383 #ifndef UNIV_HOTBACKUP
384 /* Update node structure which also implements the delete operation
385 of a row */
386 
389  ibool is_delete;/* TRUE if delete, FALSE if update */
390  ibool searched_update;
391  /* TRUE if searched update, FALSE if
392  positioned */
393  ibool in_mysql_interface;
394  /* TRUE if the update node was created
395  for the MySQL interface */
396  dict_foreign_t* foreign;/* NULL or pointer to a foreign key
397  constraint if this update node is used in
398  doing an ON DELETE or ON UPDATE operation */
399  upd_node_t* cascade_node;/* NULL or an update node template which
400  is used to implement ON DELETE/UPDATE CASCADE
401  or ... SET NULL for foreign keys */
402  mem_heap_t* cascade_heap;/* NULL or a mem heap where the cascade
403  node is created */
414  ulint update_n_fields;
415  /* when this struct is used to implement
416  a cascade operation for foreign keys, we store
417  here the size of the buffer allocated for use
418  as the update vector */
419  sym_node_list_t columns;/* symbol table nodes for the columns
420  to retrieve from the table */
421  ibool has_clust_rec_x_lock;
422  /* TRUE if the select which retrieves the
423  records to update already sets an x-lock on
424  the clustered record; note that it must always
425  set at least an s-lock */
426  ulint cmpl_info;/* information extracted during query
427  compilation; speeds up execution:
428  UPD_NODE_NO_ORD_CHANGE and
429  UPD_NODE_NO_SIZE_CHANGE, ORed */
430  /*----------------------*/
431  /* Local storage for this graph node */
432  ulint state;
440  dtuple_t* upd_row;/* NULL, or a copy of the updated row */
441  row_ext_t* upd_ext;/* NULL, or prefixes of the externally
442  stored columns in upd_row */
446  /*----------------------*/
447  sym_node_t* table_sym;/* table node in symbol table */
448  que_node_t* col_assign_list;
449  /* column assignment list */
450  ulint magic_n;
451 };
452 
453 #define UPD_NODE_MAGIC_N 1579975
454 
455 /* Node execution states */
456 #define UPD_NODE_SET_IX_LOCK 1 /* execution came to the node from
457  a node above and if the field
458  has_clust_rec_x_lock is FALSE, we
459  should set an intention x-lock on
460  the table */
461 #define UPD_NODE_UPDATE_CLUSTERED 2 /* clustered index record should be
462  updated */
463 #define UPD_NODE_INSERT_CLUSTERED 3 /* clustered index record should be
464  inserted, old record is already delete
465  marked */
466 #define UPD_NODE_UPDATE_ALL_SEC 4 /* an ordering field of the clustered
467  index record was changed, or this is
468  a delete operation: should update
469  all the secondary index records */
470 #define UPD_NODE_UPDATE_SOME_SEC 5 /* secondary index entries should be
471  looked at and updated if an ordering
472  field changed */
473 
474 /* Compilation info flags: these must fit within 3 bits; see trx0rec.h */
475 #define UPD_NODE_NO_ORD_CHANGE 1 /* no secondary index record will be
476  changed in the update and no ordering
477  field of the clustered index */
478 #define UPD_NODE_NO_SIZE_CHANGE 2 /* no record field size will be
479  changed in the update */
480 
481 #endif /* !UNIV_HOTBACKUP */
482 
483 #ifndef UNIV_NONINL
484 #include "row0upd.ic"
485 #endif
486 
487 #endif