~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0mysql.h

Removed dependency for hex convert, fixed a few Protocol class issues for Solaris.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
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
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/row0mysql.h
 
19
/******************************************************
21
20
Interface between Innobase row operations and MySQL.
22
21
Contains also create table and other data dictionary operations.
23
22
 
40
39
 
41
40
typedef struct row_prebuilt_struct row_prebuilt_t;
42
41
 
43
 
/*******************************************************************//**
 
42
/***********************************************************************
44
43
Frees the blob heap in prebuilt when no longer needed. */
45
44
UNIV_INTERN
46
45
void
47
46
row_mysql_prebuilt_free_blob_heap(
48
47
/*==============================*/
49
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct of a
 
48
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct of a
50
49
                                        ha_innobase:: table handle */
51
 
/*******************************************************************//**
 
50
/***********************************************************************
52
51
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row
53
 
format.
54
 
@return pointer to the data, we skip the 1 or 2 bytes at the start
55
 
that are used to store the len */
 
52
format. */
56
53
UNIV_INTERN
57
54
byte*
58
55
row_mysql_store_true_var_len(
59
56
/*=========================*/
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
 
/*******************************************************************//**
 
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
/***********************************************************************
64
63
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 */
68
 
UNIV_INTERN
 
64
returns a pointer to the data. */
 
65
 
69
66
const byte*
70
67
row_mysql_read_true_varchar(
71
68
/*========================*/
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
 
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
75
75
                                or 2 bytes */
76
 
/*******************************************************************//**
 
76
/***********************************************************************
77
77
Stores a reference to a BLOB in the MySQL format. */
78
78
UNIV_INTERN
79
79
void
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
86
86
                                to 4 bytes */
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
92
92
                                header! */
93
 
/*******************************************************************//**
94
 
Reads a reference to a BLOB in the MySQL format.
95
 
@return pointer to BLOB data */
96
 
UNIV_INTERN
 
93
/***********************************************************************
 
94
Reads a reference to a BLOB in the MySQL format. */
 
95
 
97
96
const byte*
98
97
row_mysql_read_blob_ref(
99
98
/*====================*/
100
 
        ulint*          len,            /*!< out: BLOB length */
101
 
        const byte*     ref,            /*!< in: BLOB reference in the
 
99
                                        /* out: pointer to BLOB data */
 
100
        ulint*          len,            /* out: BLOB length */
 
101
        const byte*     ref,            /* in: BLOB reference in the
102
102
                                        MySQL format */
103
 
        ulint           col_len);       /*!< in: BLOB reference length
 
103
        ulint           col_len);       /* in: BLOB reference length
104
104
                                        (not BLOB length) */
105
 
/**************************************************************//**
106
 
Pad a column with spaces. */
107
 
UNIV_INTERN
108
 
void
109
 
row_mysql_pad_col(
110
 
/*==============*/
111
 
        ulint   mbminlen,       /*!< in: minimum size of a character,
112
 
                                in bytes */
113
 
        byte*   pad,            /*!< out: padded buffer */
114
 
        ulint   len);           /*!< in: number of bytes to pad */
115
 
 
116
 
/**************************************************************//**
 
105
/******************************************************************
117
106
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
118
107
The counterpart of this function is row_sel_field_store_in_mysql_format() in
119
 
row0sel.c.
120
 
@return up to which byte we used buf in the conversion */
 
108
row0sel.c. */
121
109
UNIV_INTERN
122
110
byte*
123
111
row_mysql_store_col_in_innobase_format(
124
112
/*===================================*/
125
 
        dfield_t*       dfield,         /*!< in/out: dfield where dtype
 
113
                                        /* out: up to which byte we used
 
114
                                        buf in the conversion */
 
115
        dfield_t*       dfield,         /* in/out: dfield where dtype
126
116
                                        information must be already set when
127
117
                                        this function is called! */
128
 
        byte*           buf,            /*!< in/out: buffer for a converted
 
118
        byte*           buf,            /* in/out: buffer for a converted
129
119
                                        integer value; this must be at least
130
120
                                        col_len long then! */
131
 
        ibool           row_format_col, /*!< TRUE if the mysql_data is from
 
121
        ibool           row_format_col, /* TRUE if the mysql_data is from
132
122
                                        a MySQL row, FALSE if from a MySQL
133
123
                                        key value;
134
124
                                        in MySQL, a true VARCHAR storage
135
125
                                        format differs in a row and in a
136
126
                                        key value: in a key value the length
137
127
                                        is always stored in 2 bytes! */
138
 
        const byte*     mysql_data,     /*!< in: MySQL column value, not
 
128
        const byte*     mysql_data,     /* in: MySQL column value, not
139
129
                                        SQL NULL; NOTE that dfield may also
140
130
                                        get a pointer to mysql_data,
141
131
                                        therefore do not discard this as long
142
132
                                        as dfield is used! */
143
 
        ulint           col_len,        /*!< in: MySQL column length; NOTE that
 
133
        ulint           col_len,        /* in: MySQL column length; NOTE that
144
134
                                        this is the storage length of the
145
135
                                        column in the MySQL format row, not
146
136
                                        necessarily the length of the actual
147
137
                                        payload data; if the column is a true
148
138
                                        VARCHAR then this is irrelevant */
149
 
        ulint           comp);          /*!< in: nonzero=compact format */
150
 
/****************************************************************//**
151
 
Handles user errors and lock waits detected by the database engine.
152
 
@return TRUE if it was a lock wait and we should continue running the
153
 
query thread */
 
139
        ulint           comp);          /* in: nonzero=compact format */
 
140
/********************************************************************
 
141
Handles user errors and lock waits detected by the database engine. */
154
142
UNIV_INTERN
155
143
ibool
156
144
row_mysql_handle_errors(
157
145
/*====================*/
158
 
        ulint*          new_err,/*!< out: possible new error encountered in
 
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
159
149
                                rollback, or the old error which was
160
150
                                during the function entry */
161
 
        trx_t*          trx,    /*!< in: transaction */
162
 
        que_thr_t*      thr,    /*!< in: query thread */
163
 
        trx_savept_t*   savept);/*!< in: savepoint */
164
 
/********************************************************************//**
165
 
Create a prebuilt struct for a MySQL table handle.
166
 
@return own: a prebuilt struct */
 
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. */
167
156
UNIV_INTERN
168
157
row_prebuilt_t*
169
158
row_create_prebuilt(
170
159
/*================*/
171
 
        dict_table_t*   table); /*!< in: Innobase table handle */
172
 
/********************************************************************//**
 
160
                                /* out, own: a prebuilt struct */
 
161
        dict_table_t*   table); /* in: Innobase table handle */
 
162
/************************************************************************
173
163
Free a prebuilt struct for a MySQL table handle. */
174
164
UNIV_INTERN
175
165
void
176
166
row_prebuilt_free(
177
167
/*==============*/
178
 
        row_prebuilt_t* prebuilt,       /*!< in, own: prebuilt struct */
179
 
        ibool           dict_locked);   /*!< in: TRUE=data dictionary locked */
180
 
/*********************************************************************//**
 
168
        row_prebuilt_t* prebuilt,       /* in, own: prebuilt struct */
 
169
        ibool           dict_locked);   /* in: TRUE=data dictionary locked */
 
