Commit 86d94d2e authored by unknown's avatar unknown

Merge sinisa@work.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/work/mysql-4.1


sql/sql_analyse.cc:
  Auto merged
parents d3551b82 8ffb500c
......@@ -17,6 +17,9 @@ AC_MSG_CHECKING(if building in the top-level directory)
Berkeley DB cannot be built in the top-level distribution directory.])
AC_MSG_RESULT(no)
# Minimum autoconf version required.
AC_PREREQ(2.53)
# Substitution variables.
AC_SUBST(ADDITIONAL_INCS)
AC_SUBST(ADDITIONAL_LANG)
......
......@@ -98,3 +98,4 @@ commit;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
drop table if exists t1, t2, t3;
......@@ -47,4 +47,5 @@ select * from t3;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
commit;
show status like "Qcache_queries_in_cache";
\ No newline at end of file
show status like "Qcache_queries_in_cache";
drop table if exists t1, t2, t3;
......@@ -17,7 +17,9 @@ libreadline_a_SOURCES = readline.c funmap.c keymaps.c \
histfile.c nls.c search.c \
shell.c tilde.c misc.c text.c mbutil.c
pkginclude_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
pkginclude_HEADERS = readline.h chardefs.h keymaps.h \
history.h tilde.h rlmbutil.h rltypedefs.h rlprivate.h \
rlshell.h xmalloc.h
noinst_HEADERS = rldefs.h histlib.h rlwinsize.h \
posixstat.h posixdir.h posixjmp.h \
......
This diff is collapsed.
......@@ -798,10 +798,8 @@ int Field_decimal::store(longlong nr)
double Field_decimal::val_real(void)
{
char temp= *(ptr+field_length); *(ptr+field_length) = '\0';
double nr=atod(ptr);
*(ptr+field_length)=temp;
return(nr);
CHARSET_INFO *cs=charset();
return my_strntod(cs,ptr,field_length,NULL);
}
longlong Field_decimal::val_int(void)
......
......@@ -382,7 +382,7 @@ double Item_param::val()
{
switch (item_result_type) {
case STRING_RESULT:
return (double)atof(str_value.ptr());
return (double)my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)0);
case INT_RESULT:
return (double)int_value;
default:
......
......@@ -689,12 +689,22 @@ my_bool check_scramble(const char *scrambled, const char *message,
{
struct rand_struct rand_st;
ulong hash_message[2];
char buff[16],*to,extra; /* Big enough for check */
char buff[16],*to,extra; /* Big enough for check */
const char *pos;
char message_buffer[9]; /* Copy of message */
memcpy(message_buffer,message,8); /* Old auth uses 8 bytes at maximum */
message_buffer[8]=0;
char message_buffer[SCRAMBLE_LENGTH+1]; /* Copy of message */
/* We need to copy the message as this function can be called for MySQL 4.1
scramble which is not zero ended and can have zeroes inside
We could just write zero to proper place in original message but
this would make it harder to understand code for next generations
*/
memcpy(message_buffer,message,SCRAMBLE_LENGTH); /* Ignore the rest */
message_buffer[SCRAMBLE_LENGTH]=0;
/* Check if this exactly N bytes. Overwise this is something fishy */
if (strlen(message_buffer)!=SCRAMBLE_LENGTH)
return 1; /* Wrong password */
hash_password(hash_message,message_buffer);
if (old_ver)
......
......@@ -35,10 +35,10 @@ class Item_proc :public Item
}
enum Type type() const { return Item::PROC_ITEM; }
virtual void set(double nr)=0;
virtual void set(const char *str,uint length)=0;
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
virtual void set(longlong nr)=0;
virtual enum_field_types field_type() const=0;
void set(const char *str) { set(str,(uint) strlen(str)); }
void set(const char *str) { set(str,(uint) strlen(str), thd_charset()); }
void make_field(Send_field *tmp_field)
{
init_make_field(tmp_field,field_type());
......@@ -58,8 +58,8 @@ class Item_proc_real :public Item_proc
enum_field_types field_type() const { return FIELD_TYPE_DOUBLE; }
void set(double nr) { value=nr; }
void set(longlong nr) { value=(double) nr; }
void set(const char *str,uint length __attribute__((unused)))
{ value=atof(str); }
void set(const char *str,uint length,CHARSET_INFO *cs)
{ value=my_strntod(cs,str,length,(char**)0); }
double val() { return value; }
longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals,thd_charset()); return s; }
......@@ -76,8 +76,8 @@ class Item_proc_int :public Item_proc
enum_field_types field_type() const { return FIELD_TYPE_LONG; }
void set(double nr) { value=(longlong) nr; }
void set(longlong nr) { value=nr; }
void set(const char *str,uint length __attribute__((unused)))
{ value=strtoll(str,NULL,10); }
void set(const char *str,uint length, CHARSET_INFO *cs)
{ value=my_strntoll(cs,str,length,NULL,10); }
double val() { return (double) value; }
longlong val_int() { return value; }
String *val_str(String *s) { s->set(value, thd_charset()); return s; }
......@@ -94,9 +94,18 @@ class Item_proc_string :public Item_proc
enum_field_types field_type() const { return FIELD_TYPE_STRING; }
void set(double nr) { str_value.set(nr, 2, thd_charset()); }
void set(longlong nr) { str_value.set(nr, thd_charset()); }
void set(const char *str, uint length) { str_value.copy(str,length, thd_charset()); }
double val() { return atof(str_value.ptr()); }
longlong val_int() { return strtoll(str_value.ptr(),NULL,10); }
void set(const char *str, uint length, CHARSET_INFO *cs)
{ str_value.copy(str,length,cs); }
double val()
{
CHARSET_INFO *cs=str_value.charset();
return my_strntod(cs, str_value.ptr(), str_value.length(),(char**)0);
}
longlong val_int()
{
CHARSET_INFO *cs=str_value.charset();
return my_strntoll(cs,str_value.ptr(),str_value.length(),NULL,10);
}
String *val_str(String*)
{
return null_value ? (String*) 0 : (String*) &str_value;
......
......@@ -593,23 +593,23 @@ bool analyse::end_of_records()
{
func_items[1]->null_value = 0;
res = (*f)->get_min_arg(&s_min);
func_items[1]->set(res->ptr(), res->length());
func_items[1]->set(res->ptr(), res->length(), res->charset());
func_items[2]->null_value = 0;
res = (*f)->get_max_arg(&s_max);
func_items[2]->set(res->ptr(), res->length());
func_items[2]->set(res->ptr(), res->length(), res->charset());
}
func_items[3]->set((longlong) (*f)->min_length);
func_items[4]->set((longlong) (*f)->max_length);
func_items[5]->set((longlong) (*f)->empty);
func_items[6]->set((longlong) (*f)->nulls);
res = (*f)->avg(&s_max, rows);
func_items[7]->set(res->ptr(), res->length());
func_items[7]->set(res->ptr(), res->length(), res->charset());
func_items[8]->null_value = 0;
res = (*f)->std(&s_max, rows);
if (!res)
func_items[8]->null_value = 1;
else
func_items[8]->set(res->ptr(), res->length());
func_items[8]->set(res->ptr(), res->length(), res->charset());
// count the dots, quotas, etc. in (ENUM("a","b","c"...))
// if tree has been removed, don't suggest ENUM.
// treemem is used to measure the size of tree for strings,
......@@ -640,7 +640,7 @@ bool analyse::end_of_records()
if (!(*f)->nulls)
tmp_str.append(" NOT NULL");
output_str_length = tmp_str.length();
func_items[9]->set(tmp_str.ptr(), tmp_str.length());
func_items[9]->set(tmp_str.ptr(), tmp_str.length(), tmp_str.charset());
if (result->send_data(result_fields))
return -1;
continue;
......@@ -687,7 +687,7 @@ bool analyse::end_of_records()
}
if (!(*f)->nulls)
ans.append(" NOT NULL");
func_items[9]->set(ans.ptr(), ans.length());
func_items[9]->set(ans.ptr(), ans.length(), ans.charset());
if (result->send_data(result_fields))
return -1;
}
......
......@@ -195,8 +195,6 @@ static int check_user(THD *thd,enum_server_command command, const char *user,
thd->db_length=0;
USER_RESOURCES ur;
if (passwd[0] && strlen(passwd) != SCRAMBLE_LENGTH)
return 1;
/* We shall avoid dupplicate user allocations here */
if (!thd->user && !(thd->user = my_strdup(user, MYF(0))))
{
......
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