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:
@ -962,7 +962,13 @@ int do_source(struct st_query* q)
|
|||||||
*p++= 0;
|
*p++= 0;
|
||||||
check_eol_junk(p);
|
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);
|
return open_file(name);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,6 +224,61 @@ mysqltest: At line 1: Missing file name in source
|
|||||||
mysqltest: At line 1: Could not open file ./non_existingFile
|
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/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
|
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: Missing argument to sleep
|
||||||
mysqltest: At line 1: Invalid argument to sleep "abc"
|
mysqltest: At line 1: Invalid argument to sleep "abc"
|
||||||
1
|
1
|
||||||
|
@ -524,6 +524,49 @@ echo $1;
|
|||||||
--exec echo "source var/tmp/error.sql;" | $MYSQL_TEST 2>&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
|
# Test sleep command
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user