40
41
typedef struct row_prebuilt_struct row_prebuilt_t;
42
/***********************************************************************
43
/*******************************************************************//**
43
44
Frees the blob heap in prebuilt when no longer needed. */
46
47
row_mysql_prebuilt_free_blob_heap(
47
48
/*==============================*/
48
row_prebuilt_t* prebuilt); /* in: prebuilt struct of a
49
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct of a
49
50
ha_innobase:: table handle */
50
/***********************************************************************
51
/*******************************************************************//**
51
52
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row
54
@return pointer to the data, we skip the 1 or 2 bytes at the start
55
that are used to store the len */
55
58
row_mysql_store_true_var_len(
56
59
/*=========================*/
57
/* out: pointer to the data, we skip the 1 or 2 bytes
58
at the start that are used to store the len */
59
byte* dest, /* in: where to store */
60
ulint len, /* in: length, must fit in two bytes */
61
ulint lenlen);/* in: storage length of len: either 1 or 2 bytes */
62
/***********************************************************************
60
byte* dest, /*!< in: where to store */
61
ulint len, /*!< in: length, must fit in two bytes */
62
ulint lenlen);/*!< in: storage length of len: either 1 or 2 bytes */
63
/*******************************************************************//**
63
64
Reads a >= 5.0.3 format true VARCHAR length, in the MySQL row format, and
64
returns a pointer to the data. */
65
returns a pointer to the data.
66
@return pointer to the data, we skip the 1 or 2 bytes at the start
67
that are used to store the len */
67
70
row_mysql_read_true_varchar(
68
71
/*========================*/
69
/* out: pointer to the data, we skip
70
the 1 or 2 bytes at the start that are
71
used to store the len */
72
ulint* len, /* out: variable-length field length */
73
const byte* field, /* in: field in the MySQL format */
74
ulint lenlen);/* in: storage length of len: either 1
72
ulint* len, /*!< out: variable-length field length */
73
const byte* field, /*!< in: field in the MySQL format */
74
ulint lenlen);/*!< in: storage length of len: either 1
76
/***********************************************************************
76
/*******************************************************************//**
77
77
Stores a reference to a BLOB in the MySQL format. */
80
80
row_mysql_store_blob_ref(
81
81
/*=====================*/
82
byte* dest, /* in: where to store */
83
ulint col_len,/* in: dest buffer size: determines into
82
byte* dest, /*!< in: where to store */
83
ulint col_len,/*!< in: dest buffer size: determines into
84
84
how many bytes the BLOB length is stored,
85
85
the space for the length may vary from 1
87
const void* data, /* in: BLOB data; if the value to store
87
const void* data, /*!< in: BLOB data; if the value to store
88
88
is SQL NULL this should be NULL pointer */
89
ulint len); /* in: BLOB length; if the value to store
89
ulint len); /*!< in: BLOB length; if the value to store
90
90
is SQL NULL this should be 0; remember
91
91
also to set the NULL bit in the MySQL record
93
/***********************************************************************
94
Reads a reference to a BLOB in the MySQL format. */
93
/*******************************************************************//**
94
Reads a reference to a BLOB in the MySQL format.
95
@return pointer to BLOB data */
97
98
row_mysql_read_blob_ref(
98
99
/*====================*/
99
/* out: pointer to BLOB data */
100
ulint* len, /* out: BLOB length */
101
const byte* ref, /* in: BLOB reference in the
100
ulint* len, /*!< out: BLOB length */
101
const byte* ref, /*!< in: BLOB reference in the
103
ulint col_len); /* in: BLOB reference length
103
ulint col_len); /*!< in: BLOB reference length
104
104
(not BLOB length) */
105
/******************************************************************
105
/**************************************************************//**
106
106
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
107
107
The counterpart of this function is row_sel_field_store_in_mysql_format() in
109
@return up to which byte we used buf in the conversion */
111
112
row_mysql_store_col_in_innobase_format(
112
113
/*===================================*/
113
/* out: up to which byte we used
114
buf in the conversion */
115
dfield_t* dfield, /* in/out: dfield where dtype
114
dfield_t* dfield, /*!< in/out: dfield where dtype
116
115
information must be already set when
117
116
this function is called! */
118
byte* buf, /* in/out: buffer for a converted
117
byte* buf, /*!< in/out: buffer for a converted
119
118
integer value; this must be at least
120
119
col_len long then! */
121
ibool row_format_col, /* TRUE if the mysql_data is from
120
ibool row_format_col, /*!< TRUE if the mysql_data is from
122
121
a MySQL row, FALSE if from a MySQL
124
123
in MySQL, a true VARCHAR storage
125
124
format differs in a row and in a
126
125
key value: in a key value the length
127
126
is always stored in 2 bytes! */
128
const byte* mysql_data, /* in: MySQL column value, not
127
const byte* mysql_data, /*!< in: MySQL column value, not
129
128
SQL NULL; NOTE that dfield may also
130
129
get a pointer to mysql_data,
131
130
therefore do not discard this as long
132
131
as dfield is used! */
133
ulint col_len, /* in: MySQL column length; NOTE that
132
ulint col_len, /*!< in: MySQL column length; NOTE that
134
133
this is the storage length of the
135
134
column in the MySQL format row, not
136
135
necessarily the length of the actual
137
136
payload data; if the column is a true
138
137
VARCHAR then this is irrelevant */
139
ulint comp); /* in: nonzero=compact format */
140
/********************************************************************
141
Handles user errors and lock waits detected by the database engine. */
138
ulint comp); /*!< in: nonzero=compact format */
139
/****************************************************************//**
140
Handles user errors and lock waits detected by the database engine.
141
@return TRUE if it was a lock wait and we should continue running the
144
145
row_mysql_handle_errors(
145
146
/*====================*/
146
/* out: TRUE if it was a lock wait and
147
we should continue running the query thread */
148
ulint* new_err,/* out: possible new error encountered in
147
ulint* new_err,/*!< out: possible new error encountered in
149
148
rollback, or the old error which was
150
149
during the function entry */
151
trx_t* trx, /* in: transaction */
152
que_thr_t* thr, /* in: query thread */
153
trx_savept_t* savept);/* in: savepoint */
154
/************************************************************************
155
Create a prebuilt struct for a MySQL table handle. */
150
trx_t* trx, /*!< in: transaction */
151
que_thr_t* thr, /*!< in: query thread */
152
trx_savept_t* savept);/*!< in: savepoint */
153
/********************************************************************//**
154
Create a prebuilt struct for a MySQL table handle.
155
@return own: a prebuilt struct */
158
158
row_create_prebuilt(
159
159
/*================*/
160
/* out, own: a prebuilt struct */
161
dict_table_t* table); /* in: Innobase table handle */
162
/************************************************************************
160
dict_table_t* table); /*!< in: Innobase table handle */
161
/********************************************************************//**
163
162
Free a prebuilt struct for a MySQL table handle. */
166
165
row_prebuilt_free(
167
166
/*==============*/
168
row_prebuilt_t* prebuilt, /* in, own: prebuilt struct */
169
ibool dict_locked); /* in: TRUE=data dictionary locked */
170
/*************************************************************************
167
row_prebuilt_t* prebuilt, /*!< in, own: prebuilt struct */
168
ibool dict_locked); /*!< in: TRUE=data dictionary locked */
169
/*********************************************************************//**
171
170
Updates the transaction pointers in query graphs stored in the prebuilt
175
174
row_update_prebuilt_trx(
176
175
/*====================*/
177
/* out: prebuilt dtuple */
178
row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL
180
trx_t* trx); /* in: transaction handle */
181
/*************************************************************************
176
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct
178
trx_t* trx); /*!< in: transaction handle */
179
/*********************************************************************//**
182
180
Unlocks AUTO_INC type locks that were possibly reserved by a trx. */
185
183
row_unlock_table_autoinc_for_mysql(
186
184
/*===============================*/
187
trx_t* trx); /* in/out: transaction */
188
/*************************************************************************
185
trx_t* trx); /*!< in/out: transaction */
186
/*********************************************************************//**
189
187
Sets an AUTO_INC type lock on the table mentioned in prebuilt. The
190
188
AUTO_INC lock gives exclusive access to the auto-inc counter of the
191
189
table. The lock is reserved only for the duration of an SQL statement.
192
190
It is not compatible with another AUTO_INC or exclusive lock on the
192
@return error code or DB_SUCCESS */
196
195
row_lock_table_autoinc_for_mysql(
197
196
/*=============================*/
198
/* out: error code or DB_SUCCESS */
199
row_prebuilt_t* prebuilt); /* in: prebuilt struct in the MySQL
197
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in the MySQL
201
/*************************************************************************
202
Sets a table lock on the table mentioned in prebuilt. */
199
/*********************************************************************//**
200
Sets a table lock on the table mentioned in prebuilt.
201
@return error code or DB_SUCCESS */
205
204
row_lock_table_for_mysql(
206
205
/*=====================*/
207
/* out: error code or DB_SUCCESS */
208
row_prebuilt_t* prebuilt, /* in: prebuilt struct in the MySQL
206
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in the MySQL
210
dict_table_t* table, /* in: table to lock, or NULL
208
dict_table_t* table, /*!< in: table to lock, or NULL
211
209
if prebuilt->table should be
213
211
prebuilt->select_lock_type */
214
ulint mode); /* in: lock mode of table
212
ulint mode); /*!< in: lock mode of table
215
213
(ignored if table==NULL) */
217
/*************************************************************************
218
Does an insert for MySQL. */
215
/*********************************************************************//**
216
Does an insert for MySQL.
217
@return error code or DB_SUCCESS */
221
220
row_insert_for_mysql(
222
221
/*=================*/
223
/* out: error code or DB_SUCCESS */
224
byte* mysql_rec, /* in: row in the MySQL format */
225
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
222
byte* mysql_rec, /*!< in: row in the MySQL format */
223
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
227
/*************************************************************************
225
/*********************************************************************//**
228
226
Builds a dummy query graph used in selects. */
231
229
row_prebuild_sel_graph(
232
230
/*===================*/
233
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
231
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
235
/*************************************************************************
233
/*********************************************************************//**
236
234
Gets pointer to a prebuilt update vector used in updates. If the update
237
235
graph has not yet been built in the prebuilt struct, then this function
237
@return prebuilt update vector */
241
240
row_get_prebuilt_update_vector(
242
241
/*===========================*/
243
/* out: prebuilt update vector */
244
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
242
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
246
/*************************************************************************
244
/*********************************************************************//**
247
245
Checks if a table is such that we automatically created a clustered
248
index on it (on row id). */
246
index on it (on row id).
247
@return TRUE if the clustered index was generated automatically */
251
250
row_table_got_default_clust_index(
252
251
/*==============================*/
253
const dict_table_t* table);
254
/*************************************************************************
252
const dict_table_t* table); /*!< in: table */
253
/*********************************************************************//**
255
254
Calculates the key number used inside MySQL for an Innobase index. We have
256
to take into account if we generated a default clustered index for the table */
255
to take into account if we generated a default clustered index for the table
256
@return the key number used inside MySQL */
259
259
row_get_mysql_key_number_for_index(
260
260
/*===============================*/
261
const dict_index_t* index);
262
/*************************************************************************
263
Does an update or delete of a row for MySQL. */
261
const dict_index_t* index); /*!< in: index */
262
/*********************************************************************//**
263
Does an update or delete of a row for MySQL.
264
@return error code or DB_SUCCESS */
266
267
row_update_for_mysql(
267
268
/*=================*/
268
/* out: error code or DB_SUCCESS */
269
byte* mysql_rec, /* in: the row to be updated, in
269
byte* mysql_rec, /*!< in: the row to be updated, in
270
270
the MySQL format */
271
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
271
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
273
/*************************************************************************
273
/*********************************************************************//**
274
274
This can only be used when srv_locks_unsafe_for_binlog is TRUE or
275
275
session is using a READ COMMITTED isolation level. Before
276
276
calling this function we must use trx_reset_new_rec_lock_info() and
280
280
in the case of an UPDATE or a DELETE statement, where the row lock is of the
282
282
Thus, this implements a 'mini-rollback' that releases the latest record
284
@return error code or DB_SUCCESS */
286
287
row_unlock_for_mysql(
287
288
/*=================*/
288
/* out: error code or DB_SUCCESS */
289
row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL
289
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL
291
ibool has_latches_on_recs);/* TRUE if called so that we have
291
ibool has_latches_on_recs);/*!< TRUE if called so that we have
292
292
the latches on the records under pcur
293
293
and clust_pcur, and we do not need to
294
294
reposition the cursors. */
295
/*************************************************************************
295
/*********************************************************************//**
296
296
Creates an query graph node of 'update' type to be used in the MySQL
298
@return own: update node */
300
301
row_create_update_node_for_mysql(
301
302
/*=============================*/
302
/* out, own: update node */
303
dict_table_t* table, /* in: table to update */
304
mem_heap_t* heap); /* in: mem heap from which allocated */
305
/**************************************************************************
306
Does a cascaded delete or set null in a foreign key operation. */
303
dict_table_t* table, /*!< in: table to update */
304
mem_heap_t* heap); /*!< in: mem heap from which allocated */
305
/**********************************************************************//**
306
Does a cascaded delete or set null in a foreign key operation.
307
@return error code or DB_SUCCESS */
309
310
row_update_cascade_for_mysql(
310
311
/*=========================*/
311
/* out: error code or DB_SUCCESS */
312
que_thr_t* thr, /* in: query thread */
313
upd_node_t* node, /* in: update node used in the cascade
312
que_thr_t* thr, /*!< in: query thread */
313
upd_node_t* node, /*!< in: update node used in the cascade
314
314
or set null operation */
315
dict_table_t* table); /* in: table where we do the operation */
316
/*************************************************************************
315
dict_table_t* table); /*!< in: table where we do the operation */
316
/*********************************************************************//**
317
317
Locks the data dictionary exclusively for performing a table create or other
318
318
data dictionary modification operation. */
321
321
row_mysql_lock_data_dictionary_func(
322
322
/*================================*/
323
trx_t* trx, /* in/out: transaction */
324
const char* file, /* in: file name */
325
ulint line); /* in: line number */
323
trx_t* trx, /*!< in/out: transaction */
324
const char* file, /*!< in: file name */
325
ulint line); /*!< in: line number */
326
326
#define row_mysql_lock_data_dictionary(trx) \
327
327
row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__)
328
/*************************************************************************
328
/*********************************************************************//**
329
329
Unlocks the data dictionary exclusive lock. */
332
332
row_mysql_unlock_data_dictionary(
333
333
/*=============================*/
334
trx_t* trx); /* in/out: transaction */
335
/*************************************************************************
334
trx_t* trx); /*!< in/out: transaction */
335
/*********************************************************************//**
336
336
Locks the data dictionary in shared mode from modifications, for performing
337
337
foreign key check, rollback, or other operation invisible to MySQL. */
340
340
row_mysql_freeze_data_dictionary_func(
341
341
/*==================================*/
342
trx_t* trx, /* in/out: transaction */
343
const char* file, /* in: file name */
344
ulint line); /* in: line number */
342
trx_t* trx, /*!< in/out: transaction */
343
const char* file, /*!< in: file name */
344
ulint line); /*!< in: line number */
345
345
#define row_mysql_freeze_data_dictionary(trx) \
346
346
row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__)
347
/*************************************************************************
347
/*********************************************************************//**
348
348
Unlocks the data dictionary shared lock. */
351
351
row_mysql_unfreeze_data_dictionary(
352
352
/*===============================*/
353
trx_t* trx); /* in/out: transaction */
354
#ifndef UNIV_HOTBACKUP
355
/*************************************************************************
353
trx_t* trx); /*!< in/out: transaction */
354
/*********************************************************************//**
356
355
Creates a table for MySQL. If the name of the table ends in
357
356
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
358
357
"innodb_table_monitor", then this will also start the printing of monitor
359
358
output by the master thread. If the table name ends in "innodb_mem_validate",
360
InnoDB will try to invoke mem_validate(). */
359
InnoDB will try to invoke mem_validate().
360
@return error code or DB_SUCCESS */
363
363
row_create_table_for_mysql(
364
364
/*=======================*/
365
/* out: error code or DB_SUCCESS */
366
dict_table_t* table, /* in, own: table definition
365
dict_table_t* table, /*!< in, own: table definition
367
366
(will be freed) */
368
trx_t* trx); /* in: transaction handle */
369
/*************************************************************************
367
trx_t* trx); /*!< in: transaction handle */
368
/*********************************************************************//**
370
369
Does an index creation operation for MySQL. TODO: currently failure
371
370
to create an index results in dropping the whole table! This is no problem
372
currently as all indexes must be created at the same time as the table. */
371
currently as all indexes must be created at the same time as the table.
372
@return error number or DB_SUCCESS */
375
375
row_create_index_for_mysql(
376
376
/*=======================*/
377
/* out: error number or DB_SUCCESS */
378
dict_index_t* index, /* in, own: index definition
377
dict_index_t* index, /*!< in, own: index definition
379
378
(will be freed) */
380
trx_t* trx, /* in: transaction handle */
381
const ulint* field_lengths); /* in: if not NULL, must contain
379
trx_t* trx, /*!< in: transaction handle */
380
const ulint* field_lengths); /*!< in: if not NULL, must contain
382
381
dict_index_get_n_fields(index)
383
382
actual field lengths for the
384
383
index columns, which are
385
384
then checked for not being too
387
/*************************************************************************
386
/*********************************************************************//**
388
387
Scans a table create SQL string and adds to the data dictionary
389
388
the foreign key constraints declared in the string. This function
390
389
should be called after the indexes for a table have been created.
391
390
Each foreign key constraint must be accompanied with indexes in
392
391
bot participating tables. The indexes are allowed to contain more
393
fields than mentioned in the constraint. */
392
fields than mentioned in the constraint.
393
@return error code or DB_SUCCESS */
396
396
row_table_add_foreign_constraints(
397
397
/*==============================*/
398
/* out: error code or DB_SUCCESS */
399
trx_t* trx, /* in: transaction */
400
const char* sql_string, /* in: table create statement where
398
trx_t* trx, /*!< in: transaction */
399
const char* sql_string, /*!< in: table create statement where
401
400
foreign keys are declared like:
402
401
FOREIGN KEY (a, b) REFERENCES table2(c, d),
403
402
table2 can be written also with the
404
403
database name before it: test.table2 */
405
const char* name, /* in: table full name in the
404
const char* name, /*!< in: table full name in the
407
406
database_name/table_name */
408
ibool reject_fks); /* in: if TRUE, fail with error
407
ibool reject_fks); /*!< in: if TRUE, fail with error
409
408
code DB_CANNOT_ADD_CONSTRAINT if
410
409
any foreign keys are found. */
412
/*************************************************************************
411
/*********************************************************************//**
413
412
The master thread in srv0srv.c calls this regularly to drop tables which
414
413
we must drop in background after queries to them have ended. Such lazy
415
dropping of tables is needed in ALTER TABLE on Unix. */
414
dropping of tables is needed in ALTER TABLE on Unix.
415
@return how many tables dropped + remaining tables in list */
418
418
row_drop_tables_for_mysql_in_background(void);
419
419
/*=========================================*/
420
/* out: how many tables dropped
421
+ remaining tables in list */
422
/*************************************************************************
420
/*********************************************************************//**
423
421
Get the background drop list length. NOTE: the caller must own the kernel
423
@return how many tables in list */
427
426
row_get_background_drop_list_len_low(void);
428
427
/*======================================*/
429
/* out: how many tables in list */
430
/*************************************************************************
431
Truncates a table for MySQL. */
428
/*********************************************************************//**
429
Truncates a table for MySQL.
430
@return error code or DB_SUCCESS */
434
433
row_truncate_table_for_mysql(
435
434
/*=========================*/
436
/* out: error code or DB_SUCCESS */
437
dict_table_t* table, /* in: table handle */
438
trx_t* trx); /* in: transaction handle */
439
/*************************************************************************
435
dict_table_t* table, /*!< in: table handle */
436
trx_t* trx); /*!< in: transaction handle */
437
/*********************************************************************//**
440
438
Drops a table for MySQL. If the name of the dropped table ends in
441
439
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
442
440
"innodb_table_monitor", then this will also stop the printing of monitor
443
441
output by the master thread. If the data dictionary was not already locked
444
442
by the transaction, the transaction will be committed. Otherwise, the
445
data dictionary will remain locked. */
443
data dictionary will remain locked.
444
@return error code or DB_SUCCESS */
448
447
row_drop_table_for_mysql(
449
448
/*=====================*/
450
/* out: error code or DB_SUCCESS */
451
const char* name, /* in: table name */
452
trx_t* trx, /* in: transaction handle */
453
ibool drop_db);/* in: TRUE=dropping whole database */
449
const char* name, /*!< in: table name */
450
trx_t* trx, /*!< in: transaction handle */
451
ibool drop_db);/*!< in: TRUE=dropping whole database */
455
/*************************************************************************
453
/*********************************************************************//**
456
454
Discards the tablespace of a table which stored in an .ibd file. Discarding
457
455
means that this function deletes the .ibd file and assigns a new table id for
458
the table. Also the flag table->ibd_file_missing is set TRUE. */
456
the table. Also the flag table->ibd_file_missing is set TRUE.
457
@return error code or DB_SUCCESS */
461
460
row_discard_tablespace_for_mysql(
462
461
/*=============================*/
463
/* out: error code or DB_SUCCESS */
464
const char* name, /* in: table name */
465
trx_t* trx); /* in: transaction handle */
466
/*********************************************************************
462
const char* name, /*!< in: table name */
463
trx_t* trx); /*!< in: transaction handle */
464
/*****************************************************************//**
467
465
Imports a tablespace. The space id in the .ibd file must match the space id
468
of the table in the data dictionary. */
466
of the table in the data dictionary.
467
@return error code or DB_SUCCESS */
471
470
row_import_tablespace_for_mysql(
472
471
/*============================*/
473
/* out: error code or DB_SUCCESS */
474
const char* name, /* in: table name */
475
trx_t* trx); /* in: transaction handle */
476
/*************************************************************************
477
Drops a database for MySQL. */
472
const char* name, /*!< in: table name */
473
trx_t* trx); /*!< in: transaction handle */
474
/*********************************************************************//**
475
Drops a database for MySQL.
476
@return error code or DB_SUCCESS */
480
479
row_drop_database_for_mysql(
481
480
/*========================*/
482
/* out: error code or DB_SUCCESS */
483
const char* name, /* in: database name which ends to '/' */
484
trx_t* trx); /* in: transaction handle */
485
/*************************************************************************
486
Renames a table for MySQL. */
481
const char* name, /*!< in: database name which ends to '/' */
482
trx_t* trx); /*!< in: transaction handle */
483
/*********************************************************************//**
484
Renames a table for MySQL.
485
@return error code or DB_SUCCESS */
489
488
row_rename_table_for_mysql(
490
489
/*=======================*/
491
/* out: error code or DB_SUCCESS */
492
const char* old_name, /* in: old table name */
493
const char* new_name, /* in: new table name */
494
trx_t* trx, /* in: transaction handle */
495
ibool commit); /* in: if TRUE then commit trx */
496
/*************************************************************************
497
Checks a table for corruption. */
490
const char* old_name, /*!< in: old table name */
491
const char* new_name, /*!< in: new table name */
492
trx_t* trx, /*!< in: transaction handle */
493
ibool commit); /*!< in: if TRUE then commit trx */
494
/*********************************************************************//**
495
Checks a table for corruption.
496
@return DB_ERROR or DB_SUCCESS */
500
499
row_check_table_for_mysql(
501
500
/*======================*/
502
/* out: DB_ERROR or DB_SUCCESS */
503
row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL
501
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL
505
#endif /* !UNIV_HOTBACKUP */
507
/*************************************************************************
508
Determines if a table is a magic monitor table. */
504
/*********************************************************************//**
505
Determines if a table is a magic monitor table.
506
@return TRUE if monitor table */
511
509
row_is_magic_monitor_table(
512
510
/*=======================*/
513
/* out: TRUE if monitor table */
514
const char* table_name); /* in: name of the table, in the
511
const char* table_name); /*!< in: name of the table, in the
515
512
form database/table_name */
517
514
/* A struct describing a place for an individual column in the MySQL
564
561
#define ROW_PREBUILT_ALLOCATED 78540783
565
562
#define ROW_PREBUILT_FREED 26423527
567
typedef int64_t (*index_cond_func_t)(void *param);
569
/* A struct for (sometimes lazily) prebuilt structures in an Innobase table
564
/** A struct for (sometimes lazily) prebuilt structures in an Innobase table
570
565
handle used within MySQL; these are used to save CPU time. */
572
567
struct row_prebuilt_struct {
573
ulint magic_n; /* this magic number is set to
568
ulint magic_n; /*!< this magic number is set to
574
569
ROW_PREBUILT_ALLOCATED when created,
575
570
or ROW_PREBUILT_FREED when the
576
571
struct has been freed */
577
dict_table_t* table; /* Innobase table handle */
578
trx_t* trx; /* current transaction handle */
579
ibool sql_stat_start; /* TRUE when we start processing of
572
dict_table_t* table; /*!< Innobase table handle */
573
dict_index_t* index; /*!< current index for a search, if
575
trx_t* trx; /*!< current transaction handle */
576
unsigned sql_stat_start:1;/*!< TRUE when we start processing of
580
577
an SQL statement: we may have to set
581
578
an intention lock on the table,
582
579
create a consistent read view etc. */
583
ibool mysql_has_locked; /* this is set TRUE when MySQL
580
unsigned mysql_has_locked:1;/*!< this is set TRUE when MySQL
584
581
calls external_lock on this handle
585
582
with a lock flag, and set FALSE when
586
583
with the F_UNLOCK flag */
587
ibool clust_index_was_generated;
588
/* if the user did not define a
584
unsigned clust_index_was_generated:1;
585
/*!< if the user did not define a
589
586
primary key in MySQL, then Innobase
590
587
automatically generated a clustered
591
588
index where the ordering column is
592
589
the row id: in this case this flag
593
590
is set to TRUE */
594
dict_index_t* index; /* current index for a search, if
596
ulint read_just_key; /* set to 1 when MySQL calls
591
unsigned index_usable:1; /*!< caches the value of
592
row_merge_is_index_usable(trx,index) */
593
unsigned read_just_key:1;/*!< set to 1 when MySQL calls
597
594
ha_innobase::extra with the
598
595
argument HA_EXTRA_KEYREAD; it is enough
599
596
to read just columns defined in
600
597
the index (i.e., no read of the
601
598
clustered index record necessary) */
602
ibool used_in_HANDLER;/* TRUE if we have been using this
599
unsigned used_in_HANDLER:1;/*!< TRUE if we have been using this
603
600
handle in a MySQL HANDLER low level
604
601
index cursor command: then we must
605
602
store the pcur position even in a
606
603
unique search from a clustered index,
607
604
because HANDLER allows NEXT and PREV
608
605
in such a situation */
609
ulint template_type; /* ROW_MYSQL_WHOLE_ROW,
606
unsigned template_type:2;/*!< ROW_MYSQL_WHOLE_ROW,
610
607
ROW_MYSQL_REC_FIELDS,
611
608
ROW_MYSQL_DUMMY_TEMPLATE, or
612
609
ROW_MYSQL_NO_TEMPLATE */
613
ulint n_template; /* number of elements in the
610
unsigned n_template:10; /*!< number of elements in the
615
ulint null_bitmap_len;/* number of bytes in the SQL NULL
612
unsigned null_bitmap_len:10;/*!< number of bytes in the SQL NULL
616
613
bitmap at the start of a row in the
618
ibool need_to_access_clustered; /* if we are fetching
615
unsigned need_to_access_clustered:1; /*!< if we are fetching
619
616
columns through a secondary index
620
617
and at least one column is not in
621
618
the secondary index, then this is
623
ibool templ_contains_blob;/* TRUE if the template contains
620
unsigned templ_contains_blob:1;/*!< TRUE if the template contains
624
621
BLOB column(s) */
625
mysql_row_templ_t* mysql_template;/* template used to transform
622
mysql_row_templ_t* mysql_template;/*!< template used to transform
626
623
rows fast between MySQL and Innobase
627
624
formats; memory for this template
628
625
is not allocated from 'heap' */
629
mem_heap_t* heap; /* memory heap from which
626
mem_heap_t* heap; /*!< memory heap from which
630
627
these auxiliary structures are
631
628
allocated when needed */
632
ins_node_t* ins_node; /* Innobase SQL insert node
629
ins_node_t* ins_node; /*!< Innobase SQL insert node
633
630
used to perform inserts
635
byte* ins_upd_rec_buff;/* buffer for storing data converted
632
byte* ins_upd_rec_buff;/*!< buffer for storing data converted
636
633
to the Innobase format from the MySQL
638
const byte* default_rec; /* the default values of all columns
635
const byte* default_rec; /*!< the default values of all columns
639
636
(a "default row") in MySQL format */
640
637
ulint hint_need_to_fetch_extra_cols;
641
/* normally this is set to 0; if this
638
/*!< normally this is set to 0; if this
642
639
is set to ROW_RETRIEVE_PRIMARY_KEY,
643
640
then we should at least retrieve all
644
641
columns in the primary key; if this