Commit 760bd9d1 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into  bodhi.local:/opt/local/work/mysql-4.1-runtime


libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
parents 0fb76499 a7aecabc
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -2496,6 +2496,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
  NET	*net= &mysql->net;
  char buff[4 /* size of stmt id */ +
            5 /* execution flags */];
  my_bool res;

  DBUG_ENTER("execute");
  DBUG_PRINT("enter",("packet: %s, length :%d",packet ? packet :" ", length));

@@ -2503,15 +2505,17 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
  int4store(buff, stmt->stmt_id);		/* Send stmt id to server */
  buff[4]= (char) 0;                            /* no flags */
  int4store(buff+5, 1);                         /* iteration count */
  if (cli_advanced_command(mysql, COM_EXECUTE, buff, sizeof(buff),

  res= test(cli_advanced_command(mysql, COM_EXECUTE, buff, sizeof(buff),
                                 packet, length, 1, NULL) ||
      (*mysql->methods->read_query_result)(mysql))
            (*mysql->methods->read_query_result)(mysql));
  stmt->affected_rows= mysql->affected_rows;
  stmt->insert_id= mysql->insert_id;
  if (res)
  {
    set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
    DBUG_RETURN(1);
  }
  stmt->affected_rows= mysql->affected_rows;
  stmt->insert_id= mysql->insert_id;
  DBUG_RETURN(0);
}

+9 −5
Original line number Diff line number Diff line
@@ -224,20 +224,24 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
{
  DBUG_ENTER("emb_stmt_execute");
  char header[4];
  my_bool res;

  int4store(header, stmt->stmt_id);
  THD *thd= (THD*)stmt->mysql->thd;
  thd->client_param_count= stmt->param_count;
  thd->client_params= stmt->params;
  if (emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,

  res= test(emb_advanced_command(stmt->mysql, COM_EXECUTE,0,0,
                                 header, sizeof(header), 1, stmt) ||
      emb_mysql_read_query_result(stmt->mysql))
            emb_mysql_read_query_result(stmt->mysql));
  stmt->affected_rows= stmt->mysql->affected_rows;
  stmt->insert_id= stmt->mysql->insert_id;
  if (res)
  {
    NET *net= &stmt->mysql->net;
    set_stmt_errmsg(stmt, net->last_error, net->last_errno, net->sqlstate);
    DBUG_RETURN(1);
  }
  stmt->affected_rows= stmt->mysql->affected_rows;
  stmt->insert_id= stmt->mysql->insert_id;
  DBUG_RETURN(0);
}

+8 −0
Original line number Diff line number Diff line
@@ -202,3 +202,11 @@ select count(*) from t1 where id not in (1,2);
count(*)
1
drop table t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 SELECT 1 IN (2, NULL);
SELECT should return NULL.
SELECT * FROM t1;
1 IN (2, NULL)
NULL
DROP TABLE t1;
End of 4.1 tests
+52 −49
Original line number Diff line number Diff line
@@ -775,12 +775,12 @@ set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
show variables like 'max_prepared_stmt_count';
Variable_name	Value
max_prepared_stmt_count	16382
show variables like 'prepared_stmt_count';
show status like 'prepared_stmt_count';
Variable_name	Value
prepared_stmt_count	0
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
16382	0
Prepared_stmt_count	0
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
16382
set global max_prepared_stmt_count=-1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
@@ -799,67 +799,70 @@ set max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local max_prepared_stmt_count=1;
ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set local prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set @@prepared_stmt_count=0;
ERROR HY000: Variable 'prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL
set global prepared_stmt_count=1;
ERROR 42000: Incorrect argument type to variable 'prepared_stmt_count'
set global max_prepared_stmt_count=1;
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
set global max_prepared_stmt_count=0;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
0	0
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
0
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
set global max_prepared_stmt_count=1;
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	1
prepare stmt1 from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
1
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	1
deallocate prepare stmt;
select @@prepared_stmt_count;
@@prepared_stmt_count
0
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
prepare stmt from "select 1";
select @@prepared_stmt_count;
@@prepared_stmt_count
1
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	1
prepare stmt from "select 2";
select @@prepared_stmt_count;
@@prepared_stmt_count
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	1
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	1
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
1
select @@prepared_stmt_count, @@max_prepared_stmt_count;
@@prepared_stmt_count	@@max_prepared_stmt_count
1	1
set global max_prepared_stmt_count=0;
prepare stmt from "select 1";
ERROR HY000: Unknown error
execute stmt;
ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE
select @@prepared_stmt_count;
@@prepared_stmt_count
0
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
prepare stmt from "select 1";
ERROR HY000: Unknown error
select @@prepared_stmt_count;
@@prepared_stmt_count
0
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
set global max_prepared_stmt_count=3;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	0
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
3
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	0
prepare stmt from "select 1";
prepare stmt from "select 2";
prepare stmt1 from "select 3";
@@ -867,13 +870,13 @@ prepare stmt2 from "select 4";
ERROR HY000: Unknown error
prepare stmt2 from "select 4";
ERROR HY000: Unknown error
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	3
select @@max_prepared_stmt_count;
@@max_prepared_stmt_count
3
show status like 'prepared_stmt_count';
Variable_name	Value
Prepared_stmt_count	3
deallocate prepare stmt;
select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count	@@prepared_stmt_count
3	0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
drop table if exists t1;
create temporary table if not exists t1 (a1 int);
+21 −1
Original line number Diff line number Diff line
@@ -109,4 +109,24 @@ select count(*) from t1 where id not in (1);
select count(*) from t1 where id not in (1,2);
drop table t1;

# End of 4.1 tests

#
# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
# result
#
# The problem was in the IN() function that ignored maybe_null flags
# of all arguments except the first (the one _before_ the IN
# keyword, '1' in the test case below).
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 SELECT 1 IN (2, NULL);
--echo SELECT should return NULL.
SELECT * FROM t1;

DROP TABLE t1;


--echo End of 4.1 tests
Loading