Commit ad42dc75 authored by Mats Kindahl's avatar Mats Kindahl

Merging with mysql-5.1-rep+2-delivery1

parents 5b636ce2 f457a887
......@@ -150,13 +150,20 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
the various member functions of Field and subclasses expect to
write.
The row is assumed to only consist of the fields for which the corresponding
bit in bitset @c cols is set; the other parts of the record are left alone.
The row is assumed to only consist of the fields for which the
corresponding bit in bitset @c cols is set; the other parts of the
record are left alone.
At most @c colcnt columns are read: if the table is larger than
that, the remaining fields are not filled in.
@param rli Relay log info
@note The relay log information can be NULL, which means that no
checking or comparison with the source table is done, simply
because it is not used. This feature is used by MySQL Backup to
unpack a row from from the backup image, but can be used for other
purposes as well.
@param rli Relay log info, which can be NULL
@param table Table to unpack into
@param colcnt Number of columns to read from record
@param row_data
......@@ -170,10 +177,8 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
@retval 0 No error
@retval ER_NO_DEFAULT_FOR_FIELD
Returned if one of the fields existing on the slave but not on the
master does not have a default value (and isn't nullable)
@retval HA_ERR_GENERIC
A generic, internal, error caused the unpacking to fail.
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
int
......@@ -185,8 +190,8 @@ unpack_row(Relay_log_info const *rli,
{
DBUG_ENTER("unpack_row");
DBUG_ASSERT(row_data);
DBUG_ASSERT(table);
size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8;
int error= 0;
uchar const *null_ptr= row_data;
uchar const *pack_ptr= row_data + master_null_byte_count;
......@@ -202,14 +207,21 @@ unpack_row(Relay_log_info const *rli,
// The "current" null bits
unsigned int null_bits= *null_ptr++;
uint i= 0;
table_def *tabledef;
TABLE *conv_table;
bool table_found= rli->get_table_data(table, &tabledef, &conv_table);
table_def *tabledef= NULL;
TABLE *conv_table= NULL;
bool table_found= rli && rli->get_table_data(table, &tabledef, &conv_table);
DBUG_PRINT("debug", ("Table data: table_found: %d, tabldef: %p, conv_table: %p",
table_found, tabledef, conv_table));
DBUG_ASSERT(table_found);
if (!table_found)
return HA_ERR_GENERIC;
/*
If rli is NULL it means that there is no source table and that the
row shall just be unpacked without doing any checks. This feature
is used by MySQL Backup, but can be used for other purposes as
well.
*/
if (rli && !table_found)
DBUG_RETURN(HA_ERR_GENERIC);
for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr)
{
......@@ -372,7 +384,7 @@ unpack_row(Relay_log_info const *rli,
*master_reclength = table->s->reclength;
}
DBUG_RETURN(error);
DBUG_RETURN(0);
}
/**
......
......@@ -592,6 +592,12 @@ can_convert_field_to(Field *field,
{
if (metadata == 0) // Metadata can only be zero if no metadata was provided
{
/*
If there is no metadata, we either have an old event where no
metadata were supplied, or a type that does not require any
metadata. In either case, conversion can be done but no
conversion table is necessary.
*/
DBUG_PRINT("debug", ("Base types are identical, but there is no metadata"));
*order_var= 0;
DBUG_RETURN(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment