@@ -150,13 +150,20 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
150
150
the various member functions of Field and subclasses expect to
151
151
write.
152
152
153
- The row is assumed to only consist of the fields for which the corresponding
154
- bit in bitset @c cols is set; the other parts of the record are left alone.
153
+ The row is assumed to only consist of the fields for which the
154
+ corresponding bit in bitset @c cols is set; the other parts of the
155
+ record are left alone.
155
156
156
157
At most @c colcnt columns are read: if the table is larger than
157
158
that, the remaining fields are not filled in.
158
159
159
- @param rli Relay log info
160
+ @note The relay log information can be NULL, which means that no
161
+ checking or comparison with the source table is done, simply
162
+ because it is not used. This feature is used by MySQL Backup to
163
+ unpack a row from from the backup image, but can be used for other
164
+ purposes as well.
165
+
166
+ @param rli Relay log info, which can be NULL
160
167
@param table Table to unpack into
161
168
@param colcnt Number of columns to read from record
162
169
@param row_data
@@ -170,10 +177,8 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
170
177
171
178
@retval 0 No error
172
179
173
- @retval ER_NO_DEFAULT_FOR_FIELD
174
- Returned if one of the fields existing on the slave but not on the
175
- master does not have a default value (and isn't nullable)
176
-
180
+ @retval HA_ERR_GENERIC
181
+ A generic, internal, error caused the unpacking to fail.
177
182
*/
178
183
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
179
184
int
@@ -185,8 +190,8 @@ unpack_row(Relay_log_info const *rli,
185
190
{
186
191
DBUG_ENTER (" unpack_row" );
187
192
DBUG_ASSERT (row_data);
193
+ DBUG_ASSERT (table);
188
194
size_t const master_null_byte_count= (bitmap_bits_set (cols) + 7 ) / 8 ;
189
- int error= 0 ;
190
195
191
196
uchar const *null_ptr= row_data;
192
197
uchar const *pack_ptr= row_data + master_null_byte_count;
@@ -202,14 +207,21 @@ unpack_row(Relay_log_info const *rli,
202
207
// The "current" null bits
203
208
unsigned int null_bits= *null_ptr++;
204
209
uint i= 0 ;
205
- table_def *tabledef;
206
- TABLE *conv_table;
207
- bool table_found= rli->get_table_data (table, &tabledef, &conv_table);
210
+ table_def *tabledef= NULL ;
211
+ TABLE *conv_table= NULL ;
212
+ bool table_found= rli && rli ->get_table_data (table, &tabledef, &conv_table);
208
213
DBUG_PRINT (" debug" , (" Table data: table_found: %d, tabldef: %p, conv_table: %p" ,
209
214
table_found, tabledef, conv_table));
210
215
DBUG_ASSERT (table_found);
211
- if (!table_found)
212
- return HA_ERR_GENERIC;
216
+
217
+ /*
218
+ If rli is NULL it means that there is no source table and that the
219
+ row shall just be unpacked without doing any checks. This feature
220
+ is used by MySQL Backup, but can be used for other purposes as
221
+ well.
222
+ */
223
+ if (rli && !table_found)
224
+ DBUG_RETURN (HA_ERR_GENERIC);
213
225
214
226
for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
215
227
{
@@ -372,7 +384,7 @@ unpack_row(Relay_log_info const *rli,
372
384
*master_reclength = table->s ->reclength ;
373
385
}
374
386
375
- DBUG_RETURN (error );
387
+ DBUG_RETURN (0 );
376
388
}
377
389
378
390
/* *
0 commit comments