summaryrefslogtreecommitdiff
path: root/client/mysqltest.c
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2004-03-10 22:54:07 +0400
committerunknown <vva@eagle.mysql.r18.ru>2004-03-10 22:54:07 +0400
commit2053f8f850f2b078dc947fa38d23339b8b24fed9 (patch)
tree9477ae54316c6e9890d227309fae165d98b377c9 /client/mysqltest.c
parentc0422729cf5b271d703564ff42afc621b069dfe5 (diff)
downloadmariadb-git-2053f8f850f2b078dc947fa38d23339b8b24fed9.tar.gz
fixed BUG #2874 "Grant table bug" and
added tests for testing structure of mysql db client/mysqltest.c: extend "replace" to column names extend "disable_result_log" to output of --exec commad mysql-test/install_test_db.sh: corrected wrong column definitions (as a result of tests) mysql-test/mysql-test-run.sh: export MYSQL and MYSQL_FIX_SYSTEM_TABLES + added option --result-file for *.opt files scripts/mysql_fix_privilege_tables.sh: added new options to using in tests + added new alters (as a result of new tests) scripts/mysql_fix_privilege_tables.sql: added new alters (as a result of new tests) scripts/mysql_install_db.sh: corrected definition of tables_priv.Table_name
Diffstat (limited to 'client/mysqltest.c')
-rw-r--r--client/mysqltest.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index f41f697ad26..32fc9d9ac17 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -867,36 +867,46 @@ int do_exec(struct st_query* q)
if (!*cmd)
die("Missing argument in exec\n");
- if (q->record_file[0])
+ if (disable_result_log)
{
- init_dynamic_string(&ds_tmp, "", 16384, 65536);
- ds= &ds_tmp;
+ if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
+ die("popen() failed\n");
+ while (fgets(buf, sizeof(buf), res_file));
+ pclose(res_file);
}
else
- ds= &ds_res;
+ {
+ if (q->record_file[0])
+ {
+ init_dynamic_string(&ds_tmp, "", 16384, 65536);
+ ds= &ds_tmp;
+ }
+ else
+ ds= &ds_res;
- if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
- die("popen() failed\n");
- while (fgets(buf, sizeof(buf), res_file))
- replace_dynstr_append_mem(ds, buf, strlen(buf));
- pclose(res_file);
+ if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
+ die("popen() failed\n");
+ while (fgets(buf, sizeof(buf), res_file))
+ replace_dynstr_append_mem(ds, buf, strlen(buf));
+ pclose(res_file);
- if (glob_replace)
- free_replace();
+ if (glob_replace)
+ free_replace();
- if (record)
- {
- if (!q->record_file[0] && !result_file)
- die("At line %u: Missing result file", start_lineno);
- if (!result_file)
- str_to_file(q->record_file, ds->str, ds->length);
- }
- else if (q->record_file[0])
- {
- error= check_result(ds, q->record_file, q->require_file);
+ if (record)
+ {
+ if (!q->record_file[0] && !result_file)
+ die("At line %u: Missing result file", start_lineno);
+ if (!result_file)
+ str_to_file(q->record_file, ds->str, ds->length);
+ }
+ else if (q->record_file[0])
+ {
+ error= check_result(ds, q->record_file, q->require_file);
+ }
+ if (ds == &ds_tmp)
+ dynstr_free(&ds_tmp);
}
- if (ds == &ds_tmp)
- dynstr_free(&ds_tmp);
return error;
}
@@ -2251,7 +2261,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
{
if (i)
dynstr_append_mem(ds, "\t", 1);
- dynstr_append(ds, fields[i].name);
+ replace_dynstr_append_mem(ds, fields[i].name, strlen(fields[i].name));
}
dynstr_append_mem(ds, "\n", 1);
append_result(ds, res);