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