170
/*************************************************************************
181
171
Updates the transaction pointers in query graphs stored in the prebuilt
182
172
struct. */
183
173
UNIV_INTERN
184
174
void
185
175
row_update_prebuilt_trx(
186
176
/*====================*/
187
 
        row_prebuilt_t* prebuilt,       /*!< in/out: prebuilt struct
188
 
                                        in MySQL handle */
189
 
        trx_t*          trx);           /*!< in: transaction handle */
190
 
/*********************************************************************//**
191
 
Unlocks AUTO_INC type locks that were possibly reserved by a trx. This
192
 
function should be called at the the end of an SQL statement, by the
193
 
connection thread that owns the transaction (trx->mysql_thd). */
 
177
                                        /* out: prebuilt dtuple */
 
178
        row_prebuilt_t* prebuilt,       /* in: prebuilt struct in MySQL
 
179
                                        handle */
 
180
        trx_t*          trx);           /* in: transaction handle */
 
181
/*************************************************************************
 
182
Unlocks AUTO_INC type locks that were possibly reserved by a trx. */
194
183
UNIV_INTERN
195
184
void
196
185
row_unlock_table_autoinc_for_mysql(
197
186
/*===============================*/
198
 
        trx_t*  trx);                   /*!< in/out: transaction */
199
 
/*********************************************************************//**
 
187
        trx_t*  trx);                   /* in/out: transaction */
 
188
/*************************************************************************
200
189
Sets an AUTO_INC type lock on the table mentioned in prebuilt. The
201
190
AUTO_INC lock gives exclusive access to the auto-inc counter of the
202
191
table. The lock is reserved only for the duration of an SQL statement.
203
192
It is not compatible with another AUTO_INC or exclusive lock on the
204
 
table.
205
 
@return error code or DB_SUCCESS */
 
