Drizzled Public API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
row0mysql.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Copyright (C) 2000, 2010, 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
/**************************************************/
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
40
extern
ibool
row_rollback_on_timeout
;
41
42
typedef
struct
row_prebuilt_struct
row_prebuilt_t
;
43
44
/*******************************************************************/
46
UNIV_INTERN
47
void
48
row_mysql_prebuilt_free_blob_heap
(
49
/*==============================*/
50
row_prebuilt_t
* prebuilt);
52
/*******************************************************************/
57
UNIV_INTERN
58
byte*
59
row_mysql_store_true_var_len
(
60
/*=========================*/
61
byte* dest,
62
ulint len,
63
ulint lenlen);
64
/*******************************************************************/
69
UNIV_INTERN
70
const
byte*
71
row_mysql_read_true_varchar
(
72
/*========================*/
73
ulint* len,
74
const
byte* field,
75
ulint lenlen);
77
/*******************************************************************/
79
UNIV_INTERN
80
void
81
row_mysql_store_blob_ref
(
82
/*=====================*/
83
byte* dest,
84
ulint col_len,
88
const
void
* data,
90
ulint len);
94
/*******************************************************************/
97
UNIV_INTERN
98
const
byte*
99
row_mysql_read_blob_ref
(
100
/*====================*/
101
ulint* len,
102
const
byte* ref,
104
ulint col_len);
106
/**************************************************************/
108
UNIV_INTERN
109
void
110
row_mysql_pad_col
(
111
/*==============*/
112
ulint mbminlen,
114
byte* pad,
115
ulint len);
117
/**************************************************************/
122
UNIV_INTERN
123
byte*
124
row_mysql_store_col_in_innobase_format
(
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
/****************************************************************/
155
UNIV_INTERN
156
ibool
157
row_mysql_handle_errors
(
158
/*====================*/
159
ulint* new_err,
162
trx_t
*
trx
,
163
que_thr_t
* thr,
164
trx_savept_t
* savept);
165
/********************************************************************/
168
UNIV_INTERN
169
row_prebuilt_t
*
170
row_create_prebuilt
(
171
/*================*/
172
dict_table_t
*
table
);
173
/********************************************************************/
175
UNIV_INTERN
176
void
177
row_prebuilt_free
(
178
/*==============*/
179
row_prebuilt_t
* prebuilt,
180
ibool dict_locked);
181
/*********************************************************************/
184
UNIV_INTERN
185
void
186
row_update_prebuilt_trx
(
187
/*====================*/
188
row_prebuilt_t
* prebuilt,
190
trx_t
*
trx
);
191
/*********************************************************************/
195
UNIV_INTERN
196
void
197
row_unlock_table_autoinc_for_mysql
(
198
/*===============================*/
199
trx_t
*
trx
);
200
/*********************************************************************/
207
UNIV_INTERN
208
int
209
row_lock_table_autoinc_for_mysql
(
210
/*=============================*/
211
row_prebuilt_t
* prebuilt);
213
/*********************************************************************/
216
UNIV_INTERN
217
int
218
row_lock_table_for_mysql
(
219
/*=====================*/
220
row_prebuilt_t
* prebuilt,
222
dict_table_t
*
table
,
226
ulint mode);
229
/*********************************************************************/
232
UNIV_INTERN
233
int
234
row_insert_for_mysql
(
235
/*=================*/
236
byte* mysql_rec,
237
row_prebuilt_t
* prebuilt);
239
/*********************************************************************/
241
UNIV_INTERN
242
void
243
row_prebuild_sel_graph
(
244
/*===================*/
245
row_prebuilt_t
* prebuilt);
247
/*********************************************************************/
252
UNIV_INTERN
253
upd_t
*
254
row_get_prebuilt_update_vector
(
255
/*===========================*/
256
row_prebuilt_t
* prebuilt);
258
/*********************************************************************/
262
UNIV_INTERN
263
ibool
264
row_table_got_default_clust_index
(
265
/*==============================*/
266
const
dict_table_t
*
table
);
267
/*********************************************************************/
270
UNIV_INTERN
271
int
272
row_update_for_mysql
(
273
/*=================*/
274
byte* mysql_rec,
276
row_prebuilt_t
* prebuilt);
278
/*********************************************************************/
288
UNIV_INTERN
289
int
290
row_unlock_for_mysql
(
291
/*=================*/
292
row_prebuilt_t
* prebuilt,
294
ibool has_latches_on_recs);
299
/*********************************************************************/
303
UNIV_INTERN
304
upd_node_t
*
305
row_create_update_node_for_mysql
(
306
/*=============================*/
307
dict_table_t
*
table
,
308
mem_heap_t
*
heap
);
309
/**********************************************************************/
312
UNIV_INTERN
313
ulint
314
row_update_cascade_for_mysql
(
315
/*=========================*/
316
que_thr_t
* thr,
317
upd_node_t
* node,
319
dict_table_t
*
table
);
320
/*********************************************************************/
323
UNIV_INTERN
324
void
325
row_mysql_lock_data_dictionary_func
(
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
/*********************************************************************/
334
UNIV_INTERN
335
void
336
row_mysql_unlock_data_dictionary
(
337
/*=============================*/
338
trx_t
*
trx
);
339
/*********************************************************************/
342
UNIV_INTERN
343
void
344
row_mysql_freeze_data_dictionary_func
(
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
/*********************************************************************/
353
UNIV_INTERN
354
void
355
row_mysql_unfreeze_data_dictionary
(
356
/*===============================*/
357
trx_t
*
trx
);
358
/*********************************************************************/
365
UNIV_INTERN
366
int
367
row_create_table_for_mysql
(
368
/*=======================*/
369
dict_table_t
*
table
,
371
trx_t
*
trx
);
372
/*********************************************************************/
377
UNIV_INTERN
378
int
379
row_create_index_for_mysql
(
380
/*=======================*/
381
dict_index_t
*
index
,
383
trx_t
*
trx
,
384
const
ulint* field_lengths);
390
/*********************************************************************/
398
UNIV_INTERN
399
int
400
row_table_add_foreign_constraints
(
401
/*==============================*/
402
trx_t
*
trx
,
403
const
char
* sql_string,
408
size_t
sql_length,
409
const
char
* name,
412
ibool reject_fks);
416
/*********************************************************************/
421
UNIV_INTERN
422
ulint
423
row_drop_tables_for_mysql_in_background
(
void
);
424
/*=========================================*/
425
/*********************************************************************/
429
UNIV_INTERN
430
ulint
431
row_get_background_drop_list_len_low
(
void
);
432
/*======================================*/
433
/*********************************************************************/
436
UNIV_INTERN
437
int
438
row_truncate_table_for_mysql
(
439
/*=========================*/
440
dict_table_t
*
table
,
441
trx_t
*
trx
);
442
/*********************************************************************/
450
UNIV_INTERN
451
int
452
row_drop_table_for_mysql
(
453
/*=====================*/
454
const
char
* name,
455
trx_t
*
trx
,
456
ibool drop_db);
457
/*********************************************************************/
459
UNIV_INTERN
460
void
461
row_mysql_drop_temp_tables
(
void
);
462
/*============================*/
463
464
/*********************************************************************/
469
UNIV_INTERN
470
int
471
row_discard_tablespace_for_mysql
(
472
/*=============================*/
473
const
char
* name,
474
trx_t
*
trx
);
475
/*****************************************************************/
479
UNIV_INTERN
480
int
481
row_import_tablespace_for_mysql
(
482
/*============================*/
483
const
char
* name,
484
trx_t
*
trx
);
485
/*********************************************************************/
488
UNIV_INTERN
489
int
490
row_drop_database_for_mysql
(
491
/*========================*/
492
const
char
* name,
493
trx_t
*
trx
);
494
/*********************************************************************/
497
UNIV_INTERN
498
ulint
499
row_rename_table_for_mysql
(
500
/*=======================*/
501
const
char
* old_name,
502
const
char
* new_name,
503
trx_t
*
trx
,
504
ibool commit);
505
/*********************************************************************/
510
UNIV_INTERN
511
ulint
512
row_check_index_for_mysql
(
513
/*======================*/
514
row_prebuilt_t
* prebuilt,
516
const
dict_index_t
*
index
,
517
ulint* n_rows);
520
/*********************************************************************/
523
UNIV_INTERN
524
ibool
525
row_is_magic_monitor_table
(
526
/*=======================*/
527
const
char
* table_name);
530
/* A struct describing a place for an individual column in the MySQL
531
row format which is presented to the table handler in ha_innobase.
532
This template struct is used to speed up row transformations between
533
Innobase and MySQL. */
534
535
typedef
struct
mysql_row_templ_struct
mysql_row_templ_t
;
536
struct
mysql_row_templ_struct
{
537
ulint
col_no
;
538
ulint
rec_field_no
;
542
ulint
clust_rec_field_no
;
546
ulint
mysql_col_offset
;
548
ulint
mysql_col_len
;
550
ulint
mysql_null_byte_offset
;
552
ulint
mysql_null_bit_mask
;
554
ulint
type
;
556
ulint
mysql_type
;
558
ulint
mysql_length_bytes
;
566
ulint
charset
;
568
ulint
mbminlen
;
570
ulint
mbmaxlen
;
572
ulint
is_unsigned
;
575
};
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
587
struct
row_prebuilt_struct
{
588
ulint
magic_n
;
592
dict_table_t
*
table
;
593
dict_index_t
*
index
;
595
trx_t
*
trx
;
596
unsigned
sql_stat_start
:1;
600
unsigned
mysql_has_locked
:1;
604
unsigned
clust_index_was_generated
: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;
628
unsigned
need_to_access_clustered
:1;
633
unsigned
templ_contains_blob
:1;
639
mysql_row_templ_t
*
mysql_template
;
643
mem_heap_t
*
heap
;
646
ins_node_t
*
ins_node
;
649
byte*
ins_upd_rec_buff
;
652
const
byte*
default_rec
;
654
ulint
hint_need_to_fetch_extra_cols
;
663
upd_node_t
*
upd_node
;
665
que_fork_t
*
ins_graph
;
667
que_fork_t
*
upd_graph
;
669
btr_pcur_t
*
pcur
;
671
btr_pcur_t
*
clust_pcur
;
673
que_fork_t
*
sel_graph
;
675
dtuple_t
*
search_tuple
;
676
byte
row_id
[DATA_ROW_ID_LEN];
681
dtuple_t
*
clust_ref
;
683
ulint
select_lock_type
;
684
ulint
stored_select_lock_type
;
689
ulint
row_read_type
;
714
ulint
new_rec_locks
;
728
ulint
mysql_prefix_len
;
730
ulint
mysql_row_len
;
732
ulint
n_rows_fetched
;
734
ulint
fetch_direction
;
735
byte*
fetch_cache
[MYSQL_FETCH_CACHE_SIZE];
745
ibool
keep_other_fields_on_keyread
;
749
ulint
fetch_cache_first
;
751
ulint
n_fetch_cached
;
753
mem_heap_t
*
blob_heap
;
755
mem_heap_t
*
old_vers_heap
;
757
/*----------------------*/
758
ib_uint64_t
autoinc_last_value
;
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 */
767
ulint
autoinc_error
;
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
plugin
innobase
include
row0mysql.h
Generated on Tue Jun 19 2012 18:56:54 for drizzle by
1.8.1