diff options
author | unknown <msvensson@neptunus.(none)> | 2006-07-19 08:57:52 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-07-19 08:57:52 +0200 |
commit | 0f72333074cd33d036e099ef8bbaec02b449267d (patch) | |
tree | 12fdbf31d32aa8f9d484db3ca6e0c795001454c8 /sql/unireg.cc | |
parent | 57dc819a14eabba0048ad8638aeb7b5055c0ff84 (diff) | |
parent | e86971948777bba5fa8e6f47759930e30fdd00ad (diff) | |
download | mariadb-git-0f72333074cd33d036e099ef8bbaec02b449267d.tar.gz |
Merge bk-internal:/home/bk/mysql-5.1
into neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
mysql-test/r/partition.result:
Auto merged
mysql-test/t/partition.test:
Auto merged
sql/unireg.cc:
Auto merged
BitKeeper/deleted/.del-partition_innodb.result:
Auto merged
BitKeeper/deleted/.del-partition_innodb.test:
Auto merged
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r-- | sql/unireg.cc | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc index 426debab7d8..396ff4fba27 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -76,7 +76,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, handler *db_file) { LEX_STRING str_db_type; - uint reclength,info_length,screens,key_info_length,maxlength,i; + uint reclength, info_length, screens, key_info_length, maxlength, tmp_len, i; ulong key_buff_length; File file; ulong filepos, data_offset; @@ -169,10 +169,30 @@ bool mysql_create_frm(THD *thd, const char *file_name, fileinfo[26]= (uchar) test((create_info->max_rows == 1) && (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); - strmake((char*) forminfo+47,create_info->comment ? create_info->comment : "", - 60); - forminfo[46]=(uchar) strlen((char*)forminfo+47); // Length of comment + tmp_len= system_charset_info->cset->charpos(system_charset_info, + create_info->comment.str, + create_info->comment.str + + create_info->comment.length, 60); + if (tmp_len < create_info->comment.length) + { + char buff[128]; + (void) my_snprintf(buff, sizeof(buff), "Too long comment for table '%s'", + table); + if ((thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) + { + my_message(ER_UNKNOWN_ERROR, buff, MYF(0)); + goto err; + } + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff); + create_info->comment.length= tmp_len; + } + + strmake((char*) forminfo+47, create_info->comment.str ? + create_info->comment.str : "", create_info->comment.length); + forminfo[46]=(uchar) create_info->comment.length; #ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) { @@ -181,6 +201,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, } #endif int2store(fileinfo+59,db_file->extra_rec_buf_length()); + if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) || my_pwrite(file,(byte*) keybuff,key_info_length, (ulong) uint2korr(fileinfo+6),MYF_RW)) @@ -523,6 +544,27 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type, create_field *field; while ((field=it++)) { + + uint tmp_len= system_charset_info->cset->charpos(system_charset_info, + field->comment.str, + field->comment.str + + field->comment.length, 255); + if (tmp_len < field->comment.length) + { + char buff[128]; + (void) my_snprintf(buff,sizeof(buff), "Too long comment for field '%s'", + field->field_name); + if ((current_thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) + { + my_message(ER_UNKNOWN_ERROR, buff, MYF(0)); + DBUG_RETURN(1); + } + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff); + field->comment.length= tmp_len; + } + totlength+= field->length; com_length+= field->comment.length; if (MTYP_TYPENR(field->unireg_check) == Field::NOEMPTY || |