diff options
author | brian@zim.(none) <> | 2006-08-14 15:24:29 -0700 |
---|---|---|
committer | brian@zim.(none) <> | 2006-08-14 15:24:29 -0700 |
commit | 8deb5beb9ce9a3549e4baeac4e50f53c2492e355 (patch) | |
tree | 2e163bcaefab8eeba55ac25ca6707e3181740da8 /storage/archive | |
parent | 1f80fb04532d6b0e9b8558edd020a09353e962ec (diff) | |
parent | c43a332859b6d216d5fe4eef3ef639b1f117f6bd (diff) | |
download | mariadb-git-8deb5beb9ce9a3549e4baeac4e50f53c2492e355.tar.gz |
Merge zim.(none):/home/brian/mysql/dep-5.0
into zim.(none):/home/brian/mysql/dep-5.1
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/ha_archive.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 6c0796e3bdc..de8b50fd2f3 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -901,6 +901,28 @@ int ha_archive::write_row(byte *buf) if (init_archive_writer()) DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + /* + Varchar structures are constant in size but are not cleaned up request + to request. The following sets all unused space to null to improve + compression. + */ + for (Field **field=table->field ; *field ; field++) + { + DBUG_PRINT("archive",("Pack is %d\n", (*field)->pack_length())); + DBUG_PRINT("archive",("MyPack is %d\n", (*field)->data_length((char*) buf + (*field)->offset()))); + if ((*field)->real_type() == MYSQL_TYPE_VARCHAR) + { + uint actual_length= (*field)->data_length((char*) buf + (*field)->offset()); + uint offset= (*field)->offset() + actual_length + + (actual_length > 255 ? 2 : 1); + DBUG_PRINT("archive",("Offset is %d -> %d\n", actual_length, offset)); + /* + if ((*field)->pack_length() + (*field)->offset() != offset) + bzero(buf + offset, (size_t)((*field)->pack_length() + (actual_length > 255 ? 2 : 1) - (*field)->data_length)); + */ + } + } + share->rows_recorded++; rc= real_write_row(buf, &(share->archive_write)); error: |