Commit 56614e1d authored by unknown's avatar unknown

Don't use ranges on HEAP tables with LIKE

Don't reconnect client on close


libmysql/libmysql.c:
  Don't reconnect on close
mysql-test/r/heap.result:
  Fixed heap table test
sql/field.cc:
  Backed out wrong HEAP table bug fix
sql/ha_heap.h:
  cleanup
sql/mini_client.cc:
  Don't reconnect on close
sql/opt_range.cc:
  Don't use ranges on HEAP tables with LIKE
parent 24771fdd
......@@ -1657,6 +1657,7 @@ mysql_close(MYSQL *mysql)
{
free_old_query(mysql);
mysql->status=MYSQL_STATUS_READY; /* Force command */
mysql->reconnect=0;
simple_command(mysql,COM_QUIT,NullS,0,1);
end_server(mysql);
}
......
......@@ -79,7 +79,7 @@ f1 f2
12 ted
12 ted
table type possible_keys key key_len ref rows Extra
t1 range btn btn 10 NULL 10 where used
t1 ALL btn NULL NULL NULL 14 where used
btn
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
......
......@@ -363,7 +363,7 @@ void Field::store_time(TIME *ltime,timestamp_type type)
bool Field::optimize_range()
{
return test(table->file->option_flag() & HA_ONLY_WHOLE_INDEX);
return test(table->file->option_flag() & HA_READ_NEXT);
}
/****************************************************************************
......
......@@ -78,10 +78,3 @@ class ha_heap: public handler
enum thr_lock_type lock_type);
};
......@@ -384,12 +384,16 @@ my_bool STDCALL mc_mysql_reconnect(MYSQL *mysql)
MYSQL tmp_mysql;
DBUG_ENTER("mc_mysql_reconnect");
if (!mysql->reconnect)
DBUG_RETURN(1);
mc_mysql_init(&tmp_mysql);
tmp_mysql.options=mysql->options;
if (!mc_mysql_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,
mysql->db, mysql->port, mysql->unix_socket,
mysql->client_flag))
{
tmp_mysql.reconnect=0;
mc_mysql_close(&tmp_mysql);
DBUG_RETURN(1);
}
......@@ -793,6 +797,7 @@ mc_mysql_close(MYSQL *mysql)
{
mc_free_old_query(mysql);
mysql->status=MYSQL_STATUS_READY; /* Force command */
mysql->reconnect=0;
mc_simple_command(mysql,COM_QUIT,NullS,0,1);
mc_end_server(mysql);
}
......
......@@ -919,6 +919,9 @@ get_mm_leaf(Field *field,KEY_PART *key_part,
if (type == Item_func::LIKE_FUNC)
{
if (!field->optimize_range())
DBUG_RETURN(0); // Can't optimize this
bool like_error;
char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
String tmp(buff1,sizeof(buff1)),*res;
......@@ -971,7 +974,8 @@ get_mm_leaf(Field *field,KEY_PART *key_part,
max_str+maybe_null,&min_length,&max_length);
else
#endif
like_error=like_range(res->ptr(),res->length(),wild_prefix,field_length,
like_error=like_range(res->ptr(),res->length(),wild_prefix,
field_length,
min_str+offset,max_str+offset,
max_sort_char,&min_length,&max_length);
}
......
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