Drizzled Public API Documentation

row0sel.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1997, 2010, 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 row0sel_h
00028 #define row0sel_h
00029 
00030 #include "univ.i"
00031 #include "data0data.h"
00032 #include "que0types.h"
00033 #include "dict0types.h"
00034 #include "trx0types.h"
00035 #include "row0types.h"
00036 #include "que0types.h"
00037 #include "pars0sym.h"
00038 #include "btr0pcur.h"
00039 #include "read0read.h"
00040 #include "row0mysql.h"
00041 
00042 /*********************************************************************/
00045 UNIV_INTERN
00046 sel_node_t*
00047 sel_node_create(
00048 /*============*/
00049   mem_heap_t* heap);  
00050 /*********************************************************************/
00053 UNIV_INTERN
00054 void
00055 sel_node_free_private(
00056 /*==================*/
00057   sel_node_t* node);  
00058 /*********************************************************************/
00061 UNIV_INTERN
00062 void
00063 sel_col_prefetch_buf_free(
00064 /*======================*/
00065   sel_buf_t*  prefetch_buf);  
00066 /*********************************************************************/
00069 UNIV_INLINE
00070 plan_t*
00071 sel_node_get_nth_plan(
00072 /*==================*/
00073   sel_node_t* node, 
00074   ulint   i); 
00075 /**********************************************************************/
00079 UNIV_INTERN
00080 que_thr_t*
00081 row_sel_step(
00082 /*=========*/
00083   que_thr_t*  thr); 
00084 /**********************************************************************/
00087 UNIV_INLINE
00088 que_thr_t*
00089 open_step(
00090 /*======*/
00091   que_thr_t*  thr); 
00092 /**********************************************************************/
00095 UNIV_INTERN
00096 que_thr_t*
00097 fetch_step(
00098 /*=======*/
00099   que_thr_t*  thr); 
00100 /****************************************************************/
00103 UNIV_INTERN
00104 void*
00105 row_fetch_print(
00106 /*============*/
00107   void* row,    
00108   void* user_arg);  
00109 /***********************************************************/
00112 UNIV_INTERN
00113 que_thr_t*
00114 row_printf_step(
00115 /*============*/
00116   que_thr_t*  thr); 
00117 /****************************************************************/
00123 UNIV_INTERN
00124 void
00125 row_sel_convert_mysql_key_to_innobase(
00126 /*==================================*/
00127   dtuple_t* tuple,    
00131   byte*   buf,    
00133   ulint   buf_len,  
00134   dict_index_t* index,    
00135   const byte* key_ptr,  
00136   ulint   key_len,  
00137   trx_t*    trx);   
00138 /********************************************************************/
00146 UNIV_INTERN
00147 ulint
00148 row_search_for_mysql(
00149 /*=================*/
00150   byte*   buf,    
00152   ulint   mode,   
00153   row_prebuilt_t* prebuilt, 
00160   ulint   match_mode, 
00162   ulint   direction); 
00167 /*******************************************************************/
00171 UNIV_INTERN
00172 ibool
00173 row_search_check_if_query_cache_permitted(
00174 /*======================================*/
00175   trx_t*    trx,    
00176   const char* norm_name); 
00178 /*******************************************************************/
00181 UNIV_INTERN
00182 ulint
00183 row_search_max_autoinc(
00184 /*===================*/
00185   dict_index_t* index,    
00186   const char* col_name, 
00187   ib_uint64_t*  value);   
00190 struct sel_buf_struct{
00191   byte*   data; 
00195   ulint   len;  
00196   ulint   val_buf_size;
00200 };
00201 
00203 struct plan_struct{
00204   dict_table_t* table;    
00206   dict_index_t* index;    
00207   btr_pcur_t  pcur;   
00209   ibool   asc;    
00210   ibool   pcur_is_open; 
00212   ibool   cursor_at_end;  
00219   ibool   stored_cursor_rec_processed;
00223   que_node_t**  tuple_exps; 
00229   dtuple_t* tuple;    
00230   ulint   mode;   
00231   ulint   n_exact_match;  
00234   ibool   unique_search;  
00236   ulint   n_rows_fetched; 
00238   ulint   n_rows_prefetched;
00241   ulint   first_prefetched;
00243   ibool   no_prefetch;  
00244   sym_node_list_t columns;  
00246   UT_LIST_BASE_NODE_T(func_node_t)
00247       end_conds;  
00255   UT_LIST_BASE_NODE_T(func_node_t)
00256       other_conds;  
00258   ibool   must_get_clust; 
00266   ulint*    clust_map;  
00269   dtuple_t* clust_ref;  
00272   btr_pcur_t  clust_pcur; 
00275   mem_heap_t* old_vers_heap;  
00277 };
00278 
00280 enum sel_node_state {
00281   SEL_NODE_CLOSED,  
00283   SEL_NODE_OPEN,    
00284   SEL_NODE_FETCH,   
00285   SEL_NODE_NO_MORE_ROWS 
00286 };
00287 
00289 struct sel_node_struct{
00290   que_common_t  common;   
00291   enum sel_node_state
00292       state;  
00293   que_node_t* select_list;  
00294   sym_node_t* into_list;  
00295   sym_node_t* table_list; 
00296   ibool   asc;    
00298   ibool   set_x_locks;  
00301   ulint   row_lock_mode;  
00302   ulint   n_tables; 
00303   ulint   fetch_table;  
00305   plan_t*   plans;    
00308   que_node_t* search_cond;  
00309   read_view_t*  read_view;  
00312   ibool   consistent_read;
00314   order_node_t* order_by; 
00316   ibool   is_aggregate; 
00318   ibool   aggregate_already_fetched;
00322   ibool   can_get_updated;
00333   sym_node_t* explicit_cursor;
00334   UT_LIST_BASE_NODE_T(sym_node_t)
00335       copy_variables; 
00339 };
00340 
00342 struct fetch_node_struct{
00343   que_common_t  common;   
00344   sel_node_t* cursor_def; 
00345   sym_node_t* into_list;  
00347   pars_user_func_t*
00348       func;   
00360 };
00361 
00363 enum open_node_op {
00364   ROW_SEL_OPEN_CURSOR,  
00365   ROW_SEL_CLOSE_CURSOR  
00366 };
00367 
00369 struct open_node_struct{
00370   que_common_t  common;   
00371   enum open_node_op
00372       op_type;  
00374   sel_node_t* cursor_def; 
00375 };
00376 
00378 struct row_printf_node_struct{
00379   que_common_t  common;   
00380   sel_node_t* sel_node; 
00381 };
00382 
00384 enum row_sel_direction {
00385   ROW_SEL_NEXT = 1, 
00386   ROW_SEL_PREV = 2  
00387 };
00388 
00390 enum row_sel_match_mode {
00391   ROW_SEL_EXACT = 1,  
00392   ROW_SEL_EXACT_PREFIX  
00397 };
00398 
00399 #ifndef UNIV_NONINL
00400 #include "row0sel.ic"
00401 #endif
00402 
00403 #endif