1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#10267 mysqltest, wrong number of loops when a script is sourced within a loop

This commit is contained in:
msvensson@neptunus.(none)
2005-08-16 17:10:52 +02:00
parent 447a119407
commit 9ed35f83fa
3 changed files with 105 additions and 1 deletions

View File

@ -962,7 +962,13 @@ int do_source(struct st_query* q)
*p++= 0;
check_eol_junk(p);
}
/* If this file has already been sourced, dont source it again.
It's already available in the q_lines cache */
if (parser.current_line < (parser.read_lines - 1))
return 0;
return open_file(name);
}
@ -2378,7 +2384,7 @@ int read_query(struct st_query** q_ptr)
DBUG_PRINT("warning",("too long query"));
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("query: %s", read_query_buf));
DBUG_PRINT("info", ("query: %s", read_query_buf));
if (*p == '#')
{
q->type = Q_COMMENT;

View File

@ -224,6 +224,61 @@ mysqltest: At line 1: Missing file name in source
mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: In included file "./var/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "./var/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: 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 'garbage' at line 1
2 = outer loop variable after while
here is the sourced script
2 = outer loop variable before dec
1 = outer loop variable after dec
1 = outer loop variable after while
here is the sourced script
1 = outer loop variable before dec
0 = outer loop variable after dec
2 = outer loop variable after while
here is the sourced script
2 = outer loop variable before dec
1 = outer loop variable after dec
1 = outer loop variable after while
here is the sourced script
1 = outer loop variable before dec
0 = outer loop variable after dec
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
In loop
here is the sourced script
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
1

View File

@ -524,6 +524,49 @@ echo $1;
--exec echo "source var/tmp/error.sql;" | $MYSQL_TEST 2>&1
# Test execution of source in a while loop
--exec echo "echo here is the sourced script;" > var/tmp/sourced.sql
--disable_query_log
let $outer= 2; # Number of outer loops
while ($outer)
{
eval SELECT '$outer = outer loop variable after while' AS "";
--source var/tmp/sourced.sql
eval SELECT '$outer = outer loop variable before dec' AS "";
dec $outer;
eval SELECT '$outer = outer loop variable after dec' AS "";
}
let $outer= 2; # Number of outer loops
while ($outer)
{
eval SELECT '$outer = outer loop variable after while' AS "";
echo here is the sourced script;
eval SELECT '$outer = outer loop variable before dec' AS "";
dec $outer;
eval SELECT '$outer = outer loop variable after dec' AS "";
}
# Test execution of source in a while loop
--exec echo "--source var/tmp/sourced.sql" > var/tmp/sourced1.sql
--disable_abort_on_error
# Sourcing of a file within while loop, sourced file will
# source other file
let $num= 9;
while ($num)
{
SELECT 'In loop' AS "";
--source var/tmp/sourced1.sql
dec $num;
}
--enable_abort_on_error;
--enable_query_log
# ----------------------------------------------------------------------------
# Test sleep command
# ----------------------------------------------------------------------------