193
table. */
206
194
UNIV_INTERN
207
195
int
208
196
row_lock_table_autoinc_for_mysql(
209
197
/*=============================*/
210
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in the MySQL
 
198
                                        /* out: error code or DB_SUCCESS */
 
199
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct in the MySQL
211
200
                                        table handle */
212
 
/*********************************************************************//**
213
 
Sets a table lock on the table mentioned in prebuilt.
214
 
@return error code or DB_SUCCESS */
 
201
/*************************************************************************
 
202
Sets a table lock on the table mentioned in prebuilt. */
215
203
UNIV_INTERN
216
204
int
217
205
row_lock_table_for_mysql(
218
206
/*=====================*/
219
 
        row_prebuilt_t* prebuilt,       /*!< in: prebuilt struct in the MySQL
 
207
                                        /* out: error code or DB_SUCCESS */
 
208
        row_prebuilt_t* prebuilt,       /* in: prebuilt struct in the MySQL
220
209
                                        table handle */
221
 
        dict_table_t*   table,          /*!< in: table to lock, or NULL
 
210
        dict_table_t*   table,          /* in: table to lock, or NULL
222
211
                                        if prebuilt->table should be
223
212
                                        locked as
224
213
                                        prebuilt->select_lock_type */
225
 
        ulint           mode);          /*!< in: lock mode of table
 
214
        ulint           mode);          /* in: lock mode of table
226
215
                                        (ignored if table==NULL) */
227
216
 
228
 
/*********************************************************************//**
229
 
Does an insert for MySQL.
230
 
@return error code or DB_SUCCESS */
 
217
/*************************************************************************
 
218
Does an insert for MySQL. */
231
219
UNIV_INTERN
232
220
int
233
221
row_insert_for_mysql(
234
222
/*=================*/
235
 
        byte*           mysql_rec,      /*!< in: row in the MySQL format */
236
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
 
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
237
226
                                        handle */
238
 
/*********************************************************************//**
 
227
/*************************************************************************
239
228
Builds a dummy query graph used in selects. */
240
229
UNIV_INTERN
241
230
void
242
231
row_prebuild_sel_graph(
243
232
/*===================*/
244
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
 
233
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct in MySQL
245
234
                                        handle */
246
 
/*********************************************************************//**
 
235
/*************************************************************************
247
236
Gets pointer to a prebuilt update vector used in updates. If the update
248
237
graph has not yet been built in the prebuilt struct, then this function
249
 
first builds it.
250
 
@return prebuilt update vector */
 
238
first builds it. */
251
239
UNIV_INTERN
252
240
upd_t*
253
241
row_get_prebuilt_update_vector(
254
242
/*===========================*/
255
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
 
243
                                        /* out: prebuilt update vector */
 
244
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct in MySQL
256
245
                                        handle */
257
 
/*********************************************************************//**
 
246
/*************************************************************************
258
247
Checks if a table is such that we automatically created a clustered
259
 
index on it (on row id).
260
 
@return TRUE if the clustered index was generated automatically */
 
248
index on it (on row id). */
261
249
UNIV_INTERN
262
250
ibool
263
251
row_table_got_default_clust_index(
264
252
/*==============================*/
265
 
        const dict_table_t*     table); /*!< in: table */
266
 
/*********************************************************************//**
267
 
Does an update or delete of a row for MySQL.
268
 
@return error code or DB_SUCCESS */
 
253
        const dict_table_t*     table);
 
254
/*************************************************************************
 
255
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 */
 
257
UNIV_INTERN
 
258
ulint
 
259
row_get_mysql_key_number_for_index(
 
260
/*===============================*/
 
261
        const dict_index_t*     index);
 
262
/*************************************************************************
 
263
Does an update or delete of a row for MySQL. */
269
264
UNIV_INTERN
270
265
int
271
266
row_update_for_mysql(
272
267
/*=================*/
273
 
        byte*           mysql_rec,      /*!< in: the row to be updated, in
 
268
                                        /* out: error code or DB_SUCCESS */
 
269
        byte*           mysql_rec,      /* in: the row to be updated, in
274
270
                                        the MySQL format */
275
 
        row_prebuilt_t* prebuilt);      /*!< in: prebuilt struct in MySQL
 
271
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct in MySQL
276
272
                                        handle */
277
 
/*********************************************************************//**
278
 
This can only be used when srv_locks_unsafe_for_binlog is TRUE or this
279
 
session is using a READ COMMITTED or READ UNCOMMITTED isolation level.
280
 
Before calling this function row_search_for_mysql() must have
281
 
initialized prebuilt->new_rec_locks to store the information which new
282
 
record locks really were set. This function removes a newly set
283
 
clustered index record lock under prebuilt->pcur or
284
 
prebuilt->clust_pcur.  Thus, this implements a 'mini-rollback' that
285
 
releases the latest clustered index record lock we set.
286
 
@return error code or DB_SUCCESS */
 
273
/*************************************************************************
 
274
This can only be used when srv_locks_unsafe_for_binlog is TRUE or
 
275
session is using a READ COMMITTED isolation level. Before
 
276
calling this function we must use trx_reset_new_rec_lock_info() and
 
277
trx_register_new_rec_lock() to store the information which new record locks
 
278
really were set. This function removes a newly set lock under prebuilt->pcur,
 
279
and also under prebuilt->clust_pcur. Currently, this is only used and tested
 
280
in the case of an UPDATE or a DELETE statement, where the row lock is of the
 
281
LOCK_X type.
 
282
Thus, this implements a 'mini-rollback' that releases the latest record
 
283
locks we set. */
287
284
UNIV_INTERN
288
285
int
289
286
row_unlock_for_mysql(
290
287
/*=================*/
291
 
        row_prebuilt_t* prebuilt,       /*!< in/out: prebuilt struct in MySQL
 
288
                                        /* out: error code or DB_SUCCESS */
 
289
        row_prebuilt_t* prebuilt,       /* in: prebuilt struct in MySQL
292
290
                                        handle */
293
 
        ibool           has_latches_on_recs);/*!< in: TRUE if called
294
 
                                        so that we have the latches on
295
 
                                        the records under pcur and
296
 
                                        clust_pcur, and we do not need
297
 
                                        to reposition the cursors. */
298
 
/*********************************************************************//**
 
291
        ibool           has_latches_on_recs);/* TRUE if called so that we have
 
292
                                        the latches on the records under pcur
 
293
                                        and clust_pcur, and we do not need to
 
294
                                        reposition the cursors. */
 
295
/*************************************************************************
299
296
Creates an query graph node of 'update' type to be used in the MySQL
300
 
interface.
301
 
@return own: update node */
 
297
interface. */
302
298
UNIV_INTERN
303
299
upd_node_t*
304
300
row_create_update_node_for_mysql(
305
301
/*=============================*/
306
 
        dict_table_t*   table,  /*!< in: table to update */
307
 
        mem_heap_t*     heap);  /*!< in: mem heap from which allocated */
308
 
/**********************************************************************//**
309
 
Does a cascaded delete or set null in a foreign key operation.
310
 
@return error code or DB_SUCCESS */
 
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. */
311
307
UNIV_INTERN
312
308
ulint
313
309
row_update_cascade_for_mysql(
314
310
/*=========================*/
315
 
        que_thr_t*      thr,    /*!< in: query thread */
316
 
        upd_node_t*     node,   /*!< in: update node used in the cascade
 
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
317
314
                                or set null operation */
318
 
        dict_table_t*   table); /*!< in: table where we do the operation */
319
 
/*********************************************************************//**
 
315
        dict_table_t*   table); /* in: table where we do the operation */
 
316
/*************************************************************************
320
317
Locks the data dictionary exclusively for performing a table create or other
321
318
data dictionary modification operation. */
322
319
UNIV_INTERN
323
320
void
324
321
row_mysql_lock_data_dictionary_func(
325
322
/*================================*/
326
 
        trx_t*          trx,    /*!< in/out: transaction */
327
 
        const char*     file,   /*!< in: file name */
328
 
        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 */
329
326
#define row_mysql_lock_data_dictionary(trx)                             \
330
327
        row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__)
331
 
/*********************************************************************//**
 
328
/*************************************************************************
332
329
Unlocks the data dictionary exclusive lock. */
333
330
UNIV_INTERN
334
331
void
335
332
row_mysql_unlock_data_dictionary(
336
333
/*=============================*/
337
 
        trx_t*  trx);   /*!< in/out: transaction */
338
 
/*********************************************************************//**
 
334
        trx_t*  trx);   /* in/out: transaction */
 
335
/*************************************************************************
339
336
Locks the data dictionary in shared mode from modifications, for performing
340
337
foreign key check, rollback, or other operation invisible to MySQL. */
341
338
UNIV_INTERN
342
339
void
343
340
row_mysql_freeze_data_dictionary_func(
344
341
/*==================================*/
345
 
        trx_t*          trx,    /*!< in/out: transaction */
346
 
        const char*     file,   /*!< in: file name */
347
 
        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 */
348
345
#define row_mysql_freeze_data_dictionary(trx)                           \
349
346
        row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__)
350
 
/*********************************************************************//**
 
347
/*************************************************************************
351
348
Unlocks the data dictionary shared lock. */
352
349
UNIV_INTERN
353
350
void
354
351
row_mysql_unfreeze_data_dictionary(
355
352
/*===============================*/
356
 
        trx_t*  trx);   /*!< in/out: transaction */
357
 
/*********************************************************************//**
 
353
        trx_t*  trx);   /* in/out: transaction */
 
354
#ifndef UNIV_HOTBACKUP
 
355
/*************************************************************************
358
356
Creates a table for MySQL. If the name of the table ends in
359
357
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
360
358
"innodb_table_monitor", then this will also start the printing of monitor
361
359
output by the master thread. If the table name ends in "innodb_mem_validate",
362
 
InnoDB will try to invoke mem_validate().
363
 
@return error code or DB_SUCCESS */
 
360
InnoDB will try to invoke mem_validate(). */
364
361
UNIV_INTERN
365
362
int
366
363
row_create_table_for_mysql(
367
364
/*=======================*/
368
 
        dict_table_t*   table,          /*!< in, own: table definition
 
365
                                        /* out: error code or DB_SUCCESS */
 
366
        dict_table_t*   table,          /* in, own: table definition
369
367
                                        (will be freed) */
370
 
        trx_t*          trx);           /*!< in: transaction handle */
371
 
/*********************************************************************//**
 
368
        trx_t*          trx);           /* in: transaction handle */
 
369
/*************************************************************************
372
370
Does an index creation operation for MySQL. TODO: currently failure
373
371
to create an index results in dropping the whole table! This is no problem
374
 
currently as all indexes must be created at the same time as the table.
375
 
@return error number or DB_SUCCESS */
 
372
currently as all indexes must be created at the same time as the table. */
376
373
UNIV_INTERN
377
374
int
378
375
row_create_index_for_mysql(
379
376
/*=======================*/
380
 
        dict_index_t*   index,          /*!< in, own: index definition
 
377
                                        /* out: error number or DB_SUCCESS */
 
378
        dict_index_t*   index,          /* in, own: index definition
381
379
                                        (will be freed) */
382
 
        trx_t*          trx,            /*!< in: transaction handle */
383
 
        const ulint*    field_lengths); /*!< in: if not NULL, must contain
 
380
        trx_t*          trx,            /* in: transaction handle */
 
381
        const ulint*    field_lengths); /* in: if not NULL, must contain
384
382
                                        dict_index_get_n_fields(index)
385
383
                                        actual field lengths for the
386
384
                                        index columns, which are
387
385
                                        then checked for not being too
388
386
                                        large. */
389
 
/*********************************************************************//**
 
387
/*************************************************************************
390
388
Scans a table create SQL string and adds to the data dictionary
391
389
the foreign key constraints declared in the string. This function
392
390
should be called after the indexes for a table have been created.
393
391
Each foreign key constraint must be accompanied with indexes in
394
392
bot participating tables. The indexes are allowed to contain more
395
 
fields than mentioned in the constraint.
396
 
@return error code or DB_SUCCESS */
 
393
fields than mentioned in the constraint. */
397
394
UNIV_INTERN
398
395
int
399
396
row_table_add_foreign_constraints(
400
397
/*==============================*/
401
 
        trx_t*          trx,            /*!< in: transaction */
402
 
        const char*     sql_string,     /*!< in: table create statement where
 
398
                                        /* out: error code or DB_SUCCESS */
 
399
        trx_t*          trx,            /* in: transaction */
 
400
        const char*     sql_string,     /* in: table create statement where
403
401
                                        foreign keys are declared like:
404
402
                                FOREIGN KEY (a, b) REFERENCES table2(c, d),
405
403
                                        table2 can be written also with the
406
404
                                        database name before it: test.table2 */
407
 
        size_t          sql_length,     /*!< in: length of sql_string */
408
 
        const char*     name,           /*!< in: table full name in the
 
405
        const char*     name,           /* in: table full name in the
409
406
                                        normalized form
410
407
                                        database_name/table_name */
411
 
        ibool           reject_fks);    /*!< in: if TRUE, fail with error
 
408
        ibool           reject_fks);    /* in: if TRUE, fail with error
412
409
                                        code DB_CANNOT_ADD_CONSTRAINT if
413
410
                                        any foreign keys are found. */
414
411
 
415
 
/*********************************************************************//**
 
412
/*************************************************************************
416
413
The master thread in srv0srv.c calls this regularly to drop tables which
417
414
we must drop in background after queries to them have ended. Such lazy
418
 
dropping of tables is needed in ALTER TABLE on Unix.
419
 
@return how many tables dropped + remaining tables in list */
 
415
dropping of tables is needed in ALTER TABLE on Unix. */
420
416
UNIV_INTERN
421
417
ulint
422
418
row_drop_tables_for_mysql_in_background(void);
423
419
/*=========================================*/
424
 
/*********************************************************************//**
 
420
                                        /* out: how many tables dropped
 
421
                                        + remaining tables in list */
 
422
/*************************************************************************
425
423
Get the background drop list length. NOTE: the caller must own the kernel
426
 
mutex!
427
 
@return how many tables in list */
 
424
mutex! */
428
425
UNIV_INTERN
429
426
ulint
430
427
row_get_background_drop_list_len_low(void);
431
428
/*======================================*/
432
 
/*********************************************************************//**
433
 
Truncates a table for MySQL.
434
 
@return error code or DB_SUCCESS */
 
429
                                        /* out: how many tables in list */
 
430
/*************************************************************************
 
431
Truncates a table for MySQL. */
435
432
UNIV_INTERN
436
433
int
437
434
row_truncate_table_for_mysql(
438
435
/*=========================*/
439
 
        dict_table_t*   table,  /*!< in: table handle */
440
 
        trx_t*          trx);   /*!< in: transaction handle */
441
 
/*********************************************************************//**
 
436
                                /* out: error code or DB_SUCCESS */
 
437
        dict_table_t*   table,  /* in: table handle */
 
438
        trx_t*          trx);   /* in: transaction handle */
 
439
/*************************************************************************
442
440
Drops a table for MySQL.  If the name of the dropped table ends in
443
441
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
444
442
"innodb_table_monitor", then this will also stop the printing of monitor
445
443
output by the master thread.  If the data dictionary was not already locked
446
444
by the transaction, the transaction will be committed.  Otherwise, the
447
 
data dictionary will remain locked.
448
 
@return error code or DB_SUCCESS */
 
445
data dictionary will remain locked. */
449
446
UNIV_INTERN
450
447
int
451
448
row_drop_table_for_mysql(
452
449
/*=====================*/
453
 
        const char*     name,   /*!< in: table name */
454
 
        trx_t*          trx,    /*!< in: transaction handle */
455
 
        ibool           drop_db);/*!< in: TRUE=dropping whole database */
456
 
/*********************************************************************//**
457
 
Drop all temporary tables during crash recovery. */
458
 
UNIV_INTERN
459
 
void
460
 
row_mysql_drop_temp_tables(void);
461
 
/*============================*/
 
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 */
462
454
 
463
 
/*********************************************************************//**
 
455
/*************************************************************************
464
456
Discards the tablespace of a table which stored in an .ibd file. Discarding
465
457
means that this function deletes the .ibd file and assigns a new table id for
466
 
the table. Also the flag table->ibd_file_missing is set TRUE.
467
 
@return error code or DB_SUCCESS */
 
458
the table. Also the flag table->ibd_file_missing is set TRUE. */
468
459
UNIV_INTERN
469
460
int
470
461
row_discard_tablespace_for_mysql(
471
462
/*=============================*/
472
 
        const char*     name,   /*!< in: table name */
473
 
        trx_t*          trx);   /*!< in: transaction handle */
474
 
/*****************************************************************//**
 
463
                                /* out: error code or DB_SUCCESS */
 
464
        const char*     name,   /* in: table name */
 
465
        trx_t*          trx);   /* in: transaction handle */
 
