Drizzled Public API Documentation

data0data.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify it under
00006 the terms of the GNU General Public License as published by the Free Software
00007 Foundation; version 2 of the License.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with
00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00015 St, Fifth Floor, Boston, MA 02110-1301 USA
00016 
00017 *****************************************************************************/
00018 
00019 /********************************************************************/
00026 #pragma once
00027 #ifndef data0data_h
00028 #define data0data_h
00029 
00030 #include "univ.i"
00031 
00032 #include "data0types.h"
00033 #include "data0type.h"
00034 #include "mem0mem.h"
00035 #include "dict0types.h"
00036 
00039 typedef struct big_rec_struct   big_rec_t;
00040 
00041 #ifdef UNIV_DEBUG
00042 /*********************************************************************/
00045 UNIV_INLINE
00046 dtype_t*
00047 dfield_get_type(
00048 /*============*/
00049   const dfield_t* field); 
00050 /*********************************************************************/
00053 UNIV_INLINE
00054 void*
00055 dfield_get_data(
00056 /*============*/
00057   const dfield_t* field); 
00058 #else /* UNIV_DEBUG */
00059 # define dfield_get_type(field) (&(field)->type)
00060 # define dfield_get_data(field) ((field)->data)
00061 #endif /* UNIV_DEBUG */
00062 /*********************************************************************/
00064 UNIV_INLINE
00065 void
00066 dfield_set_type(
00067 /*============*/
00068   dfield_t* field,  
00069   dtype_t*  type);  
00070 /*********************************************************************/
00073 UNIV_INLINE
00074 ulint
00075 dfield_get_len(
00076 /*===========*/
00077   const dfield_t* field); 
00078 /*********************************************************************/
00080 UNIV_INLINE
00081 void
00082 dfield_set_len(
00083 /*===========*/
00084   dfield_t* field,  
00085   ulint   len); 
00086 /*********************************************************************/
00089 UNIV_INLINE
00090 ulint
00091 dfield_is_null(
00092 /*===========*/
00093   const dfield_t* field); 
00094 /*********************************************************************/
00097 UNIV_INLINE
00098 ulint
00099 dfield_is_ext(
00100 /*==========*/
00101   const dfield_t* field); 
00102 /*********************************************************************/
00104 UNIV_INLINE
00105 void
00106 dfield_set_ext(
00107 /*===========*/
00108   dfield_t* field); 
00109 /*********************************************************************/
00111 UNIV_INLINE
00112 void
00113 dfield_set_data(
00114 /*============*/
00115   dfield_t* field,  
00116   const void* data, 
00117   ulint   len); 
00118 /*********************************************************************/
00120 UNIV_INLINE
00121 void
00122 dfield_set_null(
00123 /*============*/
00124   dfield_t* field); 
00125 /**********************************************************************/
00127 UNIV_INLINE
00128 void
00129 data_write_sql_null(
00130 /*================*/
00131   byte* data, 
00132   ulint len); 
00133 /*********************************************************************/
00135 UNIV_INLINE
00136 void
00137 dfield_copy_data(
00138 /*=============*/
00139   dfield_t* field1, 
00140   const dfield_t* field2);
00141 /*********************************************************************/
00143 UNIV_INLINE
00144 void
00145 dfield_copy(
00146 /*========*/
00147   dfield_t* field1, 
00148   const dfield_t* field2);
00149 /*********************************************************************/
00151 UNIV_INLINE
00152 void
00153 dfield_dup(
00154 /*=======*/
00155   dfield_t* field,  
00156   mem_heap_t* heap);  
00157 /*********************************************************************/
00160 UNIV_INLINE
00161 ibool
00162 dfield_datas_are_binary_equal(
00163 /*==========================*/
00164   const dfield_t* field1, 
00165   const dfield_t* field2);
00166 /*********************************************************************/
00169 UNIV_INTERN
00170 ibool
00171 dfield_data_is_binary_equal(
00172 /*========================*/
00173   const dfield_t* field,  
00174   ulint   len,  
00175   const byte* data);  
00176 /*********************************************************************/
00179 UNIV_INLINE
00180 ulint
00181 dtuple_get_n_fields(
00182 /*================*/
00183   const dtuple_t* tuple); 
00184 #ifdef UNIV_DEBUG
00185 /*********************************************************************/
00188 UNIV_INLINE
00189 dfield_t*
00190 dtuple_get_nth_field(
00191 /*=================*/
00192   const dtuple_t* tuple,  
00193   ulint   n); 
00194 #else /* UNIV_DEBUG */
00195 # define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
00196 #endif /* UNIV_DEBUG */
00197 /*********************************************************************/
00200 UNIV_INLINE
00201 ulint
00202 dtuple_get_info_bits(
00203 /*=================*/
00204   const dtuple_t* tuple); 
00205 /*********************************************************************/
00207 UNIV_INLINE
00208 void
00209 dtuple_set_info_bits(
00210 /*=================*/
00211   dtuple_t* tuple,    
00212   ulint   info_bits); 
00213 /*********************************************************************/
00216 UNIV_INLINE
00217 ulint
00218 dtuple_get_n_fields_cmp(
00219 /*====================*/
00220   const dtuple_t* tuple); 
00221 /*********************************************************************/
00223 UNIV_INLINE
00224 void
00225 dtuple_set_n_fields_cmp(
00226 /*====================*/
00227   dtuple_t* tuple,    
00228   ulint   n_fields_cmp);  
00230 /**********************************************************/
00234 UNIV_INLINE
00235 dtuple_t*
00236 dtuple_create(
00237 /*==========*/
00238   mem_heap_t* heap, 
00240   ulint   n_fields); 
00242 /**********************************************************/
00246 UNIV_INLINE
00247 const dtuple_t*
00248 dtuple_from_fields(
00249 /*===============*/
00250   dtuple_t* tuple,    
00251   const dfield_t* fields,   
00252   ulint   n_fields);  
00254 /*********************************************************************/
00257 UNIV_INTERN
00258 void
00259 dtuple_set_n_fields(
00260 /*================*/
00261   dtuple_t* tuple,    
00262   ulint   n_fields);  
00263 /*********************************************************************/
00267 UNIV_INLINE
00268 dtuple_t*
00269 dtuple_copy(
00270 /*========*/
00271   const dtuple_t* tuple,  
00272   mem_heap_t* heap);  
00274 /**********************************************************/
00278 UNIV_INLINE
00279 ulint
00280 dtuple_get_data_size(
00281 /*=================*/
00282   const dtuple_t* tuple,  
00283   ulint   comp);  
00284 /*********************************************************************/
00287 UNIV_INLINE
00288 ulint
00289 dtuple_get_n_ext(
00290 /*=============*/
00291   const dtuple_t* tuple); 
00292 /************************************************************/
00296 UNIV_INTERN
00297 int
00298 dtuple_coll_cmp(
00299 /*============*/
00300   const dtuple_t* tuple1, 
00301   const dtuple_t* tuple2);
00302 /************************************************************/
00305 UNIV_INLINE
00306 ulint
00307 dtuple_fold(
00308 /*========*/
00309   const dtuple_t* tuple,  
00310   ulint   n_fields,
00311   ulint   n_bytes,
00313   index_id_t  tree_id)
00314   __attribute__((pure));
00315 /*******************************************************************/
00317 UNIV_INLINE
00318 void
00319 dtuple_set_types_binary(
00320 /*====================*/
00321   dtuple_t* tuple,  
00322   ulint   n); 
00323 /**********************************************************************/
00326 UNIV_INLINE
00327 ibool
00328 dtuple_contains_null(
00329 /*=================*/
00330   const dtuple_t* tuple); 
00331 /**********************************************************/
00334 UNIV_INTERN
00335 ibool
00336 dfield_check_typed(
00337 /*===============*/
00338   const dfield_t* field); 
00339 /**********************************************************/
00342 UNIV_INTERN
00343 ibool
00344 dtuple_check_typed(
00345 /*===============*/
00346   const dtuple_t* tuple); 
00347 /**********************************************************/
00350 UNIV_INTERN
00351 ibool
00352 dtuple_check_typed_no_assert(
00353 /*=========================*/
00354   const dtuple_t* tuple); 
00355 #ifdef UNIV_DEBUG
00356 /**********************************************************/
00360 UNIV_INTERN
00361 ibool
00362 dtuple_validate(
00363 /*============*/
00364   const dtuple_t* tuple); 
00365 #endif /* UNIV_DEBUG */
00366 /*************************************************************/
00368 UNIV_INTERN
00369 void
00370 dfield_print(
00371 /*=========*/
00372   const dfield_t* dfield);
00373 /*************************************************************/
00376 UNIV_INTERN
00377 void
00378 dfield_print_also_hex(
00379 /*==================*/
00380   const dfield_t* dfield);   
00381 /**********************************************************/
00383 UNIV_INTERN
00384 void
00385 dtuple_print(
00386 /*=========*/
00387   FILE*   f,  
00388   const dtuple_t* tuple); 
00389 /**************************************************************/
00397 UNIV_INTERN
00398 big_rec_t*
00399 dtuple_convert_big_rec(
00400 /*===================*/
00401   dict_index_t* index,  
00402   dtuple_t* entry,  
00403   ulint*    n_ext); 
00405 /**************************************************************/
00409 UNIV_INTERN
00410 void
00411 dtuple_convert_back_big_rec(
00412 /*========================*/
00413   dict_index_t* index,  
00414   dtuple_t* entry,  
00415   big_rec_t*  vector);
00417 /**************************************************************/
00419 UNIV_INLINE
00420 void
00421 dtuple_big_rec_free(
00422 /*================*/
00423   big_rec_t*  vector);  
00426 /*######################################################################*/
00427 
00429 struct dfield_struct{
00430   void*   data; 
00431   unsigned  ext:1;  
00432   unsigned  len:32; 
00433   dtype_t   type; 
00434 };
00435 
00437 struct dtuple_struct {
00438   ulint   info_bits;  
00442   ulint   n_fields; 
00443   ulint   n_fields_cmp; 
00450   dfield_t* fields;   
00451   UT_LIST_NODE_T(dtuple_t) tuple_list;
00454 #ifdef UNIV_DEBUG
00455   ulint   magic_n;  
00458 # define    DATA_TUPLE_MAGIC_N  65478679
00459 #endif /* UNIV_DEBUG */
00460 };
00461 
00463 typedef struct big_rec_field_struct big_rec_field_t;
00465 struct big_rec_field_struct {
00466   ulint   field_no; 
00467   ulint   len;    
00468   const void* data;   
00469 };
00470 
00473 struct big_rec_struct {
00474   mem_heap_t* heap;   
00476   ulint   n_fields; 
00477   big_rec_field_t*fields;   
00478 };
00479 
00480 #ifndef UNIV_NONINL
00481 #include "data0data.ic"
00482 #endif
00483 
00484 #endif