summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/Makefile.am2
-rw-r--r--sql/field.cc8
-rw-r--r--sql/gen_lex_hash.cc2
-rw-r--r--sql/ha_heap.h7
-rw-r--r--sql/mini_client.cc5
-rw-r--r--sql/opt_range.cc5
6 files changed, 16 insertions, 13 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 89399647727..596a1d3acf7 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -42,7 +42,7 @@ LDADD = ../isam/libnisam.a \
../strings/libmystrings.a
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @gemini_libs@ \
- $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS)
+ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@
noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_strfunc.h item_timefunc.h item_uniq.h \
item_create.h mysql_priv.h \
diff --git a/sql/field.cc b/sql/field.cc
index f7dbd3c72f0..1f1f00b161b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1791,7 +1791,8 @@ String *Field_float::val_str(String *val_buffer,
#endif
memcpy_fixed((byte*) &nr,ptr,sizeof(nr));
- val_buffer->alloc(max(field_length,70));
+ uint to_length=max(field_length,70);
+ val_buffer->alloc(to_length);
char *to=(char*) val_buffer->ptr();
if (dec >= NOT_FIXED_DEC)
@@ -1841,8 +1842,9 @@ String *Field_float::val_str(String *val_buffer,
while (tmp_dec--)
*to++= *pos++;
#else
-#ifdef HAVE_SNPRINTF_
- sprintf(to,val_buffer->length(),"%.*f",dec,nr);
+#ifdef HAVE_SNPRINTF
+ to[to_length-1]=0; // Safety
+ snprintf(to,to_length-1,"%.*f",dec,nr);
#else
sprintf(to,"%.*f",dec,nr);
#endif
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index b2925680dd5..4a923e039c4 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
- start_value=6591595L; best_t1=6947666L; best_t2=6561864L; best_type=2; /* mode=4523 add=5 type: 0 */
+ start_value=2663113L; best_t1=1175350L; best_t2=7404531L; best_type=4; /* mode=4327 add=3 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
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..98be3639a06 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -924,6 +924,8 @@ get_mm_leaf(Field *field,KEY_PART *key_part,
String tmp(buff1,sizeof(buff1)),*res;
uint length,offset,min_length,max_length;
+ if (!field->optimize_range())
+ DBUG_RETURN(0); // Can't optimize this
if (!(res= value->val_str(&tmp)))
DBUG_RETURN(&null_element);
@@ -971,7 +973,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);
}