466
/*********************************************************************
475
467
Imports a tablespace. The space id in the .ibd file must match the space id
476
 
of the table in the data dictionary.
477
 
@return error code or DB_SUCCESS */
 
468
of the table in the data dictionary. */
478
469
UNIV_INTERN
479
470
int
480
471
row_import_tablespace_for_mysql(
481
472
/*============================*/
482
 
        const char*     name,   /*!< in: table name */
483
 
        trx_t*          trx);   /*!< in: transaction handle */
484
 
/*********************************************************************//**
485
 
Drops a database for MySQL.
486
 
@return error code or DB_SUCCESS */
 
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. */
487
478
UNIV_INTERN
488
479
int
489
480
row_drop_database_for_mysql(
490
481
/*========================*/
491
 
        const char*     name,   /*!< in: database name which ends to '/' */
492
 
        trx_t*          trx);   /*!< in: transaction handle */
493
 
/*********************************************************************//**
494
 
Renames a table for MySQL.
495
 
@return error code or DB_SUCCESS */
 
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. */
496
487
UNIV_INTERN
497
488
ulint
498
489
row_rename_table_for_mysql(
499
490
/*=======================*/
500
 
        const char*     old_name,       /*!< in: old table name */
501
 
        const char*     new_name,       /*!< in: new table name */
502
 
        trx_t*          trx,            /*!< in: transaction handle */
503
 
        ibool           commit);        /*!< in: if TRUE then commit trx */
