summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2005-12-09 15:14:19 +0300
committerunknown <anozdrin@mysql.com>2005-12-09 15:14:19 +0300
commit16bca982675eae7334e3629ad5b0c786d384a272 (patch)
treee8d8d0e4221b70994cc2102da16ba5febf0e3f48 /mysql-test/include
parent2309be62e54ac54877645e0c264797646a379b32 (diff)
parent06e996639664f2f5270793047b47830fd85edbd7 (diff)
downloadmariadb-git-16bca982675eae7334e3629ad5b0c786d384a272.tar.gz
Merge mysql.com:/home/alik/MySQL/devel/5.0-wl2984
into mysql.com:/home/alik/MySQL/devel/5.1-wl2984-merge mysql-test/r/show_check.result: Auto merged mysql-test/r/sp.result: Auto merged BitKeeper/deleted/.del-type_newdecimal-big.result: Auto merged BitKeeper/deleted/.del-type_newdecimal-big.test: Auto merged mysql-test/t/show_check.test: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sp.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_trigger.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/field.cc: Merge. sql/sp_head.cc: Merge. sql/sql_select.cc: Merge.
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/sp-vars.inc122
1 files changed, 122 insertions, 0 deletions
diff --git a/mysql-test/include/sp-vars.inc b/mysql-test/include/sp-vars.inc
new file mode 100644
index 00000000000..3e02c9d1709
--- /dev/null
+++ b/mysql-test/include/sp-vars.inc
@@ -0,0 +1,122 @@
+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 ;|