InnoDB Plugin  1.0
data0data.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2012, Oracle and/or its affiliates. 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.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /********************************************************************/
26 #ifndef data0data_h
27 #define data0data_h
28 
29 #include "univ.i"
30 
31 #include "data0types.h"
32 #include "data0type.h"
33 #include "mem0mem.h"
34 #include "dict0types.h"
35 
38 struct big_rec_t;
39 
40 #ifdef UNIV_DEBUG
41 /*********************************************************************/
44 UNIV_INLINE
45 dtype_t*
47 /*============*/
48  const dfield_t* field)
49  __attribute__((nonnull, warn_unused_result));
50 /*********************************************************************/
53 UNIV_INLINE
54 void*
56 /*============*/
57  const dfield_t* field)
58  __attribute__((nonnull, warn_unused_result));
59 #else /* UNIV_DEBUG */
60 # define dfield_get_type(field) (&(field)->type)
61 # define dfield_get_data(field) ((field)->data)
62 #endif /* UNIV_DEBUG */
63 /*********************************************************************/
65 UNIV_INLINE
66 void
68 /*============*/
69  dfield_t* field,
70  const dtype_t* type)
71  __attribute__((nonnull));
72 /*********************************************************************/
75 UNIV_INLINE
76 ulint
78 /*===========*/
79  const dfield_t* field)
80  __attribute__((nonnull, warn_unused_result));
81 /*********************************************************************/
83 UNIV_INLINE
84 void
86 /*===========*/
87  dfield_t* field,
88  ulint len)
89  __attribute__((nonnull));
90 /*********************************************************************/
93 UNIV_INLINE
94 ulint
96 /*===========*/
97  const dfield_t* field)
98  __attribute__((nonnull, warn_unused_result));
99 /*********************************************************************/
102 UNIV_INLINE
103 ulint
105 /*==========*/
106  const dfield_t* field)
107  __attribute__((nonnull, warn_unused_result));
108 /*********************************************************************/
110 UNIV_INLINE
111 void
113 /*===========*/
114  dfield_t* field)
115  __attribute__((nonnull));
116 /*********************************************************************/
118 UNIV_INLINE
119 void
121 /*============*/
122  dfield_t* field,
123  const void* data,
124  ulint len)
125  __attribute__((nonnull(1)));
126 /*********************************************************************/
128 UNIV_INLINE
129 void
131 /*============*/
132  dfield_t* field)
133  __attribute__((nonnull));
134 /**********************************************************************/
136 UNIV_INLINE
137 void
139 /*================*/
140  byte* data,
141  ulint len)
142  __attribute__((nonnull));
143 /*********************************************************************/
145 UNIV_INLINE
146 void
148 /*=============*/
149  dfield_t* field1,
150  const dfield_t* field2)
151  __attribute__((nonnull));
152 /*********************************************************************/
154 UNIV_INLINE
155 void
157 /*========*/
158  dfield_t* field1,
159  const dfield_t* field2)
160  __attribute__((nonnull));
161 /*********************************************************************/
163 UNIV_INLINE
164 void
165 dfield_dup(
166 /*=======*/
167  dfield_t* field,
168  mem_heap_t* heap)
169  __attribute__((nonnull));
170 #ifndef UNIV_HOTBACKUP
171 /*********************************************************************/
176 UNIV_INLINE
177 ibool
179 /*==========================*/
180  const dfield_t* field1,
181  const dfield_t* field2,
182  ulint len)
184  __attribute__((nonnull, warn_unused_result));
185 /*********************************************************************/
188 UNIV_INLINE
189 ibool
191 /*========================*/
192  const dfield_t* field,
193  ulint len,
194  const byte* data)
195  __attribute__((nonnull, warn_unused_result));
196 #endif /* !UNIV_HOTBACKUP */
197 /*********************************************************************/
200 UNIV_INLINE
201 ulint
203 /*================*/
204  const dtuple_t* tuple)
205  __attribute__((nonnull, warn_unused_result));
206 #ifdef UNIV_DEBUG
207 /*********************************************************************/
210 UNIV_INLINE
211 dfield_t*
213 /*=================*/
214  const dtuple_t* tuple,
215  ulint n);
216 #else /* UNIV_DEBUG */
217 # define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
218 #endif /* UNIV_DEBUG */
219 /*********************************************************************/
222 UNIV_INLINE
223 ulint
225 /*=================*/
226  const dtuple_t* tuple)
227  __attribute__((nonnull, warn_unused_result));
228 /*********************************************************************/
230 UNIV_INLINE
231 void
233 /*=================*/
234  dtuple_t* tuple,
235  ulint info_bits)
236  __attribute__((nonnull));
237 /*********************************************************************/
240 UNIV_INLINE
241 ulint
243 /*====================*/
244  const dtuple_t* tuple)
245  __attribute__((nonnull, warn_unused_result));
246 /*********************************************************************/
248 UNIV_INLINE
249 void
251 /*====================*/
252  dtuple_t* tuple,
253  ulint n_fields_cmp)
255  __attribute__((nonnull));
256 
257 /* Estimate the number of bytes that are going to be allocated when
258 creating a new dtuple_t object */
259 #define DTUPLE_EST_ALLOC(n_fields) \
260  (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t))
261 
262 /**********************************************************/
268 UNIV_INLINE
269 dtuple_t*
271 /*===================*/
272  void* buf,
273  ulint buf_size,
274  ulint n_fields)
275  __attribute__((nonnull, warn_unused_result));
276 
277 /**********************************************************/
281 UNIV_INLINE
282 dtuple_t*
284 /*==========*/
285  mem_heap_t* heap,
288  ulint n_fields)
289  __attribute__((nonnull, malloc));
290 
291 /*********************************************************************/
294 UNIV_INTERN
295 void
297 /*================*/
298  dtuple_t* tuple,
299  ulint n_fields)
300  __attribute__((nonnull));
301 /*********************************************************************/
305 UNIV_INLINE
306 dtuple_t*
308 /*========*/
309  const dtuple_t* tuple,
310  mem_heap_t* heap)
312  __attribute__((nonnull, malloc));
313 /**********************************************************/
317 UNIV_INLINE
318 ulint
320 /*=================*/
321  const dtuple_t* tuple,
322  ulint comp)
323  __attribute__((nonnull));
324 /*********************************************************************/
327 UNIV_INLINE
328 ulint
330 /*=============*/
331  const dtuple_t* tuple)
332  __attribute__((nonnull));
333 /************************************************************/
337 UNIV_INTERN
338 int
340 /*============*/
341  const dtuple_t* tuple1,
342  const dtuple_t* tuple2)
343  __attribute__((nonnull, warn_unused_result));
344 /************************************************************/
347 UNIV_INLINE
348 ulint
350 /*========*/
351  const dtuple_t* tuple,
352  ulint n_fields,
353  ulint n_bytes,
355  index_id_t tree_id)
356  __attribute__((nonnull, pure, warn_unused_result));
357 /*******************************************************************/
359 UNIV_INLINE
360 void
362 /*====================*/
363  dtuple_t* tuple,
364  ulint n)
365  __attribute__((nonnull));
366 /**********************************************************************/
369 UNIV_INLINE
370 ibool
372 /*=================*/
373  const dtuple_t* tuple)
374  __attribute__((nonnull, warn_unused_result));
375 /**********************************************************/
378 UNIV_INTERN
379 ibool
381 /*===============*/
382  const dfield_t* field)
383  __attribute__((nonnull, warn_unused_result));
384 /**********************************************************/
387 UNIV_INTERN
388 ibool
390 /*===============*/
391  const dtuple_t* tuple)
392  __attribute__((nonnull, warn_unused_result));
393 /**********************************************************/
396 UNIV_INTERN
397 ibool
399 /*=========================*/
400  const dtuple_t* tuple)
401  __attribute__((nonnull, warn_unused_result));
402 #ifdef UNIV_DEBUG
403 /**********************************************************/
407 UNIV_INTERN
408 ibool
410 /*============*/
411  const dtuple_t* tuple)
412  __attribute__((nonnull, warn_unused_result));
413 #endif /* UNIV_DEBUG */
414 /*************************************************************/
416 UNIV_INTERN
417 void
419 /*=========*/
420  const dfield_t* dfield)
421  __attribute__((nonnull));
422 /*************************************************************/
425 UNIV_INTERN
426 void
428 /*==================*/
429  const dfield_t* dfield)
430  __attribute__((nonnull));
431 /**********************************************************/
433 UNIV_INTERN
434 void
436 /*=========*/
437  FILE* f,
438  const dtuple_t* tuple)
439  __attribute__((nonnull));
440 /**************************************************************/
448 UNIV_INTERN
449 big_rec_t*
451 /*===================*/
452  dict_index_t* index,
453  dtuple_t* entry,
454  ulint* n_ext)
456  __attribute__((nonnull, malloc, warn_unused_result));
457 /**************************************************************/
461 UNIV_INTERN
462 void
464 /*========================*/
465  dict_index_t* index,
466  dtuple_t* entry,
467  big_rec_t* vector)
469  __attribute__((nonnull));
470 /**************************************************************/
472 UNIV_INLINE
473 void
475 /*================*/
476  big_rec_t* vector)
478  __attribute__((nonnull));
479 
480 /*######################################################################*/
481 
483 struct dfield_t{
484  void* data;
485  unsigned ext:1;
486  unsigned len:32;
488 };
489 
491 struct dtuple_t {
492  ulint info_bits;
496  ulint n_fields;
497  ulint n_fields_cmp;
505  UT_LIST_NODE_T(dtuple_t) tuple_list;
508 #ifdef UNIV_DEBUG
509  ulint magic_n;
512 # define DATA_TUPLE_MAGIC_N 65478679
513 #endif /* UNIV_DEBUG */
514 };
515 
518  ulint field_no;
519  ulint len;
520  const void* data;
521 };
522 
525 struct big_rec_t {
528  ulint n_fields;
530 };
531 
532 #ifndef UNIV_NONINL
533 #include "data0data.ic"
534 #endif
535 
536 #endif