504
 
/*********************************************************************//**
505
 
Checks that the index contains entries in an ascending order, unique
506
 
constraint is not broken, and calculates the number of index entries
507
 
in the read view of the current transaction.
508
 
@return DB_SUCCESS if ok */
 
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. */
509
498
UNIV_INTERN
510
499
ulint
511
 
row_check_index_for_mysql(
 
500
row_check_table_for_mysql(
512
501
/*======================*/
513
 
        row_prebuilt_t*         prebuilt,       /*!< in: prebuilt struct
514
 
                                                in MySQL handle */
515
 
        const dict_index_t*     index,          /*!< in: index */
516
 
        ulint*                  n_rows);        /*!< out: number of entries
517
 
                                                seen in the consistent read */
 
502
                                        /* out: DB_ERROR or DB_SUCCESS */
 
503
        row_prebuilt_t* prebuilt);      /* in: prebuilt struct in MySQL
 
504
                                        handle */
 
505
#endif /* !UNIV_HOTBACKUP */
518
506
 
519
 
/*********************************************************************//**
520
 
Determines if a table is a magic monitor table.
521
 
@return TRUE if monitor table */
 
507
/*************************************************************************
 
508
Determines if a table is a magic monitor table. */
522
509
UNIV_INTERN
523
510
ibool
524
511
row_is_magic_monitor_table(
525
512
/*=======================*/
526
 
        const char*     table_name);    /*!< in: name of the table, in the
 
513
                                        /* out: TRUE if monitor table */
 
