mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fixed that --sorted-result in mysql-test-run also works for exec
mysql-test/r/information_schema_all_engines.result: Update result mysql-test/t/information_schema_all_engines.test: Added --sorted-results as tables in information_schema are not sorted.
This commit is contained in:
parent
cf86abffbf
commit
a148cf7fb0
3 changed files with 140 additions and 118 deletions
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009-2011 Monty Program Ab.
|
||||
Copyright (c) 2009-2012 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
|
||||
|
@ -732,7 +732,8 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
|
|||
int len);
|
||||
void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val);
|
||||
void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val);
|
||||
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input);
|
||||
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING* ds_input,
|
||||
bool keep_header);
|
||||
|
||||
static int match_expected_error(struct st_command *command,
|
||||
unsigned int err_errno,
|
||||
|
@ -2790,6 +2791,7 @@ void do_exec(struct st_command *command)
|
|||
FILE *res_file;
|
||||
char *cmd= command->first_argument;
|
||||
DYNAMIC_STRING ds_cmd;
|
||||
DYNAMIC_STRING ds_sorted, *ds_result;
|
||||
DBUG_ENTER("do_exec");
|
||||
DBUG_PRINT("enter", ("cmd: '%s'", cmd));
|
||||
|
||||
|
@ -2835,6 +2837,13 @@ void do_exec(struct st_command *command)
|
|||
die("popen(\"%s\", \"r\") failed", command->first_argument);
|
||||
}
|
||||
|
||||
ds_result= &ds_res;
|
||||
if (display_result_sorted)
|
||||
{
|
||||
init_dynamic_string(&ds_sorted, "", 1024, 1024);
|
||||
ds_result= &ds_sorted;
|
||||
}
|
||||
|
||||
while (fgets(buf, sizeof(buf), res_file))
|
||||
{
|
||||
if (disable_result_log)
|
||||
|
@ -2844,10 +2853,17 @@ void do_exec(struct st_command *command)
|
|||
}
|
||||
else
|
||||
{
|
||||
replace_dynstr_append(&ds_res, buf);
|
||||
replace_dynstr_append(ds_result, buf);
|
||||
}
|
||||
}
|
||||
error= pclose(res_file);
|
||||
|
||||
if (display_result_sorted)
|
||||
{
|
||||
dynstr_append_sorted(&ds_res, &ds_sorted, 0);
|
||||
dynstr_free(&ds_sorted);
|
||||
}
|
||||
|
||||
if (error > 0)
|
||||
{
|
||||
uint status= WEXITSTATUS(error);
|
||||
|
@ -7743,7 +7759,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
if (display_result_sorted)
|
||||
{
|
||||
/* Sort the result set and append it to result */
|
||||
dynstr_append_sorted(save_ds, &ds_sorted);
|
||||
dynstr_append_sorted(save_ds, &ds_sorted, 1);
|
||||
ds= save_ds;
|
||||
dynstr_free(&ds_sorted);
|
||||
}
|
||||
|
@ -10125,17 +10141,16 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Build a list of pointer to each line in ds_input, sort
|
||||
the list and use the sorted list to append the strings
|
||||
sorted to the output ds
|
||||
|
||||
SYNOPSIS
|
||||
dynstr_append_sorted
|
||||
ds - string where the sorted output will be appended
|
||||
ds_input - string to be sorted
|
||||
|
||||
dynstr_append_sorted()
|
||||
ds string where the sorted output will be appended
|
||||
ds_input string to be sorted
|
||||
keep_header If header should not be sorted
|
||||
*/
|
||||
|
||||
static int comp_lines(const char **a, const char **b)
|
||||
|
@ -10143,7 +10158,8 @@ static int comp_lines(const char **a, const char **b)
|
|||
return (strcmp(*a,*b));
|
||||
}
|
||||
|
||||
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
|
||||
void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
|
||||
bool keep_header)
|
||||
{
|
||||
unsigned i;
|
||||
char *start= ds_input->str;
|
||||
|
@ -10155,11 +10171,14 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
|
|||
|
||||
my_init_dynamic_array(&lines, sizeof(const char*), 32, 32);
|
||||
|
||||
/* First line is result header, skip past it */
|
||||
while (*start && *start != '\n')
|
||||
start++;
|
||||
start++; /* Skip past \n */
|
||||
dynstr_append_mem(ds, ds_input->str, start - ds_input->str);
|
||||
if (keep_header)
|
||||
{
|
||||
/* First line is result header, skip past it */
|
||||
while (*start && *start != '\n')
|
||||
start++;
|
||||
start++; /* Skip past \n */
|
||||
dynstr_append_mem(ds, ds_input->str, start - ds_input->str);
|
||||
}
|
||||
|
||||
/* Insert line(s) in array */
|
||||
while (*start)
|
||||
|
@ -10237,4 +10256,3 @@ char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
|
|||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,26 @@ FILES
|
|||
GLOBAL_STATUS
|
||||
GLOBAL_VARIABLES
|
||||
INDEX_STATISTICS
|
||||
INNODB_BUFFER_POOL_PAGES
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX
|
||||
INNODB_CMP
|
||||
INNODB_CMPMEM
|
||||
INNODB_CMPMEM_RESET
|
||||
INNODB_CMP_RESET
|
||||
INNODB_INDEX_STATS
|
||||
INNODB_LOCKS
|
||||
INNODB_LOCK_WAITS
|
||||
INNODB_RSEG
|
||||
INNODB_SYS_INDEXES
|
||||
INNODB_SYS_STATS
|
||||
INNODB_SYS_TABLES
|
||||
INNODB_TABLE_STATS
|
||||
INNODB_TRX
|
||||
KEY_CACHES
|
||||
KEY_COLUMN_USAGE
|
||||
PARTITIONS
|
||||
PBXT_STATISTICS
|
||||
PLUGINS
|
||||
PROCESSLIST
|
||||
PROFILING
|
||||
|
@ -34,25 +51,8 @@ TRIGGERS
|
|||
USER_PRIVILEGES
|
||||
USER_STATISTICS
|
||||
VIEWS
|
||||
INNODB_BUFFER_POOL_PAGES
|
||||
PBXT_STATISTICS
|
||||
INNODB_CMP
|
||||
INNODB_RSEG
|
||||
XTRADB_ENHANCEMENTS
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX
|
||||
XTRADB_ADMIN_COMMAND
|
||||
INNODB_TRX
|
||||
INNODB_SYS_TABLES
|
||||
INNODB_LOCK_WAITS
|
||||
INNODB_SYS_STATS
|
||||
INNODB_LOCKS
|
||||
INNODB_CMPMEM
|
||||
INNODB_TABLE_STATS
|
||||
INNODB_SYS_INDEXES
|
||||
INNODB_CMP_RESET
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB
|
||||
INNODB_CMPMEM_RESET
|
||||
INNODB_INDEX_STATS
|
||||
XTRADB_ENHANCEMENTS
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
|
@ -66,7 +66,7 @@ FROM information_schema.columns c2
|
|||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
) order by t.table_name;
|
||||
table_name column_name
|
||||
CHARACTER_SETS CHARACTER_SET_NAME
|
||||
CLIENT_STATISTICS CLIENT
|
||||
|
@ -80,9 +80,26 @@ FILES TABLE_SCHEMA
|
|||
GLOBAL_STATUS VARIABLE_NAME
|
||||
GLOBAL_VARIABLES VARIABLE_NAME
|
||||
INDEX_STATISTICS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
INNODB_CMP page_size
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_INDEX_STATS table_schema
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_RSEG rseg_id
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_SYS_STATS INDEX_ID
|
||||
INNODB_SYS_TABLES SCHEMA
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_TRX trx_id
|
||||
KEY_CACHES KEY_CACHE_NAME
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PBXT_STATISTICS ID
|
||||
PLUGINS PLUGIN_NAME
|
||||
PROCESSLIST ID
|
||||
PROFILING QUERY_ID
|
||||
|
@ -101,25 +118,8 @@ TRIGGERS TRIGGER_SCHEMA
|
|||
USER_PRIVILEGES GRANTEE
|
||||
USER_STATISTICS USER
|
||||
VIEWS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
PBXT_STATISTICS ID
|
||||
INNODB_CMP page_size
|
||||
INNODB_RSEG rseg_id
|
||||
XTRADB_ENHANCEMENTS name
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
XTRADB_ADMIN_COMMAND result_message
|
||||
INNODB_TRX trx_id
|
||||
INNODB_SYS_TABLES SCHEMA
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_SYS_STATS INDEX_ID
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_INDEX_STATS table_schema
|
||||
XTRADB_ENHANCEMENTS name
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
|
@ -133,7 +133,7 @@ FROM information_schema.columns c2
|
|||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
) order by t.table_name;
|
||||
table_name column_name
|
||||
CHARACTER_SETS CHARACTER_SET_NAME
|
||||
CLIENT_STATISTICS CLIENT
|
||||
|
@ -147,9 +147,26 @@ FILES TABLE_SCHEMA
|
|||
GLOBAL_STATUS VARIABLE_NAME
|
||||
GLOBAL_VARIABLES VARIABLE_NAME
|
||||
INDEX_STATISTICS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
INNODB_CMP page_size
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_INDEX_STATS table_schema
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_RSEG rseg_id
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_SYS_STATS INDEX_ID
|
||||
INNODB_SYS_TABLES SCHEMA
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_TRX trx_id
|
||||
KEY_CACHES KEY_CACHE_NAME
|
||||
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
PBXT_STATISTICS ID
|
||||
PLUGINS PLUGIN_NAME
|
||||
PROCESSLIST ID
|
||||
PROFILING QUERY_ID
|
||||
|
@ -168,25 +185,8 @@ TRIGGERS TRIGGER_SCHEMA
|
|||
USER_PRIVILEGES GRANTEE
|
||||
USER_STATISTICS USER
|
||||
VIEWS TABLE_SCHEMA
|
||||
INNODB_BUFFER_POOL_PAGES page_type
|
||||
PBXT_STATISTICS ID
|
||||
INNODB_CMP page_size
|
||||
INNODB_RSEG rseg_id
|
||||
XTRADB_ENHANCEMENTS name
|
||||
INNODB_BUFFER_POOL_PAGES_INDEX index_id
|
||||
XTRADB_ADMIN_COMMAND result_message
|
||||
INNODB_TRX trx_id
|
||||
INNODB_SYS_TABLES SCHEMA
|
||||
INNODB_LOCK_WAITS requesting_trx_id
|
||||
INNODB_SYS_STATS INDEX_ID
|
||||
INNODB_LOCKS lock_id
|
||||
INNODB_CMPMEM page_size
|
||||
INNODB_TABLE_STATS table_schema
|
||||
INNODB_SYS_INDEXES TABLE_ID
|
||||
INNODB_CMP_RESET page_size
|
||||
INNODB_BUFFER_POOL_PAGES_BLOB space_id
|
||||
INNODB_CMPMEM_RESET page_size
|
||||
INNODB_INDEX_STATS table_schema
|
||||
XTRADB_ENHANCEMENTS name
|
||||
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
|
||||
(select cast(table_name as char) from information_schema.tables
|
||||
order by table_name limit 1) limit 1;
|
||||
|
@ -259,10 +259,11 @@ USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
|
|||
USER_STATISTICS information_schema.USER_STATISTICS 1
|
||||
VIEWS information_schema.VIEWS 1
|
||||
XTRADB_ENHANCEMENTS information_schema.XTRADB_ENHANCEMENTS 1
|
||||
+---------------------------------------+
|
||||
+---------------------------------------+
|
||||
+---------------------------------------+
|
||||
Database: information_schema
|
||||
+---------------------------------------+
|
||||
| Tables |
|
||||
+---------------------------------------+
|
||||
| CHARACTER_SETS |
|
||||
| CLIENT_STATISTICS |
|
||||
| COLLATIONS |
|
||||
|
@ -275,9 +276,26 @@ Database: information_schema
|
|||
| GLOBAL_STATUS |
|
||||
| GLOBAL_VARIABLES |
|
||||
| INDEX_STATISTICS |
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| INNODB_CMP |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_INDEX_STATS |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_RSEG |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_SYS_STATS |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_TRX |
|
||||
| KEY_CACHES |
|
||||
| KEY_COLUMN_USAGE |
|
||||
| PARTITIONS |
|
||||
| PBXT_STATISTICS |
|
||||
| PLUGINS |
|
||||
| PROCESSLIST |
|
||||
| PROFILING |
|
||||
|
@ -296,30 +314,13 @@ Database: information_schema
|
|||
| USER_PRIVILEGES |
|
||||
| USER_STATISTICS |
|
||||
| VIEWS |
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| PBXT_STATISTICS |
|
||||
| INNODB_CMP |
|
||||
| INNODB_RSEG |
|
||||
| XTRADB_ENHANCEMENTS |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| XTRADB_ADMIN_COMMAND |
|
||||
| INNODB_TRX |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_SYS_STATS |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_INDEX_STATS |
|
||||
| XTRADB_ENHANCEMENTS |
|
||||
+---------------------------------------+
|
||||
+---------------------------------------+
|
||||
+---------------------------------------+
|
||||
Database: INFORMATION_SCHEMA
|
||||
+---------------------------------------+
|
||||
| Tables |
|
||||
+---------------------------------------+
|
||||
| CHARACTER_SETS |
|
||||
| CLIENT_STATISTICS |
|
||||
| COLLATIONS |
|
||||
|
@ -332,9 +333,26 @@ Database: INFORMATION_SCHEMA
|
|||
| GLOBAL_STATUS |
|
||||
| GLOBAL_VARIABLES |
|
||||
| INDEX_STATISTICS |
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| INNODB_CMP |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_INDEX_STATS |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_RSEG |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_SYS_STATS |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_TRX |
|
||||
| KEY_CACHES |
|
||||
| KEY_COLUMN_USAGE |
|
||||
| PARTITIONS |
|
||||
| PBXT_STATISTICS |
|
||||
| PLUGINS |
|
||||
| PROCESSLIST |
|
||||
| PROFILING |
|
||||
|
@ -353,32 +371,14 @@ Database: INFORMATION_SCHEMA
|
|||
| USER_PRIVILEGES |
|
||||
| USER_STATISTICS |
|
||||
| VIEWS |
|
||||
| INNODB_BUFFER_POOL_PAGES |
|
||||
| PBXT_STATISTICS |
|
||||
| INNODB_CMP |
|
||||
| INNODB_RSEG |
|
||||
| XTRADB_ENHANCEMENTS |
|
||||
| INNODB_BUFFER_POOL_PAGES_INDEX |
|
||||
| XTRADB_ADMIN_COMMAND |
|
||||
| INNODB_TRX |
|
||||
| INNODB_SYS_TABLES |
|
||||
| INNODB_LOCK_WAITS |
|
||||
| INNODB_SYS_STATS |
|
||||
| INNODB_LOCKS |
|
||||
| INNODB_CMPMEM |
|
||||
| INNODB_TABLE_STATS |
|
||||
| INNODB_SYS_INDEXES |
|
||||
| INNODB_CMP_RESET |
|
||||
| INNODB_BUFFER_POOL_PAGES_BLOB |
|
||||
| INNODB_CMPMEM_RESET |
|
||||
| INNODB_INDEX_STATS |
|
||||
+---------------------------------------+
|
||||
| XTRADB_ENHANCEMENTS |
|
||||
+--------------------+
|
||||
+--------------------+
|
||||
+--------------------+
|
||||
Wildcard: inf_rmation_schema
|
||||
+--------------------+
|
||||
| Databases |
|
||||
+--------------------+
|
||||
| information_schema |
|
||||
+--------------------+
|
||||
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
|
||||
table_schema count(*)
|
||||
information_schema 52
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
use INFORMATION_SCHEMA;
|
||||
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
|
||||
--sorted_result
|
||||
show tables;
|
||||
|
||||
#
|
||||
|
@ -28,7 +29,7 @@ SELECT t.table_name, c1.column_name
|
|||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
) order by t.table_name;
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
|
@ -42,7 +43,7 @@ SELECT t.table_name, c1.column_name
|
|||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%'
|
||||
);
|
||||
) order by t.table_name;
|
||||
|
||||
#
|
||||
# Bug#24630 Subselect query crashes mysqld
|
||||
|
@ -70,8 +71,11 @@ group by t.table_name order by num1, t.table_name;
|
|||
#
|
||||
# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
|
||||
#
|
||||
--sorted_result
|
||||
--exec $MYSQL_SHOW information_schema
|
||||
--sorted_result
|
||||
--exec $MYSQL_SHOW INFORMATION_SCHEMA
|
||||
--sorted_result
|
||||
--exec $MYSQL_SHOW inf_rmation_schema
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue