Commit 411d7f59 authored by unknown's avatar unknown
Browse files

Added option --valgrind-mysqltest to mysql-test-run

Added flag to Field::store(longlong) to specify if value is unsigned.
This fixes bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0)
Fixed warning from valgrind in CREATE ... SELECT
Fixed double free of mysql.options if reconnect failed


mysql-test/mysql-test-run.sh:
  Added option --valgrind-mysqltest to allow one to run mysqltest with valgrind
mysql-test/r/bigint.result:
  Update results after fix for Field::store(longlong)
mysql-test/r/range.result:
  Update results after fix for Field::store(longlong)
mysql-test/r/strict.result:
  Update results after fix for Field::store(longlong)
  (This fixes some wrong results when storing things into bigint columns)
mysql-test/r/type_ranges.result:
  Update results after fix for Field::store(longlong)
mysql-test/t/bigint.test:
  Added testing for #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0)
mysql-test/t/innodb.test:
  Removed comments affected by this bug fix
mysql-test/t...
parent 17d63d13
......@@ -289,7 +289,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
topics->file->ha_index_init(iindex_topic);
relations->file->ha_index_init(iindex_relations);
rkey_id->store((longlong) key_id);
rkey_id->store((longlong) key_id, TRUE);
rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW);
int key_res= relations->file->index_read(relations->record[0],
(byte *)buff, rkey_id->pack_length(),
......@@ -302,7 +302,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
char topic_id_buff[8];
longlong topic_id= rtopic_id->val_int();
Field *field= find_fields[help_topic_help_topic_id].field;
field->store((longlong) topic_id);
field->store((longlong) topic_id, TRUE);
field->get_key_image(topic_id_buff, field->pack_length(), Field::itRAW);
if (!topics->file->index_read(topics->record[0], (byte *)topic_id_buff,
......
......@@ -2255,7 +2255,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
}
tmp_buff= file->table_type();
table->field[4]->store(tmp_buff, strlen(tmp_buff), cs);
table->field[5]->store((longlong) share->frm_version);
table->field[5]->store((longlong) share->frm_version, TRUE);
enum row_type row_type = file->get_row_type();
switch (row_type) {
case ROW_TYPE_NOT_USED:
......@@ -2284,7 +2284,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
if (!tables->schema_table)
{
table->field[7]->store((longlong) file->records);
table->field[7]->store((longlong) file->records, TRUE);
table->field[7]->set_notnull();
}
table->field[8]->store((longlong) file->mean_rec_length);
......@@ -2297,7 +2297,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
table->field[12]->store((longlong) file->delete_length);
if (show_table->found_next_number_field)
{
table->field[13]->store((longlong) file->auto_increment_value);
table->field[13]->store((longlong) file->auto_increment_value, TRUE);
table->field[13]->set_notnull();
}
if (file->create_time)
......@@ -2325,7 +2325,7 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
if (file->table_flags() & (ulong) HA_HAS_CHECKSUM)
{
table->field[18]->store((longlong) file->checksum());
table->field[18]->store((longlong) file->checksum(), TRUE);
table->field[18]->set_notnull();
}
......@@ -2476,7 +2476,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
table->field[2]->store(file_name, file_name_length, cs);
table->field[3]->store(field->field_name, strlen(field->field_name),
cs);
table->field[4]->store((longlong) count);
table->field[4]->store((longlong) count, TRUE);
field->sql_type(type);
table->field[14]->store(type.ptr(), type.length(), cs);
tmp_buff= strchr(type.ptr(), '(');
......@@ -2520,7 +2520,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
{
longlong c_octet_len= is_blob ? (longlong) field->max_length() :
(longlong) field->max_length()/field->charset()->mbmaxlen;
table->field[8]->store(c_octet_len);
table->field[8]->store(c_octet_len, TRUE);
table->field[8]->set_notnull();
table->field[9]->store((longlong) field->max_length());
table->field[9]->set_notnull();
......@@ -2568,7 +2568,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
}
if (decimals >= 0)
{
table->field[11]->store((longlong) decimals);
table->field[11]->store((longlong) decimals, TRUE);
table->field[11]->set_notnull();
}
......@@ -2624,7 +2624,7 @@ int fill_schema_charsets(THD *thd, TABLE_LIST *tables, COND *cond)
table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
comment= tmp_cs->comment ? tmp_cs->comment : "";
table->field[2]->store(comment, strlen(comment), scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen);
table->field[3]->store((longlong) tmp_cs->mbmaxlen, TRUE);
if (schema_table_store_record(thd, table))
return 1;
}
......@@ -2659,12 +2659,12 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
restore_record(table, s->default_values);
table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
table->field[2]->store((longlong) tmp_cl->number);
table->field[2]->store((longlong) tmp_cl->number, TRUE);
tmp_buff= (tmp_cl->state & MY_CS_PRIMARY) ? "Yes" : "";
table->field[3]->store(tmp_buff, strlen(tmp_buff), scs);
tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
table->field[5]->store((longlong) tmp_cl->strxfrm_multiply);
table->field[5]->store((longlong) tmp_cl->strxfrm_multiply, TRUE);
if (schema_table_store_record(thd, table))
return 1;
}
......@@ -2865,10 +2865,10 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
table->field[1]->store(base_name, strlen(base_name), cs);
table->field[2]->store(file_name, strlen(file_name), cs);
table->field[3]->store((longlong) ((key_info->flags &
HA_NOSAME) ? 0 :1));
HA_NOSAME) ? 0 : 1), TRUE);
table->field[4]->store(base_name, strlen(base_name), cs);
table->field[5]->store(key_info->name, strlen(key_info->name), cs);
table->field[6]->store((longlong) (j+1));
table->field[6]->store((longlong) (j+1), TRUE);
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
table->field[7]->store(str, strlen(str), cs);
......@@ -2884,7 +2884,7 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
{
ha_rows records=(show_table->file->records /
key->rec_per_key[j]);
table->field[9]->store((longlong) records);
table->field[9]->store((longlong) records, TRUE);
table->field[9]->set_notnull();
}
if (!(key_info->flags & HA_FULLTEXT) &&
......@@ -3123,7 +3123,7 @@ void store_key_column_usage(TABLE *table, const char*db, const char *tname,
table->field[4]->store(db, strlen(db), cs);
table->field[5]->store(tname, strlen(tname), cs);
table->field[6]->store(con_type, con_len, cs);
table->field[7]->store((longlong) idx);
table->field[7]->store((longlong) idx, TRUE);
}
......@@ -3195,7 +3195,7 @@ static int get_schema_key_column_usage_record(THD *thd,
f_key_info->forein_id->length,
f_info->str, f_info->length,
(longlong) f_idx);
table->field[8]->store((longlong) f_idx);
table->field[8]->store((longlong) f_idx, TRUE);
table->field[8]->set_notnull();
table->field[9]->store(f_key_info->referenced_db->str,
f_key_info->referenced_db->length,
......@@ -3233,8 +3233,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
restore_record(table, s->default_values);
table->field[0]->store(open_list->db, strlen(open_list->db), cs);
table->field[1]->store(open_list->table, strlen(open_list->table), cs);
table->field[2]->store((longlong) open_list->in_use);
table->field[3]->store((longlong) open_list->locked);
table->field[2]->store((longlong) open_list->in_use, TRUE);
table->field[3]->store((longlong) open_list->locked, TRUE);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
}
......
......@@ -1712,6 +1712,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
DBUG_ENTER("create_table_from_items");
tmp_table.alias= 0;
tmp_table.timestamp_field= 0;
tmp_table.s= &tmp_table.share_not_to_be_used;
tmp_table.s->db_create_options=0;
tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
......
......@@ -472,10 +472,10 @@ int mysql_create_function(THD *thd,udf_func *udf)
restore_record(table, s->default_values); // Default values for fields
table->field[0]->store(u_d->name.str, u_d->name.length, system_charset_info);
table->field[1]->store((longlong) u_d->returns);
table->field[1]->store((longlong) u_d->returns, TRUE);
table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl), system_charset_info);
if (table->s->fields >= 4) // If not old func format
table->field[3]->store((longlong) u_d->type);
table->field[3]->store((longlong) u_d->type, TRUE);
error = table->file->write_row(table->record[0]);
close_thread_tables(thd);
......
......@@ -1826,7 +1826,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
table= tz_tables->table;
tz_tables= tz_tables->next_local;
table->field[0]->store((longlong)tzid);
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0);
if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
......@@ -1853,7 +1853,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
table= tz_tables->table;
tz_tables= tz_tables->next_local;
table->field[0]->store((longlong)tzid);
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0);
// FIXME Is there any better approach than explicitly specifying 4 ???
......@@ -1925,7 +1925,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
in ascending order by index scan also satisfies us.
*/
table= tz_tables->table;
table->field[0]->store((longlong)tzid);
table->field[0]->store((longlong) tzid, TRUE);
(void)table->file->ha_index_init(0);
// FIXME Is there any better approach than explicitly specifying 4 ???
......
......@@ -754,7 +754,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
(field->flags & NOT_NULL_FLAG))
{
regfield->set_notnull();
regfield->store((longlong) 1);
regfield->store((longlong) 1, TRUE);
}
else if (type == Field::YES) // Old unireg type
regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)),system_charset_info);
......
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