514
        const char*     table_name);    /* in: name of the table, in the
527
515
                                        form database/table_name */
528
516
 
529
517
/* A struct describing a place for an individual column in the MySQL
533
521
 
534
522
typedef struct mysql_row_templ_struct mysql_row_templ_t;
535
523
struct mysql_row_templ_struct {
536
 
        ulint   col_no;                 /*!< column number of the column */
537
 
        ulint   rec_field_no;           /*!< field number of the column in an
 
524
        ulint   col_no;                 /* column number of the column */
 
525
        ulint   rec_field_no;           /* field number of the column in an
538
526
                                        Innobase record in the current index;
539
527
                                        not defined if template_type is
540
528
                                        ROW_MYSQL_WHOLE_ROW */
541
 
        ulint   mysql_col_offset;       /*!< offset of the column in the MySQL
542
 
                                        row format */
543
 
        ulint   mysql_col_len;          /*!< length of the column in the MySQL
544
 
                                        row format */
545
 
        ulint   mysql_null_byte_offset; /*!< MySQL NULL bit byte offset in a
 
529
        ulint   mysql_col_offset;       /* offset of the column in the MySQL
 
530
                                        row format */
 
531
        ulint   mysql_col_len;          /* length of the column in the MySQL
 
532
                                        row format */
 
533
        ulint   mysql_null_byte_offset; /* MySQL NULL bit byte offset in a
546
534
                                        MySQL record */
547
 
        ulint   mysql_null_bit_mask;    /*!< bit mask to get the NULL bit,
 
535
        ulint   mysql_null_bit_mask;    /* bit mask to get the NULL bit,
548
536
                                        zero if column cannot be NULL */
549
 
        ulint   type;                   /*!< column type in Innobase mtype
 
537
        ulint   type;                   /* column type in Innobase mtype
550
538
                                        numbers DATA_CHAR... */
551
 
        ulint   mysql_type;             /*!< MySQL type code; this is always
 
539
        ulint   mysql_type;             /* MySQL type code; this is always
552
540
                                        < 256 */
553
 
        ulint   mysql_length_bytes;     /*!< if mysql_type
 
541
        ulint   mysql_length_bytes;     /* if mysql_type
554
542
                                        == DATA_MYSQL_TRUE_VARCHAR, this tells
555
543
                                        whether we should use 1 or 2 bytes to
556
544
                                        store the MySQL true VARCHAR data
558
546
                                        format (NOTE that the MySQL key value
559
547
                                        format always uses 2 bytes for the data
560
548
                                        len) */
561
 
        ulint   charset;                /*!< MySQL charset-collation code
 
549
        ulint   charset;                /* MySQL charset-collation code
562
550
                                        of the column, or zero */
563
 
        ulint   mbminlen;               /*!< minimum length of a char, in bytes,
564
 
                                        or zero if not a char type */
565
 
        ulint   mbmaxlen;               /*!< maximum length of a char, in bytes,
566
 
                                        or zero if not a char type */
567
 
        ulint   is_unsigned;            /*!< if a column type is an integer
 
551
        ulint   mbminlen;               /* minimum length of a char, in bytes,
 
552
                                        or zero if not a char type */
 
553
        ulint   mbmaxlen;               /* maximum length of a char, in bytes,
 
554
                                        or zero if not a char type */
 
555
        ulint   is_unsigned;            /* if a column type is an integer
568
556
                                        type and this field is != 0, then
569
557
                                        it is an unsigned integer type */
570
558
};
576
564
#define ROW_PREBUILT_ALLOCATED  78540783
577
565
#define ROW_PREBUILT_FREED      26423527
578
566
 
579
 
/** A struct for (sometimes lazily) prebuilt structures in an Innobase table
 
567
typedef int64_t (*index_cond_func_t)(void *param);
 
568
 
 
569
/* A struct for (sometimes lazily) prebuilt structures in an Innobase table
580
570
handle used within MySQL; these are used to save CPU time. */
581
571
 
582
572
struct row_prebuilt_struct {
583
 
        ulint           magic_n;        /*!< this magic number is set to
 
573
        ulint           magic_n;        /* this magic number is set to
584
574
                                        ROW_PREBUILT_ALLOCATED when created,
585
575
                                        or ROW_PREBUILT_FREED when the
586
576
                                        struct has been freed */
587
 
        dict_table_t*   table;          /*!< Innobase table handle */
588
 
        dict_index_t*   index;          /*!< current index for a search, if
589
 
                                        any */
590
 
        trx_t*          trx;            /*!< current transaction handle */
591
 
        unsigned        sql_stat_start:1;/*!< TRUE when we start processing of
 
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
592
580
                                        an SQL statement: we may have to set
593
581
                                        an intention lock on the table,
594
582
                                        create a consistent read view etc. */
595
 
        unsigned        mysql_has_locked:1;/*!< this is set TRUE when MySQL
 
583
        ibool           mysql_has_locked; /* this is set TRUE when MySQL
596
584
                                        calls external_lock on this handle
597
585
                                        with a lock flag, and set FALSE when
598
586
                                        with the F_UNLOCK flag */
599
 
        unsigned        clust_index_was_generated:1;
600
 
                                        /*!< if the user did not define a
 
587
        ibool           clust_index_was_generated;
 
588
                                        /* if the user did not define a
601
589
                                        primary key in MySQL, then Innobase
602
590
                                        automatically generated a clustered
603
591
                                        index where the ordering column is
604
592
                                        the row id: in this case this flag
605
593
                                        is set to TRUE */
606
 
        unsigned        index_usable:1; /*!< caches the value of
607
 
                                        row_merge_is_index_usable(trx,index) */
608
 
