Commit 943edab9 authored by unknown's avatar unknown
Browse files

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

into  mysql.com:/home/alik/Documents/AllProgs/MySQL/devel/5.0-sp-vars-merge-2


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/sp_head.cc:
  Merge.
parents 9c8773f5 6b2f1309
Loading
Loading
Loading
Loading
+122 −0
Original line number Diff line number Diff line
delimiter |;

---------------------------------------------------------------------------

CREATE PROCEDURE sp_vars_check_dflt()
BEGIN
  DECLARE v1 TINYINT DEFAULT 1e200;
  DECLARE v1u TINYINT UNSIGNED DEFAULT 1e200;
  DECLARE v2 TINYINT DEFAULT -1e200;
  DECLARE v2u TINYINT UNSIGNED DEFAULT -1e200;
  DECLARE v3 TINYINT DEFAULT 300;
  DECLARE v3u TINYINT UNSIGNED DEFAULT 300;
  DECLARE v4 TINYINT DEFAULT -300;
  DECLARE v4u TINYINT UNSIGNED DEFAULT -300;

  DECLARE v5 TINYINT DEFAULT 10 * 10 * 10;
  DECLARE v5u TINYINT UNSIGNED DEFAULT 10 * 10 * 10;
  DECLARE v6 TINYINT DEFAULT -10 * 10 * 10;
  DECLARE v6u TINYINT UNSIGNED DEFAULT -10 * 10 * 10;

  DECLARE v7 TINYINT DEFAULT '10';
  DECLARE v8 TINYINT DEFAULT '10 ';
  DECLARE v9 TINYINT DEFAULT ' 10 ';
  DECLARE v10 TINYINT DEFAULT 'String 10 ';
  DECLARE v11 TINYINT DEFAULT 'String10';
  DECLARE v12 TINYINT DEFAULT '10 String';
  DECLARE v13 TINYINT DEFAULT '10String';
  DECLARE v14 TINYINT DEFAULT concat('10', ' ');
  DECLARE v15 TINYINT DEFAULT concat(' ', '10');
  DECLARE v16 TINYINT DEFAULT concat('Hello, ', 'world');

  DECLARE v17 DECIMAL(64, 2) DEFAULT 12;
  DECLARE v18 DECIMAL(64, 2) DEFAULT 12.123;
  DECLARE v19 DECIMAL(64, 2) DEFAULT 11 + 1;
  DECLARE v20 DECIMAL(64, 2) DEFAULT 12 + 0.123;

  SELECT v1, v1u, v2, v2u, v3, v3u, v4, v4u;
  SELECT v5, v5u, v6, v6u;
  SELECT v7, v8, v9, v10, v11, v12, v13, v14, v15, v16;
  SELECT v17, v18, v19, v20;
END|

---------------------------------------------------------------------------

CREATE PROCEDURE sp_vars_check_assignment()
BEGIN
  DECLARE i1, i2, i3, i4 TINYINT;
  DECLARE u1, u2, u3, u4 TINYINT UNSIGNED;
  DECLARE d1, d2, d3 DECIMAL(64, 2);
 
  SET i1 = 1e200;
  SET i2 = -1e200;
  SET i3 = 300;
  SET i4 = -300;
 
  SELECT i1, i2, i3, i4;

  SET i1 = 10 * 10 * 10;
  SET i2 = -10 * 10 * 10;
  SET i3 = sign(10 * 10) * 10 * 20;
  SET i4 = sign(-10 * 10) * -10 * 20;
  
  SELECT i1, i2, i3, i4;

  SET u1 = 1e200;
  SET u2 = -1e200;
  SET u3 = 300;
  SET u4 = -300;
 
  SELECT u1, u2, u3, u4;

  SET u1 = 10 * 10 * 10;
  SET u2 = -10 * 10 * 10;
  SET u3 = sign(10 * 10) * 10 * 20;
  SET u4 = sign(-10 * 10) * -10 * 20;
  
  SELECT u1, u2, u3, u4;

  SET d1 = 1234;
  SET d2 = 1234.12;
  SET d3 = 1234.1234;

  SELECT d1, d2, d3;

  SET d1 = 12 * 100 + 34;
  SET d2 = 12 * 100 + 34 + 0.12;
  SET d3 = 12 * 100 + 34 + 0.1234;

  SELECT d1, d2, d3;
END|

---------------------------------------------------------------------------

CREATE FUNCTION sp_vars_check_ret1() RETURNS TINYINT
BEGIN
  RETURN 1e200;
END|

---------------------------------------------------------------------------

CREATE FUNCTION sp_vars_check_ret2() RETURNS TINYINT
BEGIN
  RETURN 10 * 10 * 10;
END|

---------------------------------------------------------------------------

CREATE FUNCTION sp_vars_check_ret3() RETURNS TINYINT
BEGIN
  RETURN 'Hello, world';
END|

---------------------------------------------------------------------------

CREATE FUNCTION sp_vars_check_ret4() RETURNS DECIMAL(64, 2)
BEGIN
  RETURN 12 * 10 + 34 + 0.1234;
END|

---------------------------------------------------------------------------

delimiter ;|
+1 −1
Original line number Diff line number Diff line
@@ -2317,7 +2317,7 @@ CREATE TABLE t2(c2 char(2)) default charset = ujis;
INSERT INTO t1 VALUES(_ujis 0xA4A2);
CREATE PROCEDURE sp1()
BEGIN
DECLARE a CHAR(1);
DECLARE a CHAR(2) CHARSET ujis;
DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
OPEN cur1;
FETCH cur1 INTO a;
+1 −0
Original line number Diff line number Diff line
drop database if exists mysqltest1;
create schema foo;
show create schema foo;
Database	Create Database
+1 −0
Original line number Diff line number Diff line
drop table if exists t1,t2;
drop table if exists t1aa,t2aa;
drop database if exists mysqltest;
drop database if exists mysqltest1;
delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
+2 −2
Original line number Diff line number Diff line
@@ -10,5 +10,5 @@ user()
#
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	#	test	Sleep	#		NULL
#	root	#	test	Query	#	NULL	show processlist
<id>	root	<host>	test	<command>	<time>	<state>	<info>
<id>	root	<host>	test	<command>	<time>	<state>	<info>
Loading