summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-04-17 03:55:25 +0300
committerunknown <monty@donna.mysql.fi>2001-04-17 03:55:25 +0300
commit56614e1d19f36846a27501fb29282e70b248e06e (patch)
tree6b83fb56810a9e22b736552033a21cba8af2886c
parent24771fddf7be59dd621f6ffe91263bf634cfcf1f (diff)
downloadmariadb-git-56614e1d19f36846a27501fb29282e70b248e06e.tar.gz
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
-rw-r--r--libmysql/libmysql.c1
-rw-r--r--mysql-test/r/heap.result2
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_heap.h7
-rw-r--r--sql/mini_client.cc5
-rw-r--r--sql/opt_range.cc6
6 files changed, 13 insertions, 10 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index af779a73623..55234fcfe13 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -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);
}
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index bf4c468c802..d3d16128ebd 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -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
diff --git a/sql/field.cc b/sql/field.cc
index 8d998683bd7..1f1f00b161b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -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);
}
/****************************************************************************
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index d88c28097af..1a6e8d9393c 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -78,10 +78,3 @@ class ha_heap: public handler
enum thr_lock_type lock_type);
};
-
-
-
-
-
-
-
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 26bef7194df..fa1b9da38a8 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -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);
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index eedae87719d..5354803e6ab 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -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);
}