        unsigned        read_just_key:1;/*!< set to 1 when MySQL calls
 
594
        dict_index_t*   index;          /* current index for a search, if
 
595
                                        any */
 
596
        ulint           read_just_key;  /* set to 1 when MySQL calls
609
597
                                        ha_innobase::extra with the
610
598
                                        argument HA_EXTRA_KEYREAD; it is enough
611
599
                                        to read just columns defined in
612
600
                                        the index (i.e., no read of the
613
601
                                        clustered index record necessary) */
614
 
        unsigned        template_type:2;/*!< ROW_MYSQL_WHOLE_ROW,
 
602
        ibool           used_in_HANDLER;/* TRUE if we have been using this
 
603
                                        handle in a MySQL HANDLER low level
 
604
                                        index cursor command: then we must
 
605
                                        store the pcur position even in a
 
606
                                        unique search from a clustered index,
 
607
                                        because HANDLER allows NEXT and PREV
 
608
                                        in such a situation */
 
609
        ulint           template_type;  /* ROW_MYSQL_WHOLE_ROW,
615
610
                                        ROW_MYSQL_REC_FIELDS,
616
611
                                        ROW_MYSQL_DUMMY_TEMPLATE, or
617
612
                                        ROW_MYSQL_NO_TEMPLATE */
618
 
        unsigned        n_template:10;  /*!< number of elements in the
 
613
        ulint           n_template;     /* number of elements in the
619
614
                                        template */
620
 
        unsigned        null_bitmap_len:10;/*!< number of bytes in the SQL NULL
 
615
        ulint           null_bitmap_len;/* number of bytes in the SQL NULL
621
616
                                        bitmap at the start of a row in the
622
617
                                        MySQL format */
623
 
        unsigned        need_to_access_clustered:1; /*!< if we are fetching
 
618
        ibool           need_to_access_clustered; /* if we are fetching
624
619
                                        columns through a secondary index
625
620
                                        and at least one column is not in
626
621
                                        the secondary index, then this is
627
622
                                        set to TRUE */
628
 
        unsigned        templ_contains_blob:1;/*!< TRUE if the template contains
629
 
                                        a column with DATA_BLOB ==
630
 
                                        get_innobase_type_from_mysql_type();
631
 
                                        not to be confused with InnoDB
632
 
                                        externally stored columns
633
 
                                        (VARCHAR can be off-page too) */
634
 
        mysql_row_templ_t* mysql_template;/*!< template used to transform
 
623
        ibool           templ_contains_blob;/* TRUE if the template contains
 
624
                                        BLOB column(s) */
 
625
        mysql_row_templ_t* mysql_template;/* template used to transform
635
626
                                        rows fast between MySQL and Innobase
636
627
                                        formats; memory for this template
637
628
                                        is not allocated from 'heap' */
638
 
        mem_heap_t*     heap;           /*!< memory heap from which
 
629
        mem_heap_t*     heap;           /* memory heap from which
639
630
                                        these auxiliary structures are
640
631
                                        allocated when needed */
641
 
        ins_node_t*     ins_node;       /*!< Innobase SQL insert node
 
632
        ins_node_t*     ins_node;       /* Innobase SQL insert node
642
633
                                        used to perform inserts
643
634
                                        to the table */
644
 
        byte*           ins_upd_rec_buff;/*!< buffer for storing data converted
 
635
        byte*           ins_upd_rec_buff;/* buffer for storing data converted
645
636
                                        to the Innobase format from the MySQL
646
637
                                        format */
647
 
        const byte*     default_rec;    /*!< the default values of all columns
 
638
        const byte*     default_rec;    /* the default values of all columns
648
639
                                        (a "default row") in MySQL format */
649
640
        ulint           hint_need_to_fetch_extra_cols;
650
 
                                        /*!< normally this is set to 0; if this
 
641
                                        /* normally this is set to 0; if this
651
642
                                        is set to ROW_RETRIEVE_PRIMARY_KEY,
652
643
                                        then we should at least retrieve all
653
644
                                        columns in the primary key; if this
655
646
                                        we must retrieve all columns in the
656
647
                                        key (if read_just_key == 1), or all
657
648
                                        columns in the table */
658
 
        upd_node_t*     upd_node;       /*!< Innobase SQL update node used
 
649
        upd_node_t*     upd_node;       /* Innobase SQL update node used
659
650
                                        to perform updates and deletes */
660
 
        que_fork_t*     ins_graph;      /*!< Innobase SQL query graph used
 
651
        que_fork_t*     ins_graph;      /* Innobase SQL query graph used
661
652
                                        in inserts */
662
 
        que_fork_t*     upd_graph;      /*!< Innobase SQL query graph used
 
653
        que_fork_t*     upd_graph;      /* Innobase SQL query graph used
663
654
                                        in updates or deletes */
664
 
        btr_pcur_t*     pcur;           /*!< persistent cursor used in selects
 
655
        btr_pcur_t*     pcur;           /* persistent cursor used in selects
665
656
                                        and updates */
666
 
        btr_pcur_t*     clust_pcur;     /*!< persistent cursor used in
 
657
        btr_pcur_t*     clust_pcur;     /* persistent cursor used in
667
658
                                        some selects and updates */
668
 
        que_fork_t*     sel_graph;      /*!< dummy query graph used in
 
659
        que_fork_t*     sel_graph;      /* dummy query graph used in
669
660
                                        selects */
670
 
        dtuple_t*       search_tuple;   /*!< prebuilt dtuple used in selects */
 
661
        dtuple_t*       search_tuple;   /* prebuilt dtuple used in selects */
671
662
        byte            row_id[DATA_ROW_ID_LEN];
672
 
                                        /*!< if the clustered index was
 
663
                                        /* if the clustered index was
673
664
                                        generated, the row id of the
674
665
                                        last row fetched is stored
675
666
                                        here */
676
 
        dtuple_t*       clust_ref;      /*!< prebuilt dtuple used in
 
667
        dtuple_t*       clust_ref;      /* prebuilt dtuple used in
677
668
                                        sel/upd/del */
678
 
