641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
1 |
/*****************************************************************************
|
2 |
||
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
3 |
Copyright (C) 2000, 2010, Innobase Oy. All Rights Reserved.
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
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
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
15 |
St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
16 |
|
17 |
*****************************************************************************/
|
|
18 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
19 |
/**************************************************//**
|
20 |
@file include/row0mysql.h
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
21 |
Interface between Innobase row operations and MySQL.
|
22 |
Contains also create table and other data dictionary operations.
|
|
23 |
||
24 |
Created 9/17/2000 Heikki Tuuri
|
|
25 |
*******************************************************/
|
|
26 |
||
27 |
#ifndef row0mysql_h
|
|
28 |
#define row0mysql_h
|
|
29 |
||
30 |
#include "univ.i" |
|
31 |
#include "data0data.h" |
|
32 |
#include "que0types.h" |
|
33 |
#include "dict0types.h" |
|
34 |
#include "trx0types.h" |
|
35 |
#include "row0types.h" |
|
36 |
#include "btr0pcur.h" |
|
37 |
#include "trx0types.h" |
|
38 |
||
39 |
extern ibool row_rollback_on_timeout; |
|
40 |
||
41 |
typedef struct row_prebuilt_struct row_prebuilt_t; |
|
42 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
43 |
/*******************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
44 |
Frees the blob heap in prebuilt when no longer needed. */
|
45 |
UNIV_INTERN
|
|
46 |
void
|
|
47 |
row_mysql_prebuilt_free_blob_heap( |
|
48 |
/*==============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
49 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct of a |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
50 |
ha_innobase:: table handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
51 |
/*******************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
52 |
Stores a >= 5.0.3 format true VARCHAR length to dest, in the MySQL row
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
56 |
UNIV_INTERN
|
57 |
byte* |
|
58 |
row_mysql_store_true_var_len( |
|
59 |
/*=========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
/*******************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
64 |
Reads a >= 5.0.3 format true VARCHAR length, in the MySQL row format, and
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
69 |
const byte* |
70 |
row_mysql_read_true_varchar( |
|
71 |
/*========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
75 |
or 2 bytes */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
76 |
/*******************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
77 |
Stores a reference to a BLOB in the MySQL format. */
|
78 |
UNIV_INTERN
|
|
79 |
void
|
|
80 |
row_mysql_store_blob_ref( |
|
81 |
/*=====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
82 |
byte* dest, /*!< in: where to store */ |
83 |
ulint col_len,/*!< in: dest buffer size: determines into |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
84 |
how many bytes the BLOB length is stored,
|
85 |
the space for the length may vary from 1
|
|
86 |
to 4 bytes */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
87 |
const void* data, /*!< in: BLOB data; if the value to store |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
88 |
is SQL NULL this should be NULL pointer */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
89 |
ulint len); /*!< in: BLOB length; if the value to store |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
90 |
is SQL NULL this should be 0; remember
|
91 |
also to set the NULL bit in the MySQL record
|
|
92 |
header! */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
93 |
/*******************************************************************//**
|
94 |
Reads a reference to a BLOB in the MySQL format.
|
|
95 |
@return pointer to BLOB data */
|
|
96 |
UNIV_INTERN
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
97 |
const byte* |
98 |
row_mysql_read_blob_ref( |
|
99 |
/*====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
100 |
ulint* len, /*!< out: BLOB length */ |
101 |
const byte* ref, /*!< in: BLOB reference in the |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
102 |
MySQL format */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
103 |
ulint col_len); /*!< in: BLOB reference length |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
104 |
(not BLOB length) */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
105 |
/**************************************************************//**
|
1819.9.36
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg from MySQL InnoDB |
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 |
/**************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
117 |
Stores a non-SQL-NULL field given in the MySQL format in the InnoDB format.
|
118 |
The counterpart of this function is row_sel_field_store_in_mysql_format() in
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
119 |
row0sel.c.
|
120 |
@return up to which byte we used buf in the conversion */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
121 |
UNIV_INTERN
|
122 |
byte* |
|
123 |
row_mysql_store_col_in_innobase_format( |
|
124 |
/*===================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
125 |
dfield_t* dfield, /*!< in/out: dfield where dtype |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
126 |
information must be already set when
|
127 |
this function is called! */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
128 |
byte* buf, /*!< in/out: buffer for a converted |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
129 |
integer value; this must be at least
|
130 |
col_len long then! */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
131 |
ibool row_format_col, /*!< TRUE if the mysql_data is from |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
132 |
a MySQL row, FALSE if from a MySQL
|
133 |
key value;
|
|
134 |
in MySQL, a true VARCHAR storage
|
|
135 |
format differs in a row and in a
|
|
136 |
key value: in a key value the length
|
|
137 |
is always stored in 2 bytes! */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
138 |
const byte* mysql_data, /*!< in: MySQL column value, not |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
139 |
SQL NULL; NOTE that dfield may also
|
140 |
get a pointer to mysql_data,
|
|
141 |
therefore do not discard this as long
|
|
142 |
as dfield is used! */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
143 |
ulint col_len, /*!< in: MySQL column length; NOTE that |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
144 |
this is the storage length of the
|
145 |
column in the MySQL format row, not
|
|
146 |
necessarily the length of the actual
|
|
147 |
payload data; if the column is a true
|
|
148 |
VARCHAR then this is irrelevant */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
154 |
UNIV_INTERN
|
155 |
ibool
|
|
156 |
row_mysql_handle_errors( |
|
157 |
/*====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
158 |
ulint* new_err,/*!< out: possible new error encountered in |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
159 |
rollback, or the old error which was
|
160 |
during the function entry */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
167 |
UNIV_INTERN
|
168 |
row_prebuilt_t* |
|
169 |
row_create_prebuilt( |
|
170 |
/*================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
171 |
dict_table_t* table); /*!< in: Innobase table handle */ |
172 |
/********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
173 |
Free a prebuilt struct for a MySQL table handle. */
|
174 |
UNIV_INTERN
|
|
175 |
void
|
|
176 |
row_prebuilt_free( |
|
177 |
/*==============*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
178 |
row_prebuilt_t* prebuilt, /*!< in, own: prebuilt struct */ |
179 |
ibool dict_locked); /*!< in: TRUE=data dictionary locked */ |
|
180 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
181 |
Updates the transaction pointers in query graphs stored in the prebuilt
|
182 |
struct. */
|
|
183 |
UNIV_INTERN
|
|
184 |
void
|
|
185 |
row_update_prebuilt_trx( |
|
186 |
/*====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
187 |
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct |
188 |
in MySQL handle */
|
|
189 |
trx_t* trx); /*!< in: transaction handle */ |
|
190 |
/*********************************************************************//**
|
|
1819.5.23
by stewart at flamingspork
[patch 023/129] Merge patch for revision 1811 from InnoDB SVN: |
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). */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
194 |
UNIV_INTERN
|
195 |
void
|
|
196 |
row_unlock_table_autoinc_for_mysql( |
|
197 |
/*===============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
198 |
trx_t* trx); /*!< in/out: transaction */ |
199 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
200 |
Sets an AUTO_INC type lock on the table mentioned in prebuilt. The
|
201 |
AUTO_INC lock gives exclusive access to the auto-inc counter of the
|
|
202 |
table. The lock is reserved only for the duration of an SQL statement.
|
|
203 |
It is not compatible with another AUTO_INC or exclusive lock on the
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
204 |
table.
|
205 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
206 |
UNIV_INTERN
|
207 |
int
|
|
208 |
row_lock_table_autoinc_for_mysql( |
|
209 |
/*=============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
210 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in the MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
211 |
table handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
212 |
/*********************************************************************//**
|
213 |
Sets a table lock on the table mentioned in prebuilt.
|
|
214 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
215 |
UNIV_INTERN
|
216 |
int
|
|
217 |
row_lock_table_for_mysql( |
|
218 |
/*=====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
219 |
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in the MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
220 |
table handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
221 |
dict_table_t* table, /*!< in: table to lock, or NULL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
222 |
if prebuilt->table should be
|
223 |
locked as
|
|
224 |
prebuilt->select_lock_type */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
225 |
ulint mode); /*!< in: lock mode of table |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
226 |
(ignored if table==NULL) */
|
227 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
228 |
/*********************************************************************//**
|
229 |
Does an insert for MySQL.
|
|
230 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
231 |
UNIV_INTERN
|
232 |
int
|
|
233 |
row_insert_for_mysql( |
|
234 |
/*=================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
235 |
byte* mysql_rec, /*!< in: row in the MySQL format */ |
236 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
237 |
handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
238 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
239 |
Builds a dummy query graph used in selects. */
|
240 |
UNIV_INTERN
|
|
241 |
void
|
|
242 |
row_prebuild_sel_graph( |
|
243 |
/*===================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
244 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
245 |
handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
246 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
247 |
Gets pointer to a prebuilt update vector used in updates. If the update
|
248 |
graph has not yet been built in the prebuilt struct, then this function
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
249 |
first builds it.
|
250 |
@return prebuilt update vector */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
251 |
UNIV_INTERN
|
252 |
upd_t* |
|
253 |
row_get_prebuilt_update_vector( |
|
254 |
/*===========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
255 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
256 |
handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
257 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
258 |
Checks if a table is such that we automatically created a clustered
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
259 |
index on it (on row id).
|
260 |
@return TRUE if the clustered index was generated automatically */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
261 |
UNIV_INTERN
|
262 |
ibool
|
|
263 |
row_table_got_default_clust_index( |
|
264 |
/*==============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
269 |
UNIV_INTERN
|
270 |
int
|
|
271 |
row_update_for_mysql( |
|
272 |
/*=================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
273 |
byte* mysql_rec, /*!< in: the row to be updated, in |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
274 |
the MySQL format */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
275 |
row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
276 |
handle */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
277 |
/*********************************************************************//**
|
1819.7.159
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100602113733-fslfv73nhi0d17t4 from MySQL InnoDB |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
287 |
UNIV_INTERN
|
288 |
int
|
|
289 |
row_unlock_for_mysql( |
|
290 |
/*=================*/
|
|
1819.7.159
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100602113733-fslfv73nhi0d17t4 from MySQL InnoDB |
291 |
row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct in MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
292 |
handle */
|
1819.7.159
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100602113733-fslfv73nhi0d17t4 from MySQL InnoDB |
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. */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
298 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
299 |
Creates an query graph node of 'update' type to be used in the MySQL
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
300 |
interface.
|
301 |
@return own: update node */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
302 |
UNIV_INTERN
|
303 |
upd_node_t* |
|
304 |
row_create_update_node_for_mysql( |
|
305 |
/*=============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
311 |
UNIV_INTERN
|
312 |
ulint
|
|
313 |
row_update_cascade_for_mysql( |
|
314 |
/*=========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
315 |
que_thr_t* thr, /*!< in: query thread */ |
316 |
upd_node_t* node, /*!< in: update node used in the cascade |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
317 |
or set null operation */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
318 |
dict_table_t* table); /*!< in: table where we do the operation */ |
319 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
320 |
Locks the data dictionary exclusively for performing a table create or other
|
321 |
data dictionary modification operation. */
|
|
322 |
UNIV_INTERN
|
|
323 |
void
|
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
324 |
row_mysql_lock_data_dictionary_func( |
325 |
/*================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
326 |
trx_t* trx, /*!< in/out: transaction */ |
327 |
const char* file, /*!< in: file name */ |
|
328 |
ulint line); /*!< in: line number */ |
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
329 |
#define row_mysql_lock_data_dictionary(trx) \
|
330 |
row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__)
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
331 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
332 |
Unlocks the data dictionary exclusive lock. */
|
333 |
UNIV_INTERN
|
|
334 |
void
|
|
335 |
row_mysql_unlock_data_dictionary( |
|
336 |
/*=============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
337 |
trx_t* trx); /*!< in/out: transaction */ |
338 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
339 |
Locks the data dictionary in shared mode from modifications, for performing
|
340 |
foreign key check, rollback, or other operation invisible to MySQL. */
|
|
341 |
UNIV_INTERN
|
|
342 |
void
|
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
343 |
row_mysql_freeze_data_dictionary_func( |
344 |
/*==================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
345 |
trx_t* trx, /*!< in/out: transaction */ |
346 |
const char* file, /*!< in: file name */ |
|
347 |
ulint line); /*!< in: line number */ |
|
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
348 |
#define row_mysql_freeze_data_dictionary(trx) \
|
349 |
row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__)
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
350 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
351 |
Unlocks the data dictionary shared lock. */
|
352 |
UNIV_INTERN
|
|
353 |
void
|
|
354 |
row_mysql_unfreeze_data_dictionary( |
|
355 |
/*===============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
356 |
trx_t* trx); /*!< in/out: transaction */ |
357 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
358 |
Creates a table for MySQL. If the name of the table ends in
|
359 |
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
|
|
360 |
"innodb_table_monitor", then this will also start the printing of monitor
|
|
361 |
output by the master thread. If the table name ends in "innodb_mem_validate",
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
362 |
InnoDB will try to invoke mem_validate().
|
363 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
364 |
UNIV_INTERN
|
365 |
int
|
|
366 |
row_create_table_for_mysql( |
|
367 |
/*=======================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
368 |
dict_table_t* table, /*!< in, own: table definition |
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
369 |
(will be freed) */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
370 |
trx_t* trx); /*!< in: transaction handle */ |
371 |
/*********************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
372 |
Does an index creation operation for MySQL. TODO: currently failure
|
373 |
to create an index results in dropping the whole table! This is no problem
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
374 |
currently as all indexes must be created at the same time as the table.
|
375 |
@return error number or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
376 |
UNIV_INTERN
|
377 |
int
|
|
378 |
row_create_index_for_mysql( |
|
379 |
/*=======================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
380 |
dict_index_t* index, /*!< in, own: index definition |
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
381 |
(will be freed) */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
382 |
trx_t* trx, /*!< in: transaction handle */ |
383 |
const ulint* field_lengths); /*!< in: if not NULL, must contain |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
384 |
dict_index_get_n_fields(index)
|
385 |
actual field lengths for the
|
|
386 |
index columns, which are
|
|
387 |
then checked for not being too
|
|
388 |
large. */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
389 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
390 |
Scans a table create SQL string and adds to the data dictionary
|
391 |
the foreign key constraints declared in the string. This function
|
|
392 |
should be called after the indexes for a table have been created.
|
|
393 |
Each foreign key constraint must be accompanied with indexes in
|
|
394 |
bot participating tables. The indexes are allowed to contain more
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
395 |
fields than mentioned in the constraint.
|
396 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
397 |
UNIV_INTERN
|
398 |
int
|
|
399 |
row_table_add_foreign_constraints( |
|
400 |
/*==============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
401 |
trx_t* trx, /*!< in: transaction */ |
402 |
const char* sql_string, /*!< in: table create statement where |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
403 |
foreign keys are declared like:
|
404 |
FOREIGN KEY (a, b) REFERENCES table2(c, d),
|
|
405 |
table2 can be written also with the
|
|
406 |
database name before it: test.table2 */
|
|
1819.7.121
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB |
407 |
size_t sql_length, /*!< in: length of sql_string */ |
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
408 |
const char* name, /*!< in: table full name in the |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
409 |
normalized form
|
410 |
database_name/table_name */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
411 |
ibool reject_fks); /*!< in: if TRUE, fail with error |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
412 |
code DB_CANNOT_ADD_CONSTRAINT if
|
413 |
any foreign keys are found. */
|
|
414 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
415 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
416 |
The master thread in srv0srv.c calls this regularly to drop tables which
|
417 |
we must drop in background after queries to them have ended. Such lazy
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
418 |
dropping of tables is needed in ALTER TABLE on Unix.
|
419 |
@return how many tables dropped + remaining tables in list */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
420 |
UNIV_INTERN
|
421 |
ulint
|
|
422 |
row_drop_tables_for_mysql_in_background(void); |
|
423 |
/*=========================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
424 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
425 |
Get the background drop list length. NOTE: the caller must own the kernel
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
426 |
mutex!
|
427 |
@return how many tables in list */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
428 |
UNIV_INTERN
|
429 |
ulint
|
|
430 |
row_get_background_drop_list_len_low(void); |
|
431 |
/*======================================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
432 |
/*********************************************************************//**
|
433 |
Truncates a table for MySQL.
|
|
434 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
435 |
UNIV_INTERN
|
436 |
int
|
|
437 |
row_truncate_table_for_mysql( |
|
438 |
/*=========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
439 |
dict_table_t* table, /*!< in: table handle */ |
440 |
trx_t* trx); /*!< in: transaction handle */ |
|
441 |
/*********************************************************************//**
|
|
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
442 |
Drops a table for MySQL. If the name of the dropped table ends in
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
443 |
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
|
444 |
"innodb_table_monitor", then this will also stop the printing of monitor
|
|
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
445 |
output by the master thread. If the data dictionary was not already locked
|
446 |
by the transaction, the transaction will be committed. Otherwise, the
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
447 |
data dictionary will remain locked.
|
448 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
449 |
UNIV_INTERN
|
450 |
int
|
|
451 |
row_drop_table_for_mysql( |
|
452 |
/*=====================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
453 |
const char* name, /*!< in: table name */ |
454 |
trx_t* trx, /*!< in: transaction handle */ |
|
455 |
ibool drop_db);/*!< in: TRUE=dropping whole database */ |
|
1819.5.176
by marko
Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6521 from MySQL InnoDB |
456 |
/*********************************************************************//**
|
457 |
Drop all temporary tables during crash recovery. */
|
|
458 |
UNIV_INTERN
|
|
459 |
void
|
|
460 |
row_mysql_drop_temp_tables(void); |
|
461 |
/*============================*/
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
462 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
463 |
/*********************************************************************//**
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
464 |
Discards the tablespace of a table which stored in an .ibd file. Discarding
|
465 |
means that this function deletes the .ibd file and assigns a new table id for
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
466 |
the table. Also the flag table->ibd_file_missing is set TRUE.
|
467 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
468 |
UNIV_INTERN
|
469 |
int
|
|
470 |
row_discard_tablespace_for_mysql( |
|
471 |
/*=============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
472 |
const char* name, /*!< in: table name */ |
473 |
trx_t* trx); /*!< in: transaction handle */ |
|
474 |
/*****************************************************************//**
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
475 |
Imports a tablespace. The space id in the .ibd file must match the space id
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
476 |
of the table in the data dictionary.
|
477 |
@return error code or DB_SUCCESS */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
478 |
UNIV_INTERN
|
479 |
int
|
|
480 |
row_import_tablespace_for_mysql( |
|
481 |
/*============================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
487 |
UNIV_INTERN
|
488 |
int
|
|
489 |
row_drop_database_for_mysql( |
|
490 |
/*========================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
496 |
UNIV_INTERN
|
497 |
ulint
|
|
498 |
row_rename_table_for_mysql( |
|
499 |
/*=======================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
/*********************************************************************//**
|
|
1819.5.185
by marko
Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6547 from MySQL InnoDB |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
509 |
UNIV_INTERN
|
510 |
ulint
|
|
1819.5.185
by marko
Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6547 from MySQL InnoDB |
511 |
row_check_index_for_mysql( |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
512 |
/*======================*/
|
1819.5.185
by marko
Merge Revision revid:svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6547 from MySQL InnoDB |
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 */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
518 |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
519 |
/*********************************************************************//**
|
520 |
Determines if a table is a magic monitor table.
|
|
521 |
@return TRUE if monitor table */
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
522 |
UNIV_INTERN
|
523 |
ibool
|
|
524 |
row_is_magic_monitor_table( |
|
525 |
/*=======================*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
526 |
const char* table_name); /*!< in: name of the table, in the |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
527 |
form database/table_name */
|
528 |
||
529 |
/* A struct describing a place for an individual column in the MySQL
|
|
530 |
row format which is presented to the table handler in ha_innobase.
|
|
531 |
This template struct is used to speed up row transformations between
|
|
532 |
Innobase and MySQL. */
|
|
533 |
||
534 |
typedef struct mysql_row_templ_struct mysql_row_templ_t; |
|
535 |
struct mysql_row_templ_struct { |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
536 |
ulint col_no; /*!< column number of the column */ |
537 |
ulint rec_field_no; /*!< field number of the column in an |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
538 |
Innobase record in the current index;
|
539 |
not defined if template_type is
|
|
540 |
ROW_MYSQL_WHOLE_ROW */
|
|
1819.9.169
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20101019060415-bj3u6ewk022mk4nr from MySQL InnoDB |
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 */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
550 |
MySQL record */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
551 |
ulint mysql_null_bit_mask; /*!< bit mask to get the NULL bit, |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
552 |
zero if column cannot be NULL */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
553 |
ulint type; /*!< column type in Innobase mtype |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
554 |
numbers DATA_CHAR... */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
555 |
ulint mysql_type; /*!< MySQL type code; this is always |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
556 |
< 256 */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
557 |
ulint mysql_length_bytes; /*!< if mysql_type |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
558 |
== DATA_MYSQL_TRUE_VARCHAR, this tells
|
559 |
whether we should use 1 or 2 bytes to
|
|
560 |
store the MySQL true VARCHAR data
|
|
561 |
length at the start of row in the MySQL
|
|
562 |
format (NOTE that the MySQL key value
|
|
563 |
format always uses 2 bytes for the data
|
|
564 |
len) */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
565 |
ulint charset; /*!< MySQL charset-collation code |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
566 |
of the column, or zero */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
572 |
type and this field is != 0, then
|
573 |
it is an unsigned integer type */
|
|
574 |
};
|
|
575 |
||
576 |
#define MYSQL_FETCH_CACHE_SIZE 8
|
|
577 |
/* After fetching this many rows, we start caching them in fetch_cache */
|
|
578 |
#define MYSQL_FETCH_CACHE_THRESHOLD 4
|
|
579 |
||
580 |
#define ROW_PREBUILT_ALLOCATED 78540783
|
|
581 |
#define ROW_PREBUILT_FREED 26423527
|
|
582 |
||
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
583 |
/** A struct for (sometimes lazily) prebuilt structures in an Innobase table
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
584 |
handle used within MySQL; these are used to save CPU time. */
|
585 |
||
586 |
struct row_prebuilt_struct { |
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
587 |
ulint magic_n; /*!< this magic number is set to |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
588 |
ROW_PREBUILT_ALLOCATED when created,
|
589 |
or ROW_PREBUILT_FREED when the
|
|
590 |
struct has been freed */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
596 |
an SQL statement: we may have to set
|
597 |
an intention lock on the table,
|
|
598 |
create a consistent read view etc. */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
599 |
unsigned mysql_has_locked:1;/*!< this is set TRUE when MySQL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
600 |
calls external_lock on this handle
|
601 |
with a lock flag, and set FALSE when
|
|
602 |
with the F_UNLOCK flag */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
603 |
unsigned clust_index_was_generated:1; |
604 |
/*!< if the user did not define a
|
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
605 |
primary key in MySQL, then Innobase
|
606 |
automatically generated a clustered
|
|
607 |
index where the ordering column is
|
|
608 |
the row id: in this case this flag
|
|
609 |
is set to TRUE */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
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 |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
613 |
ha_innobase::extra with the
|
614 |
argument HA_EXTRA_KEYREAD; it is enough
|
|
615 |
to read just columns defined in
|
|
616 |
the index (i.e., no read of the
|
|
617 |
clustered index record necessary) */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
618 |
unsigned template_type:2;/*!< ROW_MYSQL_WHOLE_ROW, |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
619 |
ROW_MYSQL_REC_FIELDS,
|
620 |
ROW_MYSQL_DUMMY_TEMPLATE, or
|
|
621 |
ROW_MYSQL_NO_TEMPLATE */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
622 |
unsigned n_template:10; /*!< number of elements in the |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
623 |
template */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
624 |
unsigned null_bitmap_len:10;/*!< number of bytes in the SQL NULL |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
625 |
bitmap at the start of a row in the
|
626 |
MySQL format */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
627 |
unsigned need_to_access_clustered:1; /*!< if we are fetching |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
628 |
columns through a secondary index
|
629 |
and at least one column is not in
|
|
630 |
the secondary index, then this is
|
|
631 |
set to TRUE */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
632 |
unsigned templ_contains_blob:1;/*!< TRUE if the template contains |
1819.9.37
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100629131907-epjs6h2rv457h7qv from MySQL InnoDB |
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) */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
638 |
mysql_row_templ_t* mysql_template;/*!< template used to transform |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
639 |
rows fast between MySQL and Innobase
|
640 |
formats; memory for this template
|
|
641 |
is not allocated from 'heap' */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
642 |
mem_heap_t* heap; /*!< memory heap from which |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
643 |
these auxiliary structures are
|
644 |
allocated when needed */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
645 |
ins_node_t* ins_node; /*!< Innobase SQL insert node |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
646 |
used to perform inserts
|
647 |
to the table */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
648 |
byte* ins_upd_rec_buff;/*!< buffer for storing data converted |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
649 |
to the Innobase format from the MySQL
|
650 |
format */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
651 |
const byte* default_rec; /*!< the default values of all columns |
641.2.2
by Monty Taylor
InnoDB Plugin 1.0.3 |
652 |
(a "default row") in MySQL format */
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
653 |
ulint hint_need_to_fetch_extra_cols; |
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
654 |
/*!< normally this is set to 0; if this
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
655 |
is set to ROW_RETRIEVE_PRIMARY_KEY,
|
656 |
then we should at least retrieve all
|
|
657 |
columns in the primary key; if this
|
|
658 |
is set to ROW_RETRIEVE_ALL_COLS, then
|
|
659 |
we must retrieve all columns in the
|
|
660 |
key (if read_just_key == 1), or all
|
|
661 |
columns in the table */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
662 |
upd_node_t* upd_node; /*!< Innobase SQL update node used |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
663 |
to perform updates and deletes */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
664 |
que_fork_t* ins_graph; /*!< Innobase SQL query graph used |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
665 |
in inserts */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
666 |
que_fork_t* upd_graph; /*!< Innobase SQL query graph used |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
667 |
in updates or deletes */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
668 |
btr_pcur_t* pcur; /*!< persistent cursor used in selects |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
669 |
and updates */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
670 |
btr_pcur_t* clust_pcur; /*!< persistent cursor used in |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
671 |
some selects and updates */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
672 |
que_fork_t* sel_graph; /*!< dummy query graph used in |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
673 |
selects */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
674 |
dtuple_t* search_tuple; /*!< prebuilt dtuple used in selects */ |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
675 |
byte row_id[DATA_ROW_ID_LEN]; |
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
676 |
/*!< if the clustered index was
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
677 |
generated, the row id of the
|
678 |
last row fetched is stored
|
|
679 |
here */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
680 |
dtuple_t* clust_ref; /*!< prebuilt dtuple used in |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
681 |
sel/upd/del */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
682 |
ulint select_lock_type;/*!< LOCK_NONE, LOCK_S, or LOCK_X */ |
683 |
ulint stored_select_lock_type;/*!< this field is used to |
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
684 |
remember the original select_lock_type
|
685 |
that was decided in ha_innodb.cc,
|
|
686 |
::store_lock(), ::external_lock(),
|
|
687 |
etc. */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
688 |
ulint row_read_type; /*!< ROW_READ_WITH_LOCKS if row locks |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
689 |
should be the obtained for records
|
690 |
under an UPDATE or DELETE cursor.
|
|
691 |
If innodb_locks_unsafe_for_binlog
|
|
692 |
is TRUE, this can be set to
|
|
693 |
ROW_READ_TRY_SEMI_CONSISTENT, so that
|
|
694 |
if the row under an UPDATE or DELETE
|
|
695 |
cursor was locked by another
|
|
696 |
transaction, InnoDB will resort
|
|
697 |
to reading the last committed value
|
|
698 |
('semi-consistent read'). Then,
|
|
699 |
this field will be set to
|
|
700 |
ROW_READ_DID_SEMI_CONSISTENT to
|
|
701 |
indicate that. If the row does not
|
|
702 |
match the WHERE condition, MySQL will
|
|
703 |
invoke handler::unlock_row() to
|
|
704 |
clear the flag back to
|
|
705 |
ROW_READ_TRY_SEMI_CONSISTENT and
|
|
706 |
to simply skip the row. If
|
|
707 |
the row matches, the next call to
|
|
708 |
row_search_for_mysql() will lock
|
|
709 |
the row.
|
|
710 |
This eliminates lock waits in some
|
|
711 |
cases; note that this breaks
|
|
712 |
serializability. */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
713 |
ulint new_rec_locks; /*!< normally 0; if |
714 |
srv_locks_unsafe_for_binlog is
|
|
715 |
TRUE or session is using READ
|
|
1819.7.159
by Marko Mäkelä, Stewart Smith
Merge Revision revid:marko.makela@oracle.com-20100602113733-fslfv73nhi0d17t4 from MySQL InnoDB |
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') */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
727 |
ulint mysql_prefix_len;/*!< byte offset of the end of |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
728 |
the last requested column */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
729 |
ulint mysql_row_len; /*!< length in bytes of a row in the |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
730 |
MySQL format */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
731 |
ulint n_rows_fetched; /*!< number of rows fetched after |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
732 |
positioning the current cursor */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
733 |
ulint fetch_direction;/*!< ROW_SEL_NEXT or ROW_SEL_PREV */ |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
734 |
byte* fetch_cache[MYSQL_FETCH_CACHE_SIZE]; |
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
735 |
/*!< a cache for fetched rows if we
|
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
736 |
fetch many rows from the same cursor:
|
737 |
it saves CPU time to fetch them in a
|
|
738 |
batch; we reserve mysql_row_len
|
|
739 |
bytes for each such row; these
|
|
740 |
pointers point 4 bytes past the
|
|
741 |
allocated mem buf start, because
|
|
742 |
there is a 4 byte magic number at the
|
|
743 |
start and at the end */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
744 |
ibool keep_other_fields_on_keyread; /*!< when using fetch |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
745 |
cache with HA_EXTRA_KEYREAD, don't
|
746 |
overwrite other fields in mysql row
|
|
747 |
row buffer.*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
748 |
ulint fetch_cache_first;/*!< position of the first not yet |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
749 |
fetched row in fetch_cache */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
750 |
ulint n_fetch_cached; /*!< number of not yet fetched rows |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
751 |
in fetch_cache */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
752 |
mem_heap_t* blob_heap; /*!< in SELECTS BLOB fields are copied |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
753 |
to this heap */
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
754 |
mem_heap_t* old_vers_heap; /*!< memory heap where a previous |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
755 |
version is built in consistent read */
|
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
756 |
/*----------------------*/
|
1114.1.1
by Monty Taylor
Merged InnoDB Plugin 1.0.4 |
757 |
ib_uint64_t autoinc_last_value; |
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
758 |
/*!< last value of AUTO-INC interval */
|
1114.1.1
by Monty Taylor
Merged InnoDB Plugin 1.0.4 |
759 |
ib_uint64_t autoinc_increment;/*!< The increment step of the auto |
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
760 |
increment column. Value must be
|
761 |
greater than or equal to 1. Required to
|
|
762 |
calculate the next value */
|
|
641.1.5
by Monty Taylor
Merged in innodb plugin 1.0.2 |
763 |
ib_uint64_t autoinc_offset; /* The offset passed to |
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
764 |
get_auto_increment() by MySQL. Required
|
765 |
to calculate the next value */
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
766 |
ulint autoinc_error; /*!< The actual error code encountered |
641.2.1
by Monty Taylor
InnoDB Plugin 1.0.2 |
767 |
while trying to init or read the
|
768 |
autoinc value from the table. We
|
|
769 |
store it here so that we can return
|
|
770 |
it to MySQL */
|
|
771 |
/*----------------------*/
|
|
641.2.3
by Monty Taylor
InnoDB Plugin 1.0.4 |
772 |
ulint magic_n2; /*!< this should be the same as |
641.1.2
by Monty Taylor
Imported 1.0.1 with clean - with no changes. |
773 |
magic_n */
|
774 |
};
|
|
775 |
||
776 |
#define ROW_PREBUILT_FETCH_MAGIC_N 465765687
|
|
777 |
||
778 |
#define ROW_MYSQL_WHOLE_ROW 0
|
|
779 |
#define ROW_MYSQL_REC_FIELDS 1
|
|
780 |
#define ROW_MYSQL_NO_TEMPLATE 2
|
|
781 |
#define ROW_MYSQL_DUMMY_TEMPLATE 3 /* dummy template used in |
|
782 |
row_scan_and_check_index */
|
|
783 |
||
784 |
/* Values for hint_need_to_fetch_extra_cols */
|
|
785 |
#define ROW_RETRIEVE_PRIMARY_KEY 1
|
|
786 |
#define ROW_RETRIEVE_ALL_COLS 2
|
|
787 |
||
788 |
/* Values for row_read_type */
|
|
789 |
#define ROW_READ_WITH_LOCKS 0
|
|
790 |
#define ROW_READ_TRY_SEMI_CONSISTENT 1
|
|
791 |
#define ROW_READ_DID_SEMI_CONSISTENT 2
|
|
792 |
||
793 |
#ifndef UNIV_NONINL
|
|
794 |
#include "row0mysql.ic" |
|
795 |
#endif
|
|
796 |
||
797 |
#endif
|