3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * This is a simple sql tokenizer / parser. * * It does NOT support multiline comments at this time. * * See the included example.php for usage. * * THIS CODE IS A PROTOTYPE/BETA * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @version 0.0.4 */ class SqlParser { var $handle = null; // statements public static $querysections = array('alter','create','drop', 'select', 'delete', 'insert', 'update', 'from', 'where', 'limit', 'order'); // operators public static $operators = array('=', '<>', '<', '<=', '>', '>=', 'like', 'clike', 'slike', 'not', 'is', 'in', 'between'); // types public static $types = array('character', 'char', 'varchar', 'nchar', 'bit', 'numeric', 'decimal', 'dec', 'integer', 'int', 'smallint', 'float', 'real', 'double', 'date', 'datetime', 'time', 'timestamp', 'interval', 'bool', 'boolean', 'set', 'enum', 'text'); // conjuctions public static $conjuctions = array('by', 'as', 'on', 'into', 'from', 'where', 'with'); // basic functions public static $funcitons = array('avg', 'count', 'max', 'min', 'sum', 'nextval', 'currval', 'concat', ); // reserved keywords public static $reserved = array('absolute', 'action', 'add', 'all', 'allocate', 'and', 'any', 'are', 'asc', 'ascending', 'assertion', 'at', 'authorization', 'begin', 'bit_length', 'both', 'cascade', 'cascaded', 'case', 'cast', 'catalog', 'char_length', 'character_length', 'check', 'close', 'coalesce', 'collate', 'collation', 'column', 'commit', 'connect', 'connection', 'constraint', 'constraints', 'continue', 'convert', 'corresponding', 'cross', 'current', 'current_date', 'current_time', 'current_timestamp', 'current_user', 'cursor', 'day', 'deallocate', 'declare', 'default', 'deferrable', 'deferred', 'desc', 'descending', 'describe', 'descriptor', 'diagnostics', 'disconnect', 'distinct', 'domain', 'else', 'end', 'end-exec', 'escape', 'except', 'exception', 'exec', 'execute', 'exists', 'external', 'extract', 'false', 'fetch', 'first', 'for', 'foreign', 'found', 'full', 'get', 'global', 'go', 'goto', 'grant', 'group', 'having', 'hour', 'identity', 'immediate', 'indicator', 'initially', 'inner', 'input', 'insensitive', 'intersect', 'isolation', 'join', 'key', 'language', 'last', 'leading', 'left', 'level', 'limit', 'local', 'lower', 'match', 'minute', 'module', 'month', 'names', 'national', 'natural', 'next', 'no', 'null', 'nullif', 'octet_length', 'of', 'only', 'open', 'option', 'or', 'order', 'outer', 'output', 'overlaps', 'pad', 'partial', 'position', 'precision', 'prepare', 'preserve', 'primary', 'prior', 'privileges', 'procedure', 'public', 'read', 'references', 'relative', 'restrict', 'revoke', 'right', 'rollback', 'rows', 'schema', 'scroll', 'second', 'section', 'session', 'session_user', 'size', 'some', 'space', 'sql', 'sqlcode', 'sqlerror', 'sqlstate', 'substring', 'system_user', 'table', 'temporary', 'then', 'timezone_hour', 'timezone_minute', 'to', 'trailing', 'transaction', 'translate', 'translation', 'trim', 'true', 'union', 'unique', 'unknown', 'upper', 'usage', 'user', 'using', 'value', 'values', 'varying', 'view', 'when', 'whenever', 'work', 'write', 'year', 'zone', 'eoc'); // open parens, tokens, and brackets public static $startparens = array('{', '('); public static $endparens = array('}', ')'); public static $tokens = array(',', ' '); private $query = ''; // constructor (placeholder only) public function __construct() { } /** * Simple SQL Tokenizer * * @author Justin Carlson <justin.carlson@gmail.com> * @license GPL * @param string $sqlQuery * @return token array */ public static function Tokenize($sqlQuery, $cleanWhitespace = true) { /** * Strip extra whitespace from the query */ if ($cleanWhitespace === true) { $sqlQuery = ltrim(preg_replace('/[\\s]{2,}/', ' ', $sqlQuery)); } /** * Regular expression parsing. * Inspired/Based on the Perl SQL::Tokenizer by Igor Sutton Lopes */ // begin group $regex = '('; // inline comments $regex .= '(?:--|\\#)[\\ \\t\\S]*'; // logical operators $regex .= '|(?:<>|<=>|>=|<=|==|=|!=|!|<<|>>|<|>|\\|\\||\\||&&|&|-'; $regex .= '|\\+|\\*(?!\/)|\/(?!\\*)|\\%|~|\\^|\\?)'; // empty quotes $regex .= '|[\\[\\]\\(\\),;`]|\\\'\\\'(?!\\\')|\\"\\"(?!\\"")'; // string quotes $regex .= '|".*?(?:(?:""){1,}"'; $regex .= '|(?<!["\\\\])"(?!")|\\\\"{2})'; $regex .= '|\'.*?(?:(?:\'\'){1,}\''; $regex .= '|(?<![\'\\\\])\'(?!\')'; $regex .= '|\\\\\'{2})'; // c comments $regex .= '|\/\\*[\\ \\t\\n\\S]*?\\*\/'; // wordds, column strings, params $regex .= '|(?:[\\w:@]+(?:\\.(?:\\w+|\\*)?)*)'; $regex .= '|[\t\ ]+'; // period and whitespace $regex .= '|[\.]'; $regex .= '|[\s]'; $regex .= ')'; # end group // perform a global match preg_match_all('/' . $regex . '/smx', $sqlQuery, $result); // return tokens return $result[0]; } /** * Simple SQL Parser * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @param string $sqlQuery * @param bool optional $cleanup * @return SqlParser Object */ public static function ParseString($sqlQuery, $cleanWhitespace = true) { // instantiate if called statically if (!isset($this)) { $handle = new SqlParser(); } else { $handle = $this; } // copy and tokenize the query $tokens = self::Tokenize($sqlQuery, $cleanWhitespace); $tokenCount = count($tokens); $queryParts = array(); if (isset($tokens[0])===true) { $section = $tokens[0]; } // parse the tokens for ($t = 0; $t < $tokenCount; $t++) { // if is paren if (in_array($tokens[$t], self::$startparens)) { // read until closed $sub = $handle->readsub($tokens, $t); $handle->query[$section].= $sub; } else { if (in_array(strtolower($tokens[$t]), self::$querysections) && !isset($handle->query[$tokens[$t]])) { $section = strtolower($tokens[$t]); } // rebuild the query in sections if (!isset($handle->query[$section])) $handle->query[$section] = ''; $handle->query[$section] .= $tokens[$t]; } } return $handle; } /** * Parses a sub-section of a query * * @param array $tokens * @param int $position * @return string section */ private function readsub($tokens, &$position) { $sub = $tokens[$position]; $tokenCount = count($tokens); $position++; while (!in_array($tokens[$position], self::$endparens) && $position < $tokenCount) { if (in_array($tokens[$position], self::$startparens)) { $sub.= $this->readsub($tokens, $position); $subs++; } else { $sub.= $tokens[$position]; } $position++; } $sub.= $tokens[$position]; return $sub; } /** * Returns manipulated sql to get the number of rows in the query. * Can be used for simple pagination, for example. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getCountQuery($optName = 'count') { // create temp copy of query $temp = $this->query; // create count() version of select and unset any limit statement $temp['select'] = 'select count(*) as `'.$optName.'` '; if (isset($temp['limit'])) { unset($temp['limit']); } return implode(null, $temp); } /** * Returns manipulated sql to get the unlimited number of rows in the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getLimitedCountQuery() { $this->query['select'] = 'select count(*) as `count` '; return implode('', $this->query); } /** * Returns the select section of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getSelectStatement() { return $this->query['select']; } /** * Returns the from section of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getFromStatement() { return $this->query['from']; } /** * Returns the where section of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getWhereStatement() { return $this->query['where']; } /** * Returns the limit section of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getLimitStatement() { return $this->query['limit']; } /** * Returns the specified section of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function get($which) { if (!isset($this->query[$which])) return false; return $this->query[$which]; } /** * Returns the sections of the query. * * @author Justin Carlson <justin.carlson@gmail.com> * @license LGPL 3 * @return string sql */ public function getArray() { return $this->query; } } /** * Note: The closing tag of a PHP block at the end of a file is optional, * and in some cases omitting it is helpful when using include() or require(), * so unwanted whitespace will not occur at the end of files */ print "<pre>"; print_r(SqlParser::ParseString( 'SELECT name, rew from asdf where id in(select papa from sdfff')); print "</pre>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  369     0  E >   ECHO                                                     '%3Cpre%3E'
  370     1        INIT_FCALL                                               'print_r'
          2        INIT_STATIC_METHOD_CALL                                  'SqlParser', 'ParseString'
          3        SEND_VAL                                                 'SELECT+name%2C+rew+from+asdf+where+id+in%28select+papa++from+sdfff'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
  371     7        ECHO                                                     '%3C%2Fpre%3E'
          8      > RETURN                                                   1

Class SqlParser:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E > > RETURN                                                   null

End of function __construct

Function tokenize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/oTIGk
function name:  Tokenize
number of ops:  39
compiled vars:  !0 = $sqlQuery, !1 = $cleanWhitespace, !2 = $regex, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  120     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
  125     2        TYPE_CHECK                                    8          !1
          3      > JMPZ                                                     ~4, ->13
  126     4    >   INIT_FCALL                                               'ltrim'
          5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2F%5B%5Cs%5D%7B2%2C%7D%2F'
          7        SEND_VAL                                                 '+'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !0, $6
  135    13    >   ASSIGN                                                   !2, '%28'
  138    14        ASSIGN_OP                                     8          !2, '%28%3F%3A--%7C%5C%23%29%5B%5C+%5Ct%5CS%5D%2A'
  141    15        ASSIGN_OP                                     8          !2, '%7C%28%3F%3A%3C%3E%7C%3C%3D%3E%7C%3E%3D%7C%3C%3D%7C%3D%3D%7C%3D%7C%21%3D%7C%21%7C%3C%3C%7C%3E%3E%7C%3C%7C%3E%7C%5C%7C%5C%7C%7C%5C%7C%7C%26%26%7C%26%7C-'
  142    16        ASSIGN_OP                                     8          !2, '%7C%5C%2B%7C%5C%2A%28%3F%21%5C%2F%29%7C%5C%2F%28%3F%21%5C%2A%29%7C%5C%25%7C%7E%7C%5C%5E%7C%5C%3F%29'
  145    17        ASSIGN_OP                                     8          !2, '%7C%5B%5C%5B%5C%5D%5C%28%5C%29%2C%3B%60%5D%7C%5C%27%5C%27%28%3F%21%5C%27%29%7C%5C%22%5C%22%28%3F%21%5C%22%22%29'
  148    18        ASSIGN_OP                                     8          !2, '%7C%22.%2A%3F%28%3F%3A%28%3F%3A%22%22%29%7B1%2C%7D%22'
  149    19        ASSIGN_OP                                     8          !2, '%7C%28%3F%3C%21%5B%22%5C%5C%5D%29%22%28%3F%21%22%29%7C%5C%5C%22%7B2%7D%29'
  150    20        ASSIGN_OP                                     8          !2, '%7C%27.%2A%3F%28%3F%3A%28%3F%3A%27%27%29%7B1%2C%7D%27'
  151    21        ASSIGN_OP                                     8          !2, '%7C%28%3F%3C%21%5B%27%5C%5C%5D%29%27%28%3F%21%27%29'
  152    22        ASSIGN_OP                                     8          !2, '%7C%5C%5C%27%7B2%7D%29'
  155    23        ASSIGN_OP                                     8          !2, '%7C%5C%2F%5C%2A%5B%5C+%5Ct%5Cn%5CS%5D%2A%3F%5C%2A%5C%2F'
  158    24        ASSIGN_OP                                     8          !2, '%7C%28%3F%3A%5B%5Cw%3A%40%5D%2B%28%3F%3A%5C.%28%3F%3A%5Cw%2B%7C%5C%2A%29%3F%29%2A%29'
  159    25        ASSIGN_OP                                     8          !2, '%7C%5B%5Ct%5C+%5D%2B'
  162    26        ASSIGN_OP                                     8          !2, '%7C%5B%5C.%5D'
  163    27        ASSIGN_OP                                     8          !2, '%7C%5B%5Cs%5D'
  165    28        ASSIGN_OP                                     8          !2, '%29'
  168    29        INIT_FCALL                                               'preg_match_all'
         30        CONCAT                                           ~24     '%2F', !2
         31        CONCAT                                           ~25     ~24, '%2Fsmx'
         32        SEND_VAL                                                 ~25
         33        SEND_VAR                                                 !0
         34        SEND_REF                                                 !3
         35        DO_ICALL                                                 
  171    36        FETCH_DIM_R                                      ~27     !3, 0
         37      > RETURN                                                   ~27
  172    38*     > RETURN                                                   null

End of function tokenize

Function parsestring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 26
Branch analysis from position: 77
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 26
Branch analysis from position: 77
Branch analysis from position: 26
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 63
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 70
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 77, Position 2 = 26
Branch analysis from position: 77
Branch analysis from position: 26
Branch analysis from position: 70
Branch analysis from position: 63
Branch analysis from position: 57
Branch analysis from position: 24
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
Branch analysis from position: 24
filename:       /in/oTIGk
function name:  ParseString
number of ops:  79
compiled vars:  !0 = $sqlQuery, !1 = $cleanWhitespace, !2 = $handle, !3 = $tokens, !4 = $tokenCount, !5 = $queryParts, !6 = $section, !7 = $t, !8 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  183     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
  186     2        ISSET_ISEMPTY_THIS                               ~9      
          3        BOOL_NOT                                         ~10     ~9
          4      > JMPZ                                                     ~10, ->9
  187     5    >   NEW                                              $11     'SqlParser'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $11
          8      > JMP                                                      ->11
  189     9    >   FETCH_THIS                                       ~14     
         10        ASSIGN                                                   !2, ~14
  193    11    >   INIT_STATIC_METHOD_CALL                                  'Tokenize'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        DO_FCALL                                      0  $16     
         15        ASSIGN                                                   !3, $16
  194    16        COUNT                                            ~18     !3
         17        ASSIGN                                                   !4, ~18
  195    18        ASSIGN                                                   !5, <array>
  196    19        ISSET_ISEMPTY_DIM_OBJ                         0  ~21     !3, 0
         20        TYPE_CHECK                                    8          ~21
         21      > JMPZ                                                     ~22, ->24
  197    22    >   FETCH_DIM_R                                      ~23     !3, 0
         23        ASSIGN                                                   !6, ~23
  201    24    >   ASSIGN                                                   !7, 0
         25      > JMP                                                      ->75
  204    26    >   INIT_FCALL                                               'in_array'
         27        FETCH_DIM_R                                      ~26     !3, !7
         28        SEND_VAL                                                 ~26
         29        FETCH_STATIC_PROP_R          unknown             ~27     'startparens'
         30        SEND_VAL                                                 ~27
         31        DO_ICALL                                         $28     
         32      > JMPZ                                                     $28, ->42
  207    33    >   INIT_METHOD_CALL                                         !2, 'readsub'
         34        SEND_VAR_EX                                              !3
         35        SEND_VAR_EX                                              !7
         36        DO_FCALL                                      0  $29     
         37        ASSIGN                                                   !8, $29
  208    38        FETCH_OBJ_RW                                     $31     !2, 'query'
         39        ASSIGN_DIM_OP                .=               8          $31, !6
         40        OP_DATA                                                  !8
         41      > JMP                                                      ->74
  212    42    >   INIT_FCALL                                               'in_array'
         43        INIT_FCALL                                               'strtolower'
         44        FETCH_DIM_R                                      ~33     !3, !7
         45        SEND_VAL                                                 ~33
         46        DO_ICALL                                         $34     
         47        SEND_VAR                                                 $34
         48        FETCH_STATIC_PROP_R          unknown             ~35     'querysections'
         49        SEND_VAL                                                 ~35
         50        DO_ICALL                                         $36     
         51      > JMPZ_EX                                          ~37     $36, ->57
         52    >   FETCH_DIM_R                                      ~39     !3, !7
         53        FETCH_OBJ_IS                                     ~38     !2, 'query'
         54        ISSET_ISEMPTY_DIM_OBJ                         0  ~40     ~38, ~39
         55        BOOL_NOT                                         ~41     ~40
         56        BOOL                                             ~37     ~41
         57    > > JMPZ                                                     ~37, ->63
  213    58    >   INIT_FCALL                                               'strtolower'
         59        FETCH_DIM_R                                      ~42     !3, !7
         60        SEND_VAL                                                 ~42
         61        DO_ICALL                                         $43     
         62        ASSIGN                                                   !6, $43
  217    63    >   FETCH_OBJ_IS                                     ~45     !2, 'query'
         64        ISSET_ISEMPTY_DIM_OBJ                         0  ~46     ~45, !6
         65        BOOL_NOT                                         ~47     ~46
         66      > JMPZ                                                     ~47, ->70
  218    67    >   FETCH_OBJ_W                                      $48     !2, 'query'
         68        ASSIGN_DIM                                               $48, !6
         69        OP_DATA                                                  ''
  219    70    >   FETCH_DIM_R                                      ~52     !3, !7
         71        FETCH_OBJ_RW                                     $50     !2, 'query'
         72        ASSIGN_DIM_OP                .=               8          $50, !6
         73        OP_DATA                                                  ~52
  201    74    >   PRE_INC                                                  !7
         75    >   IS_SMALLER                                               !7, !4
         76      > JMPNZ                                                    ~54, ->26
  223    77    > > RETURN                                                   !2
  224    78*     > RETURN                                                   null

End of function parsestring

Function readsub:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 8
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
Branch analysis from position: 35
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
Branch analysis from position: 35
Branch analysis from position: 35
filename:       /in/oTIGk
function name:  readsub
number of ops:  40
compiled vars:  !0 = $tokens, !1 = $position, !2 = $sub, !3 = $tokenCount, !4 = $subs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  233     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  235     2        FETCH_DIM_R                                      ~5      !0, !1
          3        ASSIGN                                                   !2, ~5
  236     4        COUNT                                            ~7      !0
          5        ASSIGN                                                   !3, ~7
  237     6        PRE_INC                                                  !1
  238     7      > JMP                                                      ->25
  240     8    >   INIT_FCALL                                               'in_array'
          9        FETCH_DIM_R                                      ~10     !0, !1
         10        SEND_VAL                                                 ~10
         11        FETCH_STATIC_PROP_R          global lock         ~11     'startparens'
         12        SEND_VAL                                                 ~11
         13        DO_ICALL                                         $12     
         14      > JMPZ                                                     $12, ->22
  241    15    >   INIT_METHOD_CALL                                         'readsub'
         16        SEND_VAR                                                 !0
         17        SEND_REF                                                 !1
         18        DO_FCALL                                      0  $13     
         19        ASSIGN_OP                                     8          !2, $13
  242    20        PRE_INC                                                  !4
         21      > JMP                                                      ->24
  244    22    >   FETCH_DIM_R                                      ~16     !0, !1
         23        ASSIGN_OP                                     8          !2, ~16
  246    24    >   PRE_INC                                                  !1
  238    25    >   INIT_FCALL                                               'in_array'
         26        FETCH_DIM_R                                      ~19     !0, !1
         27        SEND_VAL                                                 ~19
         28        FETCH_STATIC_PROP_R          unknown             ~20     'endparens'
         29        SEND_VAL                                                 ~20
         30        DO_ICALL                                         $21     
         31        BOOL_NOT                                         ~22     $21
         32      > JMPZ_EX                                          ~22     ~22, ->35
         33    >   IS_SMALLER                                       ~23     !1, !3
         34        BOOL                                             ~22     ~23
         35    > > JMPNZ                                                    ~22, ->8
  248    36    >   FETCH_DIM_R                                      ~24     !0, !1
         37        ASSIGN_OP                                     8          !2, ~24
  249    38      > RETURN                                                   !2
  250    39*     > RETURN                                                   null

End of function readsub

Function getcountquery:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/oTIGk
function name:  getCountQuery
number of ops:  16
compiled vars:  !0 = $optName, !1 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  260     0  E >   RECV_INIT                                        !0      'count'
  263     1        FETCH_OBJ_R                                      ~2      'query'
          2        ASSIGN                                                   !1, ~2
  266     3        CONCAT                                           ~5      'select+count%28%2A%29+as+%60', !0
          4        CONCAT                                           ~6      ~5, '%60+'
          5        ASSIGN_DIM                                               !1, 'select'
          6        OP_DATA                                                  ~6
  267     7        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'limit'
          8      > JMPZ                                                     ~7, ->10
  268     9    >   UNSET_DIM                                                !1, 'limit'
  271    10    >   INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 null
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $8      
         14      > RETURN                                                   $8
  272    15*     > RETURN                                                   null

End of function getcountquery

Function getlimitedcountquery:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getLimitedCountQuery
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  283     0  E >   FETCH_OBJ_W                                      $0      'query'
          1        ASSIGN_DIM                                               $0, 'select'
          2        OP_DATA                                                  'select+count%28%2A%29+as+%60count%60+'
  284     3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 ''
          5        FETCH_OBJ_R                                      ~2      'query'
          6        SEND_VAL                                                 ~2
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
  285     9*     > RETURN                                                   null

End of function getlimitedcountquery

Function getselectstatement:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getSelectStatement
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  296     0  E >   FETCH_OBJ_R                                      ~0      'query'
          1        FETCH_DIM_R                                      ~1      ~0, 'select'
          2      > RETURN                                                   ~1
  297     3*     > RETURN                                                   null

End of function getselectstatement

Function getfromstatement:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getFromStatement
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  308     0  E >   FETCH_OBJ_R                                      ~0      'query'
          1        FETCH_DIM_R                                      ~1      ~0, 'from'
          2      > RETURN                                                   ~1
  309     3*     > RETURN                                                   null

End of function getfromstatement

Function getwherestatement:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getWhereStatement
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  320     0  E >   FETCH_OBJ_R                                      ~0      'query'
          1        FETCH_DIM_R                                      ~1      ~0, 'where'
          2      > RETURN                                                   ~1
  321     3*     > RETURN                                                   null

End of function getwherestatement

Function getlimitstatement:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getLimitStatement
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  332     0  E >   FETCH_OBJ_R                                      ~0      'query'
          1        FETCH_DIM_R                                      ~1      ~0, 'limit'
          2      > RETURN                                                   ~1
  333     3*     > RETURN                                                   null

End of function getlimitstatement

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  get
number of ops:  10
compiled vars:  !0 = $which
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  342     0  E >   RECV                                             !0      
  344     1        FETCH_OBJ_IS                                     ~1      'query'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->6
  345     5    > > RETURN                                                   <false>
  346     6    >   FETCH_OBJ_R                                      ~4      'query'
          7        FETCH_DIM_R                                      ~5      ~4, !0
          8      > RETURN                                                   ~5
  347     9*     > RETURN                                                   null

End of function get

Function getarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oTIGk
function name:  getArray
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  358     0  E >   FETCH_OBJ_R                                      ~0      'query'
          1      > RETURN                                                   ~0
  359     2*     > RETURN                                                   null

End of function getarray

End of class SqlParser.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.93 ms | 1412 KiB | 27 Q