AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.213
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/server/mysql/mysql-test/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/server/mysql/mysql-test/include/write_result_to_file.inc
# ==== 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.
#
# The statement is sent to mysqld on current connection using
# the mysql command line client.
#
# ==== Usage ====
#
# --let $statement= <STATEMENT>
# --let $output_file= {<FILE>|GENERATE}
# [--let $dont_print_statement= 1]
# [--let $allow_error= 1]
# [--let $append= 1]
# --source include/write_result_to_file.inc
#
# Parameters:
#   $statement
#     The statement to execute.
#
#   $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.
#
#   $allow_error
#     By default, this script causes the test to fail if the statement
#     generates an error.  If $allow_error is set, errors are ignored.
#
#   $append
#     By default, any existing file is overwritten. If $append is
#     specified, and the file exists, it appends to the file.

# Get the port and socket used by mysqld on current connection
--let _WRTF_SERVER_PORT= `SELECT @@PORT`
--let _WRTF_SERVER_SOCKET= `SELECT @@SOCKET`

--let $_write_result_msg= [connection=$CURRENT_CONNECTION]
if (!$dont_print_statement)
{
  --let $_write_result_msg= [connection=$CURRENT_CONNECTION 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

if ($allow_error)
{
  --let _WRTF_ALLOW_ERROR= 1
}
if (!$allow_error)
{
  --let _WRTF_ALLOW_ERROR= 0
}
if ($append)
{
  --let _WRTF_APPEND= 1
}
if (!$append)
{
  --let _WRTF_APPEND= 0
}

perl;
  use strict;
  my $stmt= $ENV{'_WRTF_STATEMENT'};
  # Connecting mysql to same mysqld as current connectiona
  # by overriding port and socket
  my $mysql= $ENV{'MYSQL'};
  my $server_port= $ENV{'_WRTF_SERVER_PORT'};
  my $server_socket= $ENV{'_WRTF_SERVER_SOCKET'};
  my $redirection_type= $ENV{'_WRTF_APPEND'} ? '>>' : '>';
  $mysql .= " --port=$server_port --socket=$server_socket";
  my $outfile = $ENV{'_WRTF_OUTPUT_FILE'};
  open MYSQL, "| $mysql $redirection_type $outfile" or die "Error $? opening MYSQL pipe '| $mysql > $outfile': $!";
  print MYSQL $stmt, ';' or die "Error $? printing statement '$stmt' to MYSQL pipe '| $mysql > $outfile': $!";
  close MYSQL or $ENV{'_WRTF_ALLOW_ERROR'} or die "Error $? closing MYSQL pipe '| $mysql > $outfile' reading '$stmt': $!";
EOF

--let $include_filename= write_result_to_file.inc [$write_result_msg]
--source include/end_include_file.inc

Anon7 - 2022
AnonSec Team