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 : |
# ==== Purpose ==== # # Execute a statement and compute the number of rows of the result set. # # This is intended to be used for queries like SHOW BINLOG EVENTS # where you cannot use COUNT(*). It would be nicer if mysqltest had # this feature. Now we have to execute the statement several times and # see if 'query_get_value(*, row) returns 'No such row'. Beware to not # use this for queries that have side effects. # # ==== Usage ==== # # --let $statement= STATEMENT # --let $column= COLUMN_NAME # --source include/get_row_count.inc # --echo $statement has $row_count rows # # Parameters: # $statement # The statement to execute. Beware that this will be executed # multiple times. # # $column # The name of one column of the result. This may seem redundant # but unfortunately mysqltest forces you to specify a column name. # # Return value: # $row_count # The number of rows is stored in this variable. # Find upper bound on number of rows: check row numbers 1, 2, 4, 8, etc --let $_grc_max_row= 0 --let $_grc_min_row= 0 --let $_grc_row= 1 while ($_grc_max_row == 0) { if ($rpl_debug) { --echo row=$_grc_row min_row=$_grc_min_row max_row=$_grc_max_row } --let $_grc_result= query_get_value($statement, $column, $_grc_row) if ($_grc_result == 'No such row') { --let $_grc_max_row= $_grc_row } if ($_grc_result != 'No such row') { --let $_grc_min_row= $_grc_row --let $_grc_row= `SELECT $_grc_row * 2` } } # Binary search to find exact count. while (`SELECT $_grc_min_row + 1 < $_grc_max_row`) { if ($rpl_debug) { --echo row=$_grc_row min_row=$_grc_min_row max_row=$_grc_max_row } --let $_grc_row= `SELECT ($_grc_min_row + $_grc_max_row) DIV 2` --let $_grc_result= query_get_value($statement, $column, $_grc_row) if ($_grc_result == 'No such row') { --let $_grc_max_row= $_grc_row } if ($_grc_result != 'No such row') { --let $_grc_min_row= $_grc_row } } # Store result --let $row_count= $_grc_min_row