summaryrefslogtreecommitdiff
path: root/client/mysqltest.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-05-03 19:10:10 +0300
committerMichael Widenius <monty@askmonty.org>2011-05-03 19:10:10 +0300
commit1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9 (patch)
tree17ba1ed90233efa64bc83364ed1ffb74dd637ead /client/mysqltest.cc
parentce55d37929fc91b476541d3a77336a44b20317ac (diff)
parent90e058e0c623f770ee602ebab86e91303f08c90a (diff)
downloadmariadb-git-1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9.tar.gz
Merge with MariaDB 5.1
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r--client/mysqltest.cc52
1 files changed, 34 insertions, 18 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 65ae93696ea..bd0161afc87 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2009-2011 Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +12,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
mysqltest
@@ -490,7 +491,7 @@ VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
void var_free(void* v);
VAR* var_get(const char *var_name, const char** var_name_end,
my_bool raw, my_bool ignore_not_existing);
-void eval_expr(VAR* v, const char *p, const char** p_end, bool backtick= true);
+void eval_expr(VAR* v, const char *p, const char** p_end, bool do_eval= true);
my_bool match_delimiter(int c, const char *delim, uint length);
void dump_result_to_reject_file(char *buf, int size);
void dump_warning_messages();
@@ -1269,6 +1270,17 @@ static void cleanup_and_exit(int exit_code)
exit(exit_code);
}
+void print_file_stack()
+{
+ for (struct st_test_file* err_file= cur_file;
+ err_file != file_stack;
+ err_file--)
+ {
+ fprintf(stderr, "included from %s at line %d:\n",
+ err_file->file_name, err_file->lineno);
+ }
+}
+
void die(const char *fmt, ...)
{
static int dying= 0;
@@ -1279,8 +1291,11 @@ void die(const char *fmt, ...)
/* Print the error message */
fprintf(stderr, "mysqltest: ");
if (cur_file && cur_file != file_stack)
- fprintf(stderr, "In included file \"%s\": ",
+ {
+ fprintf(stderr, "In included file \"%s\": \n",
cur_file->file_name);
+ print_file_stack();
+ }
if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
if (fmt)
@@ -1319,7 +1334,6 @@ void die(const char *fmt, ...)
void abort_not_supported_test(const char *fmt, ...)
{
va_list args;
- struct st_test_file* err_file= cur_file;
DBUG_ENTER("abort_not_supported_test");
/* Print include filestack */
@@ -1327,13 +1341,8 @@ void abort_not_supported_test(const char *fmt, ...)
fprintf(stderr, "The test '%s' is not supported by this installation\n",
file_stack->file_name);
fprintf(stderr, "Detected in file %s at line %d\n",
- err_file->file_name, err_file->lineno);
- while (err_file != file_stack)
- {
- err_file--;
- fprintf(stderr, "included from %s at line %d\n",
- err_file->file_name, err_file->lineno);
- }
+ cur_file->file_name, cur_file->lineno);
+ print_file_stack();
/* Print error message */
va_start(args, fmt);
@@ -2418,7 +2427,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
break;
}
}
- eval_expr(var, value, 0);
+ eval_expr(var, value, 0, false);
}
dynstr_free(&ds_query);
mysql_free_result(res);
@@ -2448,12 +2457,16 @@ void var_copy(VAR *dest, VAR *src)
}
-void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
+void eval_expr(VAR *v, const char *p, const char **p_end, bool do_eval)
{
DBUG_ENTER("eval_expr");
DBUG_PRINT("enter", ("p: '%s'", p));
+ /* Skip to treat as pure string if no evaluation */
+ if (! do_eval)
+ goto NO_EVAL;
+
if (*p == '$')
{
VAR *vp;
@@ -2473,7 +2486,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
DBUG_VOID_RETURN;
}
- if (*p == '`' && backtick)
+ if (*p == '`')
{
var_query_set(v, p, p_end);
DBUG_VOID_RETURN;
@@ -2496,6 +2509,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end, bool backtick)
}
}
+ NO_EVAL:
{
int new_val_len = (p_end && *p_end) ?
(int) (*p_end - p) : (int) strlen(p);
@@ -8121,13 +8135,15 @@ int main(int argc, char **argv)
cur_file->lineno= 1;
}
init_re();
+
+ /* Cursor protcol implies ps protocol */
+ if (cursor_protocol)
+ ps_protocol= 1;
+
ps_protocol_enabled= ps_protocol;
sp_protocol_enabled= sp_protocol;
view_protocol_enabled= view_protocol;
cursor_protocol_enabled= cursor_protocol;
- /* Cursor protcol implies ps protocol */
- if (cursor_protocol_enabled)
- ps_protocol_enabled= 1;
st_connection *con= connections;
if (! (con->mysql= mysql_init(0)))