drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
row0mysql.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 2000, 2010, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
26
27#pragma once
28#ifndef row0mysql_h
29#define row0mysql_h
30
31#include "univ.i"
32#include "data0data.h"
33#include "que0types.h"
34#include "dict0types.h"
35#include "trx0types.h"
36#include "row0types.h"
37#include "btr0pcur.h"
38#include "trx0types.h"
39
40extern ibool row_rollback_on_timeout;
41
42typedef struct row_prebuilt_struct row_prebuilt_t;
43
44/*******************************************************************/
46UNIV_INTERN
47void
49/*==============================*/
50 row_prebuilt_t* prebuilt);
52/*******************************************************************/
57UNIV_INTERN
58byte*
60/*=========================*/
61 byte* dest,
62 ulint len,
63 ulint lenlen);
64/*******************************************************************/
69UNIV_INTERN
70const byte*
72/*========================*/
73 ulint* len,
74 const byte* field,
75 ulint lenlen);
77/*******************************************************************/
79UNIV_INTERN
80void
82/*=====================*/
83 byte* dest,
84 ulint col_len,
88 const void* data,
90 ulint len);
94/*******************************************************************/
97UNIV_INTERN
98const byte*
100/*====================*/
101 ulint* len,
102 const byte* ref,
104 ulint col_len);
106/**************************************************************/
108UNIV_INTERN
109void
111/*==============*/
112 ulint mbminlen,
114 byte* pad,
115 ulint len);
116
117/**************************************************************/
122UNIV_INTERN
123byte*
125/*===================================*/
126 dfield_t* dfield,
129 byte* buf,
132 ibool row_format_col,
139 const byte* mysql_data,
144 ulint col_len,
150 ulint comp);
151/****************************************************************/
155UNIV_INTERN
156ibool
158/*====================*/
159 ulint* new_err,
162 trx_t* trx,
163 que_thr_t* thr,
164 trx_savept_t* savept);
165/********************************************************************/
168UNIV_INTERN
169row_prebuilt_t*
171/*================*/
172 dict_table_t* table);
173/********************************************************************/
175UNIV_INTERN
176void
178/*==============*/
179 row_prebuilt_t* prebuilt,
180 ibool dict_locked);
181/*********************************************************************/
184UNIV_INTERN
185void
187/*====================*/
188 row_prebuilt_t* prebuilt,
190 trx_t* trx);
191/*********************************************************************/
195UNIV_INTERN
196void
198/*===============================*/
199 trx_t* trx);
200/*********************************************************************/
207UNIV_INTERN
208int
210/*=============================*/
211 row_prebuilt_t* prebuilt);
213/*********************************************************************/
216UNIV_INTERN
217int
219/*=====================*/
220 row_prebuilt_t* prebuilt,
222 dict_table_t* table,
226 ulint mode);
228
229/*********************************************************************/
232UNIV_INTERN
233int
235/*=================*/
236 byte* mysql_rec,
237 row_prebuilt_t* prebuilt);
239/*********************************************************************/
241UNIV_INTERN
242void
244/*===================*/
245 row_prebuilt_t* prebuilt);
247/*********************************************************************/
252UNIV_INTERN
253upd_t*
255/*===========================*/
256 row_prebuilt_t* prebuilt);
258/*********************************************************************/
262UNIV_INTERN
263ibool
265/*==============================*/
266 const dict_table_t* table);
267/*********************************************************************/
270UNIV_INTERN
271int
273/*=================*/
274 byte* mysql_rec,
276 row_prebuilt_t* prebuilt);
278/*********************************************************************/
288UNIV_INTERN
289int
291/*=================*/
292 row_prebuilt_t* prebuilt,
294 ibool has_latches_on_recs);
299/*********************************************************************/
303UNIV_INTERN
304upd_node_t*
306/*=============================*/
307 dict_table_t* table,
308 mem_heap_t* heap);
309/**********************************************************************/
312UNIV_INTERN
313ulint
315/*=========================*/
316 que_thr_t* thr,
317 upd_node_t* node,
319 dict_table_t* table);
320/*********************************************************************/
323UNIV_INTERN
324void
326/*================================*/
327 trx_t* trx,
328 const char* file,
329 ulint line);
330#define row_mysql_lock_data_dictionary(trx) \
331 row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__)
332/*********************************************************************/
334UNIV_INTERN
335void
337/*=============================*/
338 trx_t* trx);
339/*********************************************************************/
342UNIV_INTERN
343void
345/*==================================*/
346 trx_t* trx,
347 const char* file,
348 ulint line);
349#define row_mysql_freeze_data_dictionary(trx) \
350 row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__)
351/*********************************************************************/
353UNIV_INTERN
354void
356/*===============================*/
357 trx_t* trx);
358/*********************************************************************/
365UNIV_INTERN
366int
368/*=======================*/
369 dict_table_t* table,
371 trx_t* trx);
372/*********************************************************************/
377UNIV_INTERN
378int
380/*=======================*/
381 dict_index_t* index,
383 trx_t* trx,
384 const ulint* field_lengths);
390/*********************************************************************/
398UNIV_INTERN
399int
401/*==============================*/
402 trx_t* trx,
403 const char* sql_string,
408 size_t sql_length,
409 const char* name,
412 ibool reject_fks);
415
416/*********************************************************************/
421UNIV_INTERN
422ulint
424/*=========================================*/
425/*********************************************************************/
429UNIV_INTERN
430ulint
432/*======================================*/
433/*********************************************************************/
436UNIV_INTERN
437int
439/*=========================*/
440 dict_table_t* table,
441 trx_t* trx);
442/*********************************************************************/
450UNIV_INTERN
451int
453/*=====================*/
454 const char* name,
455 trx_t* trx,
456 ibool drop_db);
457/*********************************************************************/
459UNIV_INTERN
460void
462/*============================*/
463
464/*********************************************************************/
469UNIV_INTERN
470int
472/*=============================*/
473 const char* name,
474 trx_t* trx);
475/*****************************************************************/
479UNIV_INTERN
480int
482/*============================*/
483 const char* name,
484 trx_t* trx);
485/*********************************************************************/
488UNIV_INTERN
489int
491/*========================*/
492 const char* name,
493 trx_t* trx);
494/*********************************************************************/
497UNIV_INTERN
498ulint
500/*=======================*/
501 const char* old_name,
502 const char* new_name,
503 trx_t* trx,
504 ibool commit);
505/*********************************************************************/
510UNIV_INTERN
511ulint
513/*======================*/
514 row_prebuilt_t* prebuilt,
516 const dict_index_t* index,
517 ulint* n_rows);
519
520/*********************************************************************/
523UNIV_INTERN
524ibool
526/*=======================*/
527 const char* table_name);
529
530/* A struct describing a place for an individual column in the MySQL
531row format which is presented to the table handler in ha_innobase.
532This template struct is used to speed up row transformations between
533Innobase and MySQL. */
534
535typedef struct mysql_row_templ_struct mysql_row_templ_t;
576
577#define MYSQL_FETCH_CACHE_SIZE 8
578/* After fetching this many rows, we start caching them in fetch_cache */
579#define MYSQL_FETCH_CACHE_THRESHOLD 4
580
581#define ROW_PREBUILT_ALLOCATED 78540783
582#define ROW_PREBUILT_FREED 26423527
583
586
588 ulint magic_n;
592 dict_table_t* table;
593 dict_index_t* index;
595 trx_t* trx;
596 unsigned sql_stat_start:1;
611 unsigned index_usable:1;
613 unsigned read_just_key:1;
619 unsigned template_type:2;
623 unsigned n_template:10;
625 unsigned null_bitmap_len:10;
639 mysql_row_templ_t* mysql_template;
643 mem_heap_t* heap;
646 ins_node_t* ins_node;
652 const byte* default_rec;
663 upd_node_t* upd_node;
665 que_fork_t* ins_graph;
667 que_fork_t* upd_graph;
673 que_fork_t* sel_graph;
675 dtuple_t* search_tuple;
676 byte row_id[DATA_ROW_ID_LEN];
681 dtuple_t* clust_ref;
735 byte* fetch_cache[MYSQL_FETCH_CACHE_SIZE];
753 mem_heap_t* blob_heap;
755 mem_heap_t* old_vers_heap;
757 /*----------------------*/
760 ib_uint64_t autoinc_increment;
764 ib_uint64_t autoinc_offset; /* The offset passed to
765 get_auto_increment() by MySQL. Required
766 to calculate the next value */
772 /*----------------------*/
773 ulint magic_n2;
775};
776
777#define ROW_PREBUILT_FETCH_MAGIC_N 465765687
778
779#define ROW_MYSQL_WHOLE_ROW 0
780#define ROW_MYSQL_REC_FIELDS 1
781#define ROW_MYSQL_NO_TEMPLATE 2
782#define ROW_MYSQL_DUMMY_TEMPLATE 3 /* dummy template used in
783 row_scan_and_check_index */
784
785/* Values for hint_need_to_fetch_extra_cols */
786#define ROW_RETRIEVE_PRIMARY_KEY 1
787#define ROW_RETRIEVE_ALL_COLS 2
788
789/* Values for row_read_type */
790#define ROW_READ_WITH_LOCKS 0
791#define ROW_READ_TRY_SEMI_CONSISTENT 1
792#define ROW_READ_DID_SEMI_CONSISTENT 2
793
794#ifndef UNIV_NONINL
795#include "row0mysql.ic"
796#endif
797
798#endif
struct btr_pcur_struct btr_pcur_t
Definition btr0types.h:36
UNIV_INTERN int row_table_add_foreign_constraints(trx_t *trx, const char *sql_string, size_t sql_length, const char *name, ibool reject_fks)
UNIV_INTERN int row_import_tablespace_for_mysql(const char *name, trx_t *trx)
UNIV_INTERN const byte * row_mysql_read_true_varchar(ulint *len, const byte *field, ulint lenlen)
Definition row0mysql.cc:172
UNIV_INTERN int row_update_for_mysql(byte *mysql_rec, row_prebuilt_t *prebuilt)
UNIV_INTERN ulint row_update_cascade_for_mysql(que_thr_t *thr, upd_node_t *node, dict_table_t *table)
UNIV_INTERN int row_discard_tablespace_for_mysql(const char *name, trx_t *trx)
UNIV_INTERN int row_create_table_for_mysql(dict_table_t *table, trx_t *trx)
UNIV_INTERN int row_lock_table_for_mysql(row_prebuilt_t *prebuilt, dict_table_t *table, ulint mode)
UNIV_INTERN const byte * row_mysql_read_blob_ref(ulint *len, const byte *ref, ulint col_len)
Definition row0mysql.cc:234
UNIV_INTERN void row_mysql_unfreeze_data_dictionary(trx_t *trx)
UNIV_INTERN void row_update_prebuilt_trx(row_prebuilt_t *prebuilt, trx_t *trx)
Definition row0mysql.cc:798
UNIV_INTERN int row_insert_for_mysql(byte *mysql_rec, row_prebuilt_t *prebuilt)
UNIV_INTERN void row_prebuilt_free(row_prebuilt_t *prebuilt, ibool dict_locked)
Definition row0mysql.cc:712
UNIV_INTERN void row_mysql_pad_col(ulint mbminlen, byte *pad, ulint len)
Definition row0mysql.cc:255
UNIV_INTERN ulint row_rename_table_for_mysql(const char *old_name, const char *new_name, trx_t *trx, ibool commit)
UNIV_INTERN void row_prebuild_sel_graph(row_prebuilt_t *prebuilt)
ibool row_rollback_on_timeout
Definition row0mysql.cc:58
UNIV_INTERN void row_unlock_table_autoinc_for_mysql(trx_t *trx)
Definition row0mysql.cc:928
UNIV_INTERN ibool row_is_magic_monitor_table(const char *table_name)
UNIV_INTERN ibool row_table_got_default_clust_index(const dict_table_t *table)
UNIV_INTERN int row_lock_table_autoinc_for_mysql(row_prebuilt_t *prebuilt)
Definition row0mysql.cc:950
UNIV_INTERN ibool row_mysql_handle_errors(ulint *new_err, trx_t *trx, que_thr_t *thr, trx_savept_t *savept)
Definition row0mysql.cc:533
UNIV_INTERN void row_mysql_freeze_data_dictionary_func(trx_t *trx, const char *file, ulint line)
UNIV_INTERN row_prebuilt_t * row_create_prebuilt(dict_table_t *table)
Definition row0mysql.cc:650
UNIV_INTERN int row_drop_database_for_mysql(const char *name, trx_t *trx)
UNIV_INTERN int row_truncate_table_for_mysql(dict_table_t *table, trx_t *trx)
UNIV_INTERN byte * row_mysql_store_true_var_len(byte *dest, ulint len, ulint lenlen)
Definition row0mysql.cc:143
UNIV_INTERN ulint row_check_index_for_mysql(row_prebuilt_t *prebuilt, const dict_index_t *index, ulint *n_rows)
UNIV_INTERN int row_drop_table_for_mysql(const char *name, trx_t *trx, ibool drop_db)
UNIV_INTERN upd_node_t * row_create_update_node_for_mysql(dict_table_t *table, mem_heap_t *heap)
UNIV_INTERN byte * row_mysql_store_col_in_innobase_format(dfield_t *dfield, byte *buf, ibool row_format_col, const byte *mysql_data, ulint col_len, ulint comp)
Definition row0mysql.cc:301
UNIV_INTERN void row_mysql_store_blob_ref(byte *dest, ulint col_len, const void *data, ulint len)
Definition row0mysql.cc:196
UNIV_INTERN void row_mysql_lock_data_dictionary_func(trx_t *trx, const char *file, ulint line)
UNIV_INTERN upd_t * row_get_prebuilt_update_vector(row_prebuilt_t *prebuilt)
UNIV_INTERN int row_create_index_for_mysql(dict_index_t *index, trx_t *trx, const ulint *field_lengths)
UNIV_INTERN void row_mysql_drop_temp_tables(void)
UNIV_INTERN ulint row_get_background_drop_list_len_low(void)
UNIV_INTERN void row_mysql_unlock_data_dictionary(trx_t *trx)
UNIV_INTERN ulint row_drop_tables_for_mysql_in_background(void)
UNIV_INTERN int row_unlock_for_mysql(row_prebuilt_t *prebuilt, ibool has_latches_on_recs)
UNIV_INTERN void row_mysql_prebuilt_free_blob_heap(row_prebuilt_t *prebuilt)
Definition row0mysql.cc:127
upd_node_t * upd_node
Definition row0mysql.h:663
byte * fetch_cache[MYSQL_FETCH_CACHE_SIZE]
Definition row0mysql.h:735
ib_uint64_t autoinc_last_value
Definition row0mysql.h:758
ulint stored_select_lock_type
Definition row0mysql.h:684
mysql_row_templ_t * mysql_template
Definition row0mysql.h:639
unsigned templ_contains_blob
Definition row0mysql.h:633
btr_pcur_t * pcur
Definition row0mysql.h:669
dtuple_t * clust_ref
Definition row0mysql.h:681
mem_heap_t * blob_heap
Definition row0mysql.h:753
unsigned mysql_has_locked
Definition row0mysql.h:600
byte row_id[DATA_ROW_ID_LEN]
Definition row0mysql.h:676
mem_heap_t * heap
Definition row0mysql.h:643
dict_table_t * table
Definition row0mysql.h:592
mem_heap_t * old_vers_heap
Definition row0mysql.h:755
unsigned sql_stat_start
Definition row0mysql.h:596
unsigned template_type
Definition row0mysql.h:619
dtuple_t * search_tuple
Definition row0mysql.h:675
unsigned index_usable
Definition row0mysql.h:611
btr_pcur_t * clust_pcur
Definition row0mysql.h:671
ins_node_t * ins_node
Definition row0mysql.h:646
const byte * default_rec
Definition row0mysql.h:652
dict_index_t * index
Definition row0mysql.h:593
ibool keep_other_fields_on_keyread
Definition row0mysql.h:745
unsigned read_just_key
Definition row0mysql.h:613
unsigned null_bitmap_len
Definition row0mysql.h:625
ulint hint_need_to_fetch_extra_cols
Definition row0mysql.h:654
que_fork_t * sel_graph
Definition row0mysql.h:673
que_fork_t * upd_graph
Definition row0mysql.h:667
unsigned clust_index_was_generated
Definition row0mysql.h:604
unsigned need_to_access_clustered
Definition row0mysql.h:628
ib_uint64_t autoinc_increment
Definition row0mysql.h:760
que_fork_t * ins_graph
Definition row0mysql.h:665
struct trx_savept_struct trx_savept_t
Definition trx0types.h:92