logo       

bk commit into 5.0 tree (1.1548): msg#00378

db.mysql.devel

Subject: bk commit into 5.0 tree (1.1548)

Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
1.1548 03/04/27 17:35:54 pem@xxxxxxxxx +10 -0
Post-fix of bug #302 fix.
Fixed bug #320.
Some new tests and cosmetic changes.
Another strcasecmp() replaced.

sql/sql_yacc.yy
1.228 03/04/27 17:35:51 pem@xxxxxxxxx +2 -1
Another strcasecmp() replaced.

sql/sql_parse.cc
1.286 03/04/27 17:35:51 pem@xxxxxxxxx +5 -1
Post-fix of bugfix (free memory on error), and added comment.

sql/sql_derived.cc
1.42 03/04/27 17:35:51 pem@xxxxxxxxx +7 -1
Don't set org_table_list->derived to 1 when debugging, as this breaks
certain
subselect args to SPs.

sql/sp_head.h
1.14 03/04/27 17:35:51 pem@xxxxxxxxx +1 -1
Minor comment fix.

sql/sp_head.cc
1.28 03/04/27 17:35:51 pem@xxxxxxxxx +2 -2
Minor layout and comment fix.

sql/sp.cc
1.14 03/04/27 17:35:51 pem@xxxxxxxxx +2 -2
Don't close derived tables.

mysql-test/t/subselect.test
1.62 03/04/27 17:35:51 pem@xxxxxxxxx +0 -16
Moved SP tests to sp.test.

mysql-test/t/sp.test
1.20 03/04/27 17:35:51 pem@xxxxxxxxx +30 -0
Moved SP tests from subselect and added some more.

mysql-test/r/subselect.result
1.72 03/04/27 17:35:51 pem@xxxxxxxxx +0 -17
Moved SP tests to sp.test.

mysql-test/r/sp.result
1.19 03/04/27 17:35:51 pem@xxxxxxxxx +27 -0
Moved SP tests from subselect and added some more.

# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: pem
# Host: mysql.telia.com
# Root: /home/pem/work/mysql-5.0

--- 1.285/sql/sql_parse.cc Wed Apr 23 21:31:39 2003
+++ 1.286/sql/sql_parse.cc Sun Apr 27 17:35:51 2003
@@ -3060,9 +3060,13 @@
uint smrx;
LINT_INIT(smrx);

+ // In case the arguments are subselects...
if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) ||
- (res= open_and_lock_tables(thd,tables))))
+ (res= open_and_lock_tables(thd, tables))))
+ {
+ sp->destroy(); // QQ Free memory. Remove this when caching!!!
break;
+ }
fix_tables_pointers(lex->all_selects_list);

#ifndef EMBEDDED_LIBRARY

--- 1.227/sql/sql_yacc.yy Wed Apr 23 09:22:52 2003
+++ 1.228/sql/sql_yacc.yy Sun Apr 27 17:35:51 2003
@@ -1399,7 +1399,8 @@
LEX *lex= Lex;
sp_label_t *lab= lex->spcont->find_label($5.str);

