Commit 40efb362 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/opt/local/work/mysql-4.1-root

into  mysql.com:/media/sda1/mysql/mysql-5.0-merge


mysql-test/r/select.result:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/ps.result:
  Manual merge (again).
mysql-test/t/ps.test:
  Manual merge (again).
mysql-test/t/select.test:
  Manual merge (again).
sql/item_func.cc:
  Manual merge (again).
sql/item_func.h:
  Manual merge (again).
sql/set_var.h:
  Manual merge (again).
parents 0789b177 d5b80a78
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -775,3 +775,28 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
select ? from t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? from t1' at line 1
drop table t1;
prepare stmt from "select @@time_zone";
execute stmt;
@@time_zone
SYSTEM
set @@time_zone:='Japan';
execute stmt;
@@time_zone
Japan
prepare stmt from "select @@tx_isolation";
execute stmt;
@@tx_isolation
REPEATABLE-READ
set transaction isolation level read committed;
execute stmt;
@@tx_isolation
READ-COMMITTED
set transaction isolation level serializable;
execute stmt;
@@tx_isolation
SERIALIZABLE
set @@tx_isolation=default;
execute stmt;
@@tx_isolation
REPEATABLE-READ
deallocate prepare stmt;
+11 −0
Original line number Diff line number Diff line
@@ -2746,3 +2746,14 @@ WHERE
COUNT(*)
4
drop table t1,t2,t3;
create table t1 (f1 int);
insert into t1 values (1),(NULL);
create table t2 (f2 int, f3 int, f4 int);
create index idx1 on t2 (f4);
insert into t2 values (1,2,3),(2,4,6);
select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
from  t2 C where A.f4 = C.f4) or A.f3 IS NULL;
f2
1
NULL
drop table t1,t2;
+17 −0
Original line number Diff line number Diff line
@@ -811,3 +811,20 @@ select ??;
select ? from t1;
--enable_ps_protocol
drop table t1;
#
# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
# time"
#
prepare stmt from "select @@time_zone";
execute stmt;
set @@time_zone:='Japan';
execute stmt;
prepare stmt from "select @@tx_isolation";
execute stmt;
set transaction isolation level read committed;
execute stmt;
set transaction isolation level serializable;
execute stmt;
set @@tx_isolation=default;
execute stmt;
deallocate prepare stmt;
+11 −0
Original line number Diff line number Diff line
@@ -2330,3 +2330,14 @@ WHERE

drop table t1,t2,t3;

#
# Bug #11482 4.1.12 produces different resultset for a complex query 
#             than in previous 4.1.x
create table t1 (f1 int);
insert into t1 values (1),(NULL);
create table t2 (f2 int, f3 int, f4 int);
create index idx1 on t2 (f4);
insert into t2 values (1,2,3),(2,4,6);
select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
from  t2 C where A.f4 = C.f4) or A.f3 IS NULL; 
drop table t1,t2;
+38 −30
Original line number Diff line number Diff line
@@ -4217,6 +4217,36 @@ void Item_user_var_as_out_param::print(String *str)
}


Item_func_get_system_var::
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
                       LEX_STRING *component_arg, const char *name_arg,
                       size_t name_len_arg)
  :var(var_arg), var_type(var_type_arg), component(*component_arg)
{
  /* set_name() will allocate the name */
  set_name(name_arg, name_len_arg, system_charset_info);
}


bool
Item_func_get_system_var::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
  Item *item= var->item(thd, var_type, &component);
  DBUG_ENTER("Item_func_get_system_var::fix_fields");
  /*
    Evaluate the system variable and substitute the result (a basic constant)
    instead of this item. If the variable can not be evaluated,
    the error is reported in sys_var::item().
  */
  if (item == 0)
    DBUG_RETURN(1);                             // Impossible
  item->set_name(name, 0, system_charset_info); // don't allocate a new name
  thd->change_item_tree(ref, item);

  DBUG_RETURN(0);
}


longlong Item_func_inet_aton::val_int()
{
  DBUG_ASSERT(fixed == 1);
@@ -4568,17 +4598,16 @@ longlong Item_func_bit_xor::val_int()
Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
		     LEX_STRING component)
{
  sys_var *var;
  char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos;
  LEX_STRING *base_name, *component_name;

  if (component.str == 0 &&
      !my_strcasecmp(system_charset_info, name.str, "VERSION"))
    return new Item_string("@@VERSION", server_version,
			   (uint) strlen(server_version),
			   system_charset_info, DERIVATION_SYSCONST);

  Item *item;
  sys_var *var;
  char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos;
  LEX_STRING *base_name, *component_name;

  if (component.str)
  {
    base_name= &component;
@@ -4600,9 +4629,8 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
      return 0;
    }
  }
  if (!(item=var->item(thd, var_type, component_name)))
    return 0;					// Impossible
  thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);

  buff[0]='@';
  buff[1]='@';
  pos=buff+2;
@@ -4623,28 +4651,8 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
  memcpy(pos, base_name->str, base_name->length);
  pos+= base_name->length;

  // set_name() will allocate the name
  item->set_name(buff,(uint) (pos-buff), system_charset_info);
  return item;
}


Item *get_system_var(THD *thd, enum_var_type var_type, const char *var_name,
		     uint length, const char *item_name)
{
  Item *item;
  sys_var *var;
  LEX_STRING null_lex_string;

  null_lex_string.str= 0;

  var= find_sys_var(var_name, length);
  DBUG_ASSERT(var != 0);
  if (!(item=var->item(thd, var_type, &null_lex_string)))
    return 0;						// Impossible
  thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
  item->set_name(item_name, 0, system_charset_info);  // Will use original name
  return item;
  return new Item_func_get_system_var(var, var_type, component_name,
                                      buff, pos - buff);
}


Loading