mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
474fe6d9d9
and small collateral changes mysql-test/lib/My/Test.pm: somehow with "print" we get truncated writes sometimes mysql-test/suite/perfschema/r/digest_table_full.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/dml_handler.result: host table is not ported over yet mysql-test/suite/perfschema/r/information_schema.result: host table is not ported over yet mysql-test/suite/perfschema/r/nesting.result: this differs, because we don't rewrite general log queries, and multi-statement packets are logged as a one entry. this result file is identical to what mysql-5.6.5 produces with the --log-raw option. mysql-test/suite/perfschema/r/relaylog.result: MariaDB modifies the binlog index file directly, while MySQL 5.6 has a feature "crash-safe binlog index" and modifies a special "crash-safe" shadow copy of the index file and then moves it over. That's why this test shows "NONE" index file writes in MySQL and "MANY" in MariaDB. mysql-test/suite/perfschema/r/server_init.result: MariaDB initializes the "manager" resources from the "manager" thread, and starts this thread only when --flush-time is not 0. MySQL 5.6 initializes "manager" resources unconditionally on server startup. mysql-test/suite/perfschema/r/stage_mdl_global.result: this differs, because MariaDB disables query cache when query_cache_size=0. MySQL does not do that, and this causes useless mutex locks and waits. mysql-test/suite/perfschema/r/statement_digest.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_consumers.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/perfschema/r/statement_digest_long_query.result: md5 hashes of statement digests differ, because yacc token codes are different in mariadb mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result: will be updated to match 5.6 when alfranio.correia@oracle.com-20110512172919-c1b5kmum4h52g0ni and anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y are merged mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result: will be updated to match 5.6 when anders.song@greatopensource.com-20110105052107-zoab0bsf5a6xxk2y is merged
77 lines
2.4 KiB
PHP
77 lines
2.4 KiB
PHP
# ==== Purpose ====
|
|
#
|
|
# Execute a statement and write the result to a file. This is useful
|
|
# if the output needs more advanced parsing than can be done by
|
|
# mysqltest commands.
|
|
#
|
|
# ==== Usage ====
|
|
#
|
|
# --let $statement= <STATEMENT>
|
|
# --let $output_file= {<FILE>|GENERATE}
|
|
# [--let $server_number= <NUMBER>]
|
|
# [--let $dont_print_statement= 1]
|
|
# --source include/write_result_to_file.inc
|
|
#
|
|
# Parameters:
|
|
# $statement
|
|
# The statement to execute.
|
|
#
|
|
# $server_number
|
|
# 1 for the master, 2 for the slave, 3 for next server, etc.
|
|
# If omitted, uses current connection.
|
|
#
|
|
# $output_file
|
|
# Name of file to write. If omitted, generates a new filename and
|
|
# stores the name both in the mysqltest variable $output_file and
|
|
# in the environment variable $OUTPUT_FILE.
|
|
#
|
|
# $dont_print_statement
|
|
# By default, the statement is echoed to the result log. If the
|
|
# statement contains non-deterministic output, set this variable
|
|
# to suppress it.
|
|
|
|
--let _WRTF_SERVER_NUMBER= $server_number
|
|
if (!$server_number)
|
|
{
|
|
--let _WRTF_SERVER_NUMBER= `SELECT 1 + @@PORT - $MASTER_MYPORT`
|
|
}
|
|
|
|
--let $_write_result_msg= [server=$_WRTF_SERVER_NUMBER]
|
|
if (!$dont_print_statement)
|
|
{
|
|
--let $_write_result_msg= [server=$_WRTF_SERVER_NUMBER statement=$statement]
|
|
}
|
|
|
|
--let $include_filename= write_result_to_file.inc $_write_result_msg
|
|
--source include/begin_include_file.inc
|
|
|
|
if ($statement == '')
|
|
{
|
|
--die !!!ERROR IN TEST: mysqltest variable 'statement' not set in write_result_to_file.inc
|
|
}
|
|
--let _WRTF_STATEMENT= $statement
|
|
|
|
if (!$output_file)
|
|
{
|
|
--die !!!ERROR IN TEST: mysqltest variable 'output_file' not set in write_result_to_file.inc
|
|
}
|
|
if ($output_file == GENERATE)
|
|
{
|
|
--let $output_file= `SELECT UUID()`
|
|
--let $output_file= $MYSQLTEST_VARDIR/tmp/_stmt_file_$output_file
|
|
}
|
|
--let _WRTF_OUTPUT_FILE= $output_file
|
|
|
|
perl;
|
|
my $stmt= $ENV{'_WRTF_STATEMENT'};
|
|
my $server_number= $ENV{'_WRTF_SERVER_NUMBER'};
|
|
my $mysql = $ENV{'MYSQL'};
|
|
$mysql =~ s/( --|$)/ --defaults-group-suffix=.$server_number$1/;
|
|
my $outfile = $ENV{'_WRTF_OUTPUT_FILE'};
|
|
open MYSQL, "| $mysql > $outfile" or die "Failed to open pipe to client on server '$server_number': $!";
|
|
print MYSQL $stmt, ';' or die "Error printing statement to MYSQL pipe: $!";
|
|
close MYSQL or die "Error closing MYSQL pipe: $!";
|
|
EOF
|
|
|
|
--let $include_filename= write_result_to_file.inc [$write_result_msg]
|
|
--source include/end_include_file.inc
|