diff options
author | Monty <monty@mariadb.org> | 2018-05-23 22:45:32 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2018-05-24 18:55:18 +0300 |
commit | 72a8d29e00d4deec7c836228b54e19fa35ab7ad7 (patch) | |
tree | 98d3caba91cee9d0b635e33f0b8ea498d7f7ce6c /storage/archive | |
parent | 4cd2a0eb56010ea1e8d2601151ca0d25834deb7e (diff) | |
download | mariadb-git-72a8d29e00d4deec7c836228b54e19fa35ab7ad7.tar.gz |
Fixed archive to work with record[1]
ha_archive::max_row_length() and ha_archive::pack_row()
didn't use record parameter properly. Especially testing
of null was wrong for record[1]
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/ha_archive.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index afa39e6a5f7..2b6079d4a29 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -897,18 +897,19 @@ int ha_archive::real_write_row(uchar *buf, azio_stream *writer) the bytes required for the length in the header. */ -uint32 ha_archive::max_row_length(const uchar *buf) +uint32 ha_archive::max_row_length(const uchar *record) { uint32 length= (uint32)(table->s->reclength + table->s->fields*2); length+= ARCHIVE_ROW_HEADER_SIZE; + my_ptrdiff_t const rec_offset= record - table->record[0]; uint *ptr, *end; for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ; ptr != end ; ptr++) { - if (!table->field[*ptr]->is_null()) - length += 2 + ((Field_blob*)table->field[*ptr])->get_length(); + if (!table->field[*ptr]->is_null(rec_offset)) + length += 2 + ((Field_blob*)table->field[*ptr])->get_length(rec_offset); } return length; @@ -918,10 +919,9 @@ uint32 ha_archive::max_row_length(const uchar *buf) unsigned int ha_archive::pack_row(uchar *record, azio_stream *writer) { uchar *ptr; - + my_ptrdiff_t const rec_offset= record - table->record[0]; DBUG_ENTER("ha_archive::pack_row"); - if (fix_rec_buff(max_row_length(record))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */ @@ -935,7 +935,7 @@ unsigned int ha_archive::pack_row(uchar *record, azio_stream *writer) for (Field **field=table->field ; *field ; field++) { - if (!((*field)->is_null())) + if (!((*field)->is_null(rec_offset))) ptr= (*field)->pack(ptr, record + (*field)->offset(record)); } |