summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc18
-rw-r--r--sql/item_cmpfunc.h5
-rw-r--r--sql/mysqld.cc20
-rw-r--r--sql/sql_parse.cc4
4 files changed, 34 insertions, 13 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 0dc1e91d372..0e7d38ecda8 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1073,6 +1073,18 @@ void Item_func_in::update_used_tables()
const_item_cache&=item->const_item();
}
+void Item_func_in::split_sum_func(List<Item> &fields)
+{
+ if (item->with_sum_func && item->type() != SUM_FUNC_ITEM)
+ item->split_sum_func(fields);
+ else if (item->used_tables() || item->type() == SUM_FUNC_ITEM)
+ {
+ fields.push_front(item);
+ item=new Item_ref((Item**) fields.head_ref(),0,item->name);
+ }
+ Item_func::split_sum_func(fields);
+}
+
longlong Item_func_bit_or::val_int()
{
@@ -1289,15 +1301,15 @@ longlong Item_cond_or::val_int()
Item *and_expressions(Item *a, Item *b, Item **org_item)
{
if (!a)
- return (*org_item= b);
+ return (*org_item= (Item*) b);
if (a == *org_item)
{
Item_cond *res;
- if ((res= new Item_cond_and(a, b)))
+ if ((res= new Item_cond_and(a, (Item*) b)))
res->used_tables_cache= a->used_tables() | b->used_tables();
return res;
}
- if (((Item_cond_and*) a)->add(b))
+ if (((Item_cond_and*) a)->add((Item*) b))
return 0;
((Item_cond_and*) a)->used_tables_cache|= b->used_tables();
return a;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index e163bc40a6e..d9068e0e024 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -425,7 +425,9 @@ class Item_func_in :public Item_int_func
longlong val_int();
bool fix_fields(THD *thd,struct st_table_list *tlist)
{
- return (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist));
+ bool res= (item->fix_fields(thd,tlist) || Item_func::fix_fields(thd,tlist));
+ with_sum_func= with_sum_func || item->with_sum_func;
+ return res;
}
void fix_length_and_dec();
~Item_func_in() { delete item; delete array; delete in_item; }
@@ -436,6 +438,7 @@ class Item_func_in :public Item_int_func
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
void update_used_tables();
+ void split_sum_func(List<Item> &fields);
unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e8132ae7f81..a65cbd1139d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -433,7 +433,7 @@ pthread_attr_t connection_attrib;
#include <process.h>
#if !defined(EMBEDDED_LIBRARY)
HANDLE hEventShutdown;
-static char *event_name;
+static char shutdown_event_name[40];
#include "nt_servc.h"
static NTService Service; // Service object for WinNT
#endif
@@ -998,6 +998,7 @@ static void set_root(const char *path)
sql_perror("chroot");
unireg_abort(1);
}
+ my_setwd("/", MYF(0));
#endif
}
@@ -2316,6 +2317,14 @@ bool default_service_handling(char **argv,
int main(int argc, char **argv)
{
+
+ /* When several instances are running on the same machine, we
+ need to have an unique named hEventShudown through the
+ application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
+ */
+ int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
+ "MySQLShutdown"), 10);
+
if (Service.GetOS()) /* true NT family */
{
char file_path[FN_REFLEN];
@@ -2330,10 +2339,9 @@ int main(int argc, char **argv)
if (Service.IsService(argv[1]))
{
/* start an optional service */
- event_name= argv[1];
- load_default_groups[0]= argv[1];
+ load_default_groups[0]= argv[1];
start_mode= 1;
- Service.Init(event_name, mysql_service);
+ Service.Init(argv[1], mysql_service);
return 0;
}
}
@@ -2352,9 +2360,8 @@ int main(int argc, char **argv)
use_opt_args=1;
opt_argc=argc;
opt_argv=argv;
- event_name= argv[2];
start_mode= 1;
- Service.Init(event_name, mysql_service);
+ Service.Init(argv[2], mysql_service);
return 0;
}
}
@@ -2374,7 +2381,6 @@ int main(int argc, char **argv)
{
/* start the default service */
start_mode= 1;
- event_name= "MySqlShutdown";
Service.Init(MYSQL_SERVICENAME, mysql_service);
return 0;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6b918d3565b..8f1e9c37eae 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -196,6 +196,8 @@ static bool 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;
if (!(thd->user = my_strdup(user, MYF(0))))
{
send_error(net,ER_OUT_OF_RESOURCES);
@@ -596,8 +598,6 @@ check_connections(THD *thd)
char *user= (char*) net->read_pos+5;
char *passwd= strend(user)+1;
char *db=0;
- if (passwd[0] && strlen(passwd) != SCRAMBLE_LENGTH)
- return ER_HANDSHAKE_ERROR;
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
db=strend(passwd)+1;
if (thd->client_capabilities & CLIENT_INTERACTIVE)