        ulint           select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */
679
 
        ulint           stored_select_lock_type;/*!< this field is used to
 
669
        ulint           select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
 
670
        ulint           stored_select_lock_type;/* this field is used to
680
671
                                        remember the original select_lock_type
681
672
                                        that was decided in ha_innodb.cc,
682
673
                                        ::store_lock(), ::external_lock(),
683
674
                                        etc. */
684
 
        ulint           row_read_type;  /*!< ROW_READ_WITH_LOCKS if row locks
 
675
        ulint           row_read_type;  /* ROW_READ_WITH_LOCKS if row locks
685
676
                                        should be the obtained for records
686
677
                                        under an UPDATE or DELETE cursor.
687
678
                                        If innodb_locks_unsafe_for_binlog
706
697
                                        This eliminates lock waits in some
707
698
                                        cases; note that this breaks
708
699
                                        serializability. */
709
 
        ulint           new_rec_locks;  /*!< normally 0; if
710
 
                                        srv_locks_unsafe_for_binlog is
711
 
                                        TRUE or session is using READ
712
 
                                        COMMITTED or READ UNCOMMITTED
713
 
                                        isolation level, set in
714
 
                                        row_search_for_mysql() if we set a new
715
 
                                        record lock on the secondary
716
 
                                        or clustered index; this is
717
 
                                        used in row_unlock_for_mysql()
718
 
                                        when releasing the lock under
719
 
                                        the cursor if we determine
720
 
                                        after retrieving the row that
721
 
                                        it does not need to be locked
722
 
                                        ('mini-rollback') */
723
 
        ulint           mysql_prefix_len;/*!< byte offset of the end of
 
700
        ulint           mysql_prefix_len;/* byte offset of the end of
724
701
                                        the last requested column */
725
 
        ulint           mysql_row_len;  /*!< length in bytes of a row in the
 
702
        ulint           mysql_row_len;  /* length in bytes of a row in the
726
703
                                        MySQL format */
727
 
        ulint           n_rows_fetched; /*!< number of rows fetched after
 
704
        ulint           n_rows_fetched; /* number of rows fetched after
728
705
                                        positioning the current cursor */
729
 
        ulint           fetch_direction;/*!< ROW_SEL_NEXT or ROW_SEL_PREV */
 
706
        ulint           fetch_direction;/* ROW_SEL_NEXT or ROW_SEL_PREV */
730
707
        byte*           fetch_cache[MYSQL_FETCH_CACHE_SIZE];
731
 
                                        /*!< a cache for fetched rows if we
 
708
                                        /* a cache for fetched rows if we
732
709
                                        fetch many rows from the same cursor:
733
710
                                        it saves CPU time to fetch them in a
734
711
                                        batch; we reserve mysql_row_len
737
714
                                        allocated mem buf start, because
738
715
                                        there is a 4 byte magic number at the
739
716
                                        start and at the end */
740
 
        ibool           keep_other_fields_on_keyread; /*!< when using fetch
 
717
        ibool           keep_other_fields_on_keyread; /* when using fetch
741
718
                                        cache with HA_EXTRA_KEYREAD, don't
742
719
                                        overwrite other fields in mysql row
743
720
                                        row buffer.*/
744
 
        ulint           fetch_cache_first;/*!< position of the first not yet
 
721
        ulint           fetch_cache_first;/* position of the first not yet
745
722
                                        fetched row in fetch_cache */
746
 
        ulint           n_fetch_cached; /*!< number of not yet fetched rows
 
723
        ulint           n_fetch_cached; /* number of not yet fetched rows
747
724
                                        in fetch_cache */
748
 
        mem_heap_t*     blob_heap;      /*!< in SELECTS BLOB fields are copied
 
725
        mem_heap_t*     blob_heap;      /* in SELECTS BLOB fields are copied
749
726
                                        to this heap */
750
 
        mem_heap_t*     old_vers_heap;  /*!< memory heap where a previous
 
727
        mem_heap_t*     old_vers_heap;  /* memory heap where a previous
751
728
                                        version is built in consistent read */
752
729
        /*----------------------*/
753
 
        ib_uint64_t     autoinc_last_value;
754
 
                                        /*!< last value of AUTO-INC interval */
755
 
        ib_uint64_t     autoinc_increment;/*!< The increment step of the auto
 
730
        ib_uint64_t     autoinc_last_value;/* last value of AUTO-INC interval */
 
731
        ib_uint64_t     autoinc_increment;/* The increment step of the auto 
756
732
                                        increment column. Value must be
757
733
                                        greater than or equal to 1. Required to
758
734
                                        calculate the next value */
759
735
        ib_uint64_t     autoinc_offset; /* The offset passed to
760
736
                                        get_auto_increment() by MySQL. Required
761
737
                                        to calculate the next value */
762
 
        ulint           autoinc_error;  /*!< The actual error code encountered
 
738
        ulint           autoinc_error;  /* The actual error code encountered
763
739
                                        while trying to init or read the
764
740
                                        autoinc value from the table. We
765
741
                                        store it here so that we can return
766
742
                                        it to MySQL */
767
743
        /*----------------------*/
768
 
        ulint           magic_n2;       /*!< this should be the same as
 
744
        UT_LIST_NODE_T(row_prebuilt_t)  prebuilts;
 
745
                                        /* list node of table->prebuilts */
 
746
        index_cond_func_t idx_cond_func;/* Index Condition Pushdown function,
 
747
                                        or NULL if there is none set */
 
748
        void*           idx_cond_func_arg;/* ICP function  argument */
 
749
        ulint           n_index_fields; /* Number of fields at the start of
 
750
                                        mysql_template. Valid only when using
 
751
                                        ICP. */
 
752
        ulint           magic_n2;       /* this should be the same as
769
753
                                        magic_n */
770
754
};
771
755