summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-12-13 20:54:20 +0200
committermonty@hundin.mysql.fi <>2001-12-13 20:54:20 +0200
commit6aeb40bd3f11a216e687d6b0cbe5595830f7a6bf (patch)
tree053b9c4d48bf88ba54d5cf728bfebadb38d1a548 /sql/unireg.cc
parentc95adec1e4463c162392babcc83b4776568ffa41 (diff)
parent5ae05984acbda492dc875a5ba0ffc2c1dc076b71 (diff)
downloadmariadb-git-6aeb40bd3f11a216e687d6b0cbe5595830f7a6bf.tar.gz
merge
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 9f34e9cc71b..8c72dfc2855 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -515,16 +515,23 @@ static bool make_empty_rec(File file,enum db_type table_type,
uchar *buff,*null_pos;
TABLE table;
create_field *field;
+ handler *handler;
DBUG_ENTER("make_empty_rec");
/* We need a table to generate columns for default values */
bzero((char*) &table,sizeof(table));
- table.db_low_byte_first=test(table_type == DB_TYPE_MYISAM ||
- table_type == DB_TYPE_HEAP);
- table.blob_ptr_size=portable_sizeof_char_ptr;
+ handler= get_new_handler((TABLE*) 0, table_type);
- if (!(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL))))
+ if (!handler ||
+ !(buff=(uchar*) my_malloc((uint) reclength,MYF(MY_WME | MY_ZEROFILL))))
+ {
+ delete handler;
DBUG_RETURN(1);
+ }
+
+ table.db_low_byte_first= handler->low_byte_first();
+ table.blob_ptr_size=portable_sizeof_char_ptr;
+
firstpos=reclength;
null_count=0;
if (!(table_options & HA_OPTION_PACK_RECORD))
@@ -574,8 +581,11 @@ static bool make_empty_rec(File file,enum db_type table_type,
regfield->reset();
delete regfield;
}
- bfill((byte*) buff+null_length,firstpos-null_length,255);/* Fill not used startpos */
+
+ /* Fill not used startpos */
+ bfill((byte*) buff+null_length,firstpos-null_length,255);
error=(int) my_write(file,(byte*) buff,(uint) reclength,MYF_RW);
my_free((gptr) buff,MYF(MY_FAE));
+ delete handler;
DBUG_RETURN(error);
} /* make_empty_rec */