- if (! lab || strcasecmp($5.str, lab->name) != 0)
+ if (!lab ||
+ my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{
net_printf(YYTHD, ER_SP_LABEL_MISMATCH, $5.str);
YYABORT;

--- 1.41/sql/sql_derived.cc Mon Mar 17 14:05:02 2003
+++ 1.42/sql/sql_derived.cc Sun Apr 27 17:35:51 2003
@@ -199,7 +199,13 @@
else
unit->exclude_level();
org_table_list->db= (char *)"";
-#ifndef DBUG_OFF
+#if 0
+ /* QQ This was #ifndef DBUG_OFF, but that caused crashes with
+ * certain subselect args to SPs. Since ->derived is tested
+ * for non-null value in some places in the code, this seems
+ * to be the wrong way to do it. Simply letting derived be 0
+ * appears to work fine. /pem
+ */
/* Try to catch errors if this is accessed */
org_table_list->derived=(SELECT_LEX_UNIT *) 1;
#endif

--- 1.71/mysql-test/r/subselect.result Wed Apr 23 21:31:39 2003
+++ 1.72/mysql-test/r/subselect.result Sun Apr 27 17:35:51 2003
@@ -887,23 +887,6 @@
Table 'test.t1' doesn't exist
set @a:=(SELECT a from t1);
Table 'test.t1' doesn't exist
-create table t1 (a int);
-create table t2 (a int);
-insert into t2 values (1), (2), (3);
-create procedure foo1(x int)
-insert into test.t1 values (x);
-create function foo2(i int) returns int
-return i+1;
-call foo1((select max(a) from t2));
-select * from t1;
-a
-3
-select foo2((select max(a) from t2));
-foo2((select max(a) from t2))
-4
-drop table t1, t2;
-drop procedure foo1;
-drop function foo2;
CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;
HANDLER t1 READ a=((SELECT 1));

--- 1.61/mysql-test/t/subselect.test Wed Apr 23 21:31:39 2003
+++ 1.62/mysql-test/t/subselect.test Sun Apr 27 17:35:51 2003
@@ -502,22 +502,6 @@
-- error 1146
set @a:=(SELECT a from t1);

-#
-# CALL
-#
-create table t1 (a int);
-create table t2 (a int);
-insert into t2 values (1), (2), (3);
-create procedure foo1(x int)
- insert into test.t1 values (x);
-create function foo2(i int) returns int
- return i+1;
-call foo1((select max(a) from t2));
-select * from t1;
-select foo2((select max(a) from t2));
-drop table t1, t2;
-drop procedure foo1;
-drop function foo2;

CREATE TABLE t1 (a int, KEY(a));
HANDLER t1 OPEN;

--- 1.18/mysql-test/r/sp.result Fri Apr 4 15:47:41 2003
+++ 1.19/mysql-test/r/sp.result Sun Apr 27 17:35:51 2003
@@ -135,6 +135,26 @@
delete from t1;
drop procedure cbv1;
drop procedure cbv2;
+insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3);
+create procedure sub1(id char(16), x int)
+insert into test.t1 values (id, x);
+create function sub3(i int) returns int
+return i+1;
+call sub1("sub1a", (select 7));
+call sub1("sub1b", (select max(i) from t2));
+call sub1("sub1c", (select i,d from t2 limit 1));
+call sub1("sub1d", (select 1 from (select 1) a));
+select * from t1;
+id data
+sub1a 7
+sub1b 3
+sub1c 1
+sub1d 1
+select sub3((select max(i) from t2));
+sub3((select max(i) from t2))
+4
+drop procedure sub1;
+drop function sub3;
create procedure a0(x int)
while x do
set x = x-1;
@@ -143,6 +163,10 @@
call a0(3);
select * from t1;
id data
+sub1a 7
+sub1b 3
+sub1c 1
+sub1d 1
a0 2
a0 1
a0 0
@@ -391,6 +415,9 @@
xxxyyy 12 2.71828182845905
select * from t2;
s i d
+a 1 1.1
+b 2 1.2
+c 3 1.3
xxxyyy 12 2.71828182845905
ab 24 1324.36598821719
delete from t2;

--- 1.19/mysql-test/t/sp.test Fri Apr 4 15:47:41 2003
+++ 1.20/mysql-test/t/sp.test Sun Apr 27 17:35:51 2003
@@ -175,6 +175,36 @@
drop procedure cbv2|


+# Subselect arguments
+
+insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3)|
+
+create procedure sub1(id char(16), x int)
+ insert into test.t1 values (id, x)|
+
+# QQ This doesn't work yet
+#create procedure sub2(id char(16))
+#begin
+# declare x int;
+# set x = (select sum(t.x) from test.t2 t);
+# insert into test.t1 values (id, x);
+#end|
+
+create function sub3(i int) returns int
+ return i+1|
+
+call sub1("sub1a", (select 7))|
+call sub1("sub1b", (select max(i) from t2))|
+call sub1("sub1c", (select i,d from t2 limit 1))|
+call sub1("sub1d", (select 1 from (select 1) a))|
+#call sub2("sub2");
+select * from t1|
+select sub3((select max(i) from t2))|
+drop procedure sub1|
+#drop procedure sub2|
+drop function sub3|
+
+
# Basic tests of the flow control constructs

# Just test on 'x'...

--- 1.13/sql/sp.cc Fri Apr 4 15:47:41 2003
+++ 1.14/sql/sp.cc Sun Apr 27 17:35:51 2003
@@ -105,7 +105,7 @@
}
if (opened)
{
- close_thread_tables(thd);
+ close_thread_tables(thd, 0, 1);
table= NULL;
}

@@ -286,7 +286,7 @@
ret= TRUE;
}
if (opened)
- close_thread_tables(thd);
+ close_thread_tables(thd, 0, 1);
return ret;
}


--- 1.27/sql/sp_head.cc Wed Apr 23 21:31:39 2003
+++ 1.28/sql/sp_head.cc Sun Apr 27 17:35:51 2003
@@ -80,7 +80,7 @@
String tmp(buffer, sizeof(buffer), it->charset());
String *s= it->val_str(&tmp);

- DBUG_PRINT("info", ("default result: %*s", s->length(),
s->c_ptr_quick()))
+ DBUG_PRINT("info",("default result: %*s",s->length(),s->c_ptr_quick()));
it= new Item_string(sql_strmake(s->c_ptr_quick(), s->length()),
s->length(), it->charset());
break;
@@ -393,7 +393,7 @@
// Collect some data from the sub statement lex.
sp_merge_funs(&m_lex, &thd->lex);
#if 0
- // We're not using this at the moment.
+ // QQ We're not using this at the moment.
if (thd->lex.sql_command == SQLCOM_CALL)
{
// It would be slightly faster to keep the list sorted, but we need

--- 1.13/sql/sp_head.h Wed Apr 23 09:22:52 2003
+++ 1.14/sql/sp_head.h Sun Apr 27 17:35:51 2003
@@ -49,7 +49,7 @@
my_bool m_multi_query; // TRUE if a procedure with SELECT(s)
uint m_old_cmq; // Old CLIENT_MULTI_QUERIES value
#if 0
- // We're not using this at the moment.
+ // QQ We're not using this at the moment.
List<char *> m_calls; // Called procedures.
List<char *> m_tables; // Used tables.
#endif

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:
http://lists.mysql.com/internals?unsub=gcdmd-internals@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise