merge from 5.1-mtr
This commit is contained in:
commit
b295a25109
@ -471,7 +471,7 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
|
|||||||
void var_free(void* v);
|
void var_free(void* v);
|
||||||
VAR* var_get(const char *var_name, const char** var_name_end,
|
VAR* var_get(const char *var_name, const char** var_name_end,
|
||||||
my_bool raw, my_bool ignore_not_existing);
|
my_bool raw, my_bool ignore_not_existing);
|
||||||
void eval_expr(VAR* v, const char *p, const char** p_end);
|
void eval_expr(VAR* v, const char *p, const char** p_end, bool backtick= true);
|
||||||
my_bool match_delimiter(int c, const char *delim, uint length);
|
my_bool match_delimiter(int c, const char *delim, uint length);
|
||||||
void dump_result_to_reject_file(char *buf, int size);
|
void dump_result_to_reject_file(char *buf, int size);
|
||||||
void dump_warning_messages();
|
void dump_warning_messages();
|
||||||
@ -2233,7 +2233,8 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||||||
dynstr_append_mem(&result, "\t", 1);
|
dynstr_append_mem(&result, "\t", 1);
|
||||||
}
|
}
|
||||||
end= result.str + result.length-1;
|
end= result.str + result.length-1;
|
||||||
eval_expr(var, result.str, (const char**) &end);
|
/* Evaluation should not recurse via backtick */
|
||||||
|
eval_expr(var, result.str, (const char**) &end, false);
|
||||||
dynstr_free(&result);
|
dynstr_free(&result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2389,7 +2390,7 @@ void var_copy(VAR *dest, VAR *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void eval_expr(VAR *v, const char *p, const char **p_end)
|
void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
|
||||||
{
|
{
|
||||||
|
|
||||||
DBUG_ENTER("eval_expr");
|
DBUG_ENTER("eval_expr");
|
||||||
@ -2414,7 +2415,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p == '`')
|
if (*p == '`' && backtick)
|
||||||
{
|
{
|
||||||
var_query_set(v, p, p_end);
|
var_query_set(v, p, p_end);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@ -5439,7 +5440,9 @@ void do_block(enum block_cmd cmd, struct st_command* command)
|
|||||||
if (*expr_start == '!')
|
if (*expr_start == '!')
|
||||||
{
|
{
|
||||||
not_expr= TRUE;
|
not_expr= TRUE;
|
||||||
expr_start++; /* Step past the '!' */
|
expr_start++; /* Step past the '!', then any whitespace */
|
||||||
|
while (*expr_start && my_isspace(charset_info, *expr_start))
|
||||||
|
expr_start++;
|
||||||
}
|
}
|
||||||
/* Find ending ')' */
|
/* Find ending ')' */
|
||||||
expr_end= strrchr(expr_start, ')');
|
expr_end= strrchr(expr_start, ')');
|
||||||
|
@ -308,6 +308,10 @@ var3 two columns with same name
|
|||||||
var4 from query that returns NULL
|
var4 from query that returns NULL
|
||||||
var5 from query that returns no row
|
var5 from query that returns no row
|
||||||
failing query in let
|
failing query in let
|
||||||
|
create table t1 (a varchar(100));
|
||||||
|
insert into t1 values ('`select 42`');
|
||||||
|
`select 42`
|
||||||
|
drop table t1;
|
||||||
mysqltest: At line 1: Error running query 'failing query': 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 'failing query' at line 1
|
mysqltest: At line 1: Error running query 'failing query': 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 'failing query' at line 1
|
||||||
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
|
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
|
||||||
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
|
mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
|
||||||
@ -398,7 +402,9 @@ true-inner
|
|||||||
true-inner again
|
true-inner again
|
||||||
true-outer
|
true-outer
|
||||||
Counter is greater than 0, (counter=10)
|
Counter is greater than 0, (counter=10)
|
||||||
|
Counter should still be 10, is 10
|
||||||
Counter is not 0, (counter=0)
|
Counter is not 0, (counter=0)
|
||||||
|
Not space var works
|
||||||
Counter is true, (counter=alpha)
|
Counter is true, (counter=alpha)
|
||||||
Beta is true
|
Beta is true
|
||||||
while with string, only once
|
while with string, only once
|
||||||
|
@ -854,6 +854,13 @@ let $var2= `failing query`;
|
|||||||
echo $var2;
|
echo $var2;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
create table t1 (a varchar(100));
|
||||||
|
insert into t1 values ('`select 42`');
|
||||||
|
let $a= `select * from t1`;
|
||||||
|
# This should output `select 42`, not evaluate it again to 42
|
||||||
|
echo $a;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--error 1
|
--error 1
|
||||||
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
|
--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
|
||||||
|
|
||||||
@ -1131,6 +1138,11 @@ if (!$counter)
|
|||||||
{
|
{
|
||||||
echo Counter is not 0, (counter=10);
|
echo Counter is not 0, (counter=10);
|
||||||
}
|
}
|
||||||
|
if (! $counter)
|
||||||
|
{
|
||||||
|
let $counter=5;
|
||||||
|
}
|
||||||
|
echo Counter should still be 10, is $counter;
|
||||||
let $counter=0;
|
let $counter=0;
|
||||||
if($counter)
|
if($counter)
|
||||||
{
|
{
|
||||||
@ -1140,6 +1152,10 @@ if (!$counter)
|
|||||||
{
|
{
|
||||||
echo Counter is not 0, (counter=0);
|
echo Counter is not 0, (counter=0);
|
||||||
}
|
}
|
||||||
|
if (! $counter)
|
||||||
|
{
|
||||||
|
echo Not space var works;
|
||||||
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Test if with some non-numerics
|
# Test if with some non-numerics
|
||||||
|
Loading…
x
Reference in New Issue
Block a user