Commit 3ece1f3e authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1
parents 8d78cd3e 71ef9102
......@@ -494,7 +494,8 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name);
static void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
const char *from, int len);
void free_pointer_array(POINTER_ARRAY *pa);
static void do_eval(DYNAMIC_STRING *query_eval, const char *query);
static void do_eval(DYNAMIC_STRING *query_eval, const char *query,
my_bool pass_through_escape_chars);
static void str_to_file(const char *fname, char *str, int size);
#ifdef __WIN__
......@@ -526,7 +527,8 @@ static void handle_error(const char *query, struct st_query *q,
const char *err_sqlstate, DYNAMIC_STRING *ds);
static void handle_no_error(struct st_query *q);
static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
static void do_eval(DYNAMIC_STRING* query_eval, const char *query,
my_bool pass_through_escape_chars)
{
const char *p;
register char c, next_c;
......@@ -561,6 +563,12 @@ static void do_eval(DYNAMIC_STRING* query_eval, const char *query)
{
/* Set escaped only if next char is \ or $ */
escaped = 1;
if (pass_through_escape_chars)
{
/* The escape char should be added to the output string. */
dynstr_append_mem(query_eval, p, 1);
}
}
else
dynstr_append_mem(query_eval, p, 1);
......@@ -750,7 +758,7 @@ static int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
init_dynamic_string(&res_ds, "", 0, 65536);
if (eval_result)
{
do_eval(&res_ds, tmp);
do_eval(&res_ds, tmp, FALSE);
res_ptr = res_ds.str;
if ((res_len = res_ds.length) != ds->length)
{
......@@ -1145,7 +1153,7 @@ static void do_exec(struct st_query *query)
init_dynamic_string(&ds_cmd, 0, strlen(cmd)+256, 256);
/* Eval the command, thus replacing all environment variables */
do_eval(&ds_cmd, cmd);
do_eval(&ds_cmd, cmd, TRUE);
cmd= ds_cmd.str;
DBUG_PRINT("info", ("Executing '%s' as '%s'",
......@@ -1439,7 +1447,7 @@ int do_system(struct st_query *command)
init_dynamic_string(&ds_cmd, 0, strlen(command->first_argument) + 64, 256);
/* Eval the system command, thus replacing all environment variables */
do_eval(&ds_cmd, command->first_argument);
do_eval(&ds_cmd, command->first_argument, TRUE);
DBUG_PRINT("info", ("running system command '%s' as '%s'",
command->first_argument, ds_cmd.str));
......@@ -1490,7 +1498,7 @@ int do_echo(struct st_query *command)
ds= &ds_res;
init_dynamic_string(&ds_echo, "", 256, 256);
do_eval(&ds_echo, command->first_argument);
do_eval(&ds_echo, command->first_argument, FALSE);
dynstr_append_mem(ds, ds_echo.str, ds_echo.length);
dynstr_append_mem(ds, "\n", 1);
dynstr_free(&ds_echo);
......@@ -2819,7 +2827,6 @@ int do_block(enum block_cmd cmd, struct st_query* q)
var_free(&v);
DBUG_VOID_RETURN;
return 0;
}
......@@ -4590,7 +4597,7 @@ static void run_query(MYSQL *mysql, struct st_query *command, int flags)
if (command->type == Q_EVAL)
{
init_dynamic_string(&eval_query, "", 16384, 65536);
do_eval(&eval_query, command->query);
do_eval(&eval_query, command->query, FALSE);
query = eval_query.str;
query_len = eval_query.length;
}
......
......@@ -223,7 +223,7 @@ mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
......
......@@ -647,7 +647,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\\\t1" 2>&1
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
......@@ -1081,7 +1081,6 @@ drop table t1;
drop view v1, v2, v3, v4, v5;
#
# Bug #16878 dump of trigger
#
......
......@@ -690,7 +690,7 @@ echo $i;
--error 1
--exec echo "inc i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \\\$i=100; inc \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
--exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
inc $i; inc $i; inc $i; --echo $i
echo $i;
......@@ -718,7 +718,7 @@ echo $d;
--error 1
--exec echo "dec i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \\\$i=100; dec \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
--exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -802,11 +802,11 @@ while (!$i)
--error 1
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while \\\$i;" | $MYSQL_TEST 2>&1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while (\\\$i;" | $MYSQL_TEST 2>&1
--exec echo "while (\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \\\$i=1; while (\\\$i) dec \\\$i;" | $MYSQL_TEST 2>&1
--exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "};" | $MYSQL_TEST 2>&1
--error 1
......@@ -918,8 +918,8 @@ select "a" as col1, "c" as col2;
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--exec echo "let \\\$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
......@@ -928,8 +928,8 @@ select "a" as col1, "c" as col2;
--exec echo "source $MYSQLTEST_VARDIR/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \\\$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
......@@ -1051,7 +1051,7 @@ select "this will be executed";
#
# Test that a test file that does not generate any output fails.
#
--exec echo "let \\\$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
......
......@@ -5151,9 +5151,9 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
if (item_ref->ref_type() == VIEW_REF)
{
Item *item_ref_ref= *(item_ref->ref);
DBUG_ASSERT((*ref)->type() == FIELD_ITEM &&
(item_ref_ref->type() == FIELD_ITEM));
return (*ref == item_ref_ref);
DBUG_ASSERT((*ref)->real_item()->type() == FIELD_ITEM &&
(item_ref_ref->real_item()->type() == FIELD_ITEM));
return ((*ref)->real_item() == item_ref_ref->real_item());
}
}
return FALSE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment