~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-03-02 23:14:32 UTC
  • mto: This revision was merged to the branch mainline in revision 910.
  • Revision ID: mordred@inaugust.com-20090302231432-i35xehp7uzo6hjjw
Updated build system to use new version numbering. Just remember to run ./config/autorun.sh before running make distcheck for release and all should be peachy.

Show diffs side-by-side

added added

removed removed

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