3v4l.org

run code in 300+ PHP versions simultaneously
Source for file saemysql.class.php Documentation is available at saemysql.class.php <?php /** * SAE Mysql服务 * * 支持主从分离 * * @author Easychen <easychen@gmail.com> * @version $Id$ * @package sae * */ /** * Sae Mysql Class * * <code> * <?php * $mysql = new SaeMysql(); * * $sql = "SELECT * FROM `user` LIMIT 10"; * $data = $mysql->getData( $sql ); * $name = strip_tags( $_REQUEST['name'] ); * $age = intval( $_REQUEST['age'] ); * $sql = "INSERT INTO `user` ( `name` , `age` , `regtime` ) VALUES ( '" . $mysql->escape( $name ) . "' , '" . intval( $age ) . "' , NOW() ) "; * $mysql->runSql( $sql ); * if( $mysql->errno() != 0 ) * { * die( "Error:" . $mysql->errmsg() ); * } * * $mysql->closeDb(); * ?> * </code> * * @package sae * @author EasyChen * */ class SaeMysql extends SaeObject { /** * 构造函数 * * @param bool $do_replication 是否支持主从分离,true:支持,false:不支持,默认为true * @return void * @author EasyChen */ function __construct( $do_replication = true ) { $this->port = 3307; $this->host = '.rdc.sae.sina.com.cn'; $this->accesskey = SAE_ACCESSKEY; $this->secretkey = SAE_SECRETKEY; $this->appname = 'app_' . $_SERVER['HTTP_APPNAME']; //set default charset as utf8 $this->charset = 'UTF8'; $this->do_replication = $do_replication; } /** * 设置keys * * 当需要连接其他APP的数据库时使用 * * @param string $akey AccessKey * @param string $skey SecretKey * @return void * @author EasyChen */ public function setAuth( $akey , $skey ) { $this->accesskey = $akey; $this->secretkey = $skey; } /** * 设置Mysql服务器端口 * * 当需要连接其他APP的数据库时使用 * * @param string $port * @return void * @author EasyChen */ public function setPort( $port ) { $this->port = 3307; $this->host = '.rdc.sae.sina.com.cn'; } /** * 设置Appname * * 当需要连接其他APP的数据库时使用 * * @param string $appname * @return void * @author EasyChen */ public function setAppname( $appname ) { $this->appname = 'app_' . $appname; } /** * 设置当前连接的字符集 , 必须在发起连接之前进行设置 * * @param string $charset 字符集,如GBK,GB2312,UTF8 * @return void */ public function setCharset( $charset ) { return $this->set_charset( $charset ); } /** * 同setCharset,向前兼容 * * @param string $charset * @return void * @ignore */ public function set_charset( $charset ) { $this->charset = $charset; } /** * 运行Sql语句,不返回结果集 * * @param string $sql * @return mysqli_result|bool */ public function runSql( $sql ) { return $this->run_sql( $sql ); } /** * 同runSql,向前兼容 * * @param string $sql * @return bool * @author EasyChen * @ignore */ public function run_sql( $sql ) { $this->last_sql = $sql; $dblink = $this->db_write(); if ($dblink === false) { return false; } $ret = mysqli_query( $dblink, $sql ); $this->save_error( $dblink ); return $ret; } /** * 运行Sql,以多维数组方式返回结果集 * * @param string $sql * @return array 成功返回数组,失败时返回false * @author EasyChen */ public function getData( $sql ) { return $this->get_data( $sql ); } /** * 同getData,向前兼容 * * @ignore */ public function get_data( $sql ) { $this->last_sql = $sql; $data = Array(); $i = 0; $dblink = $this->do_replication ? $this->db_read() : $this->db_write(); if ($dblink === false) { return false; } $result = mysqli_query( $dblink , $sql ); $this->save_error( $dblink ); if (is_bool($result)) { return $result; } else { while( $Array = mysqli_fetch_array( $result, MYSQL_ASSOC ) ) { $data[$i++] = $Array; } } mysqli_free_result($result); if( count( $data ) > 0 ) return $data; else return NULL; } /** * 运行Sql,以数组方式返回结果集第一条记录 * * @param string $sql * @return array 成功返回数组,失败时返回false * @author EasyChen */ public function getLine( $sql ) { return $this->get_line( $sql ); } /** * 同getLine,向前兼容 * * @param string $sql * @return array * @author EasyChen * @ignore */ public function get_line( $sql ) { $data = $this->get_data( $sql ); if ($data) { return @reset($data); } else { return false; } } /** * 运行Sql,返回结果集第一条记录的第一个字段值 * * @param string $sql * @return mixxed 成功时返回一个值,失败时返回false * @author EasyChen */ public function getVar( $sql ) { return $this->get_var( $sql ); } /** * 同getVar,向前兼容 * * @param string $sql * @return array * @author EasyChen * @ignore */ public function get_var( $sql ) { $data = $this->get_line( $sql ); if ($data) { return $data[ @reset(@array_keys( $data )) ]; } else { return false; } } /** * 同mysqli_affected_rows函数 * * @return int 成功返回行数,失败时返回-1 * @author Elmer Zhang */ public function affectedRows() { $result = isset($this->db_write) ? mysqli_affected_rows( $this->db_write ) : -1; return $result; } /** * 同mysqli_insert_id函数 * * @return int 成功返回last_id,失败时返回false * @author EasyChen */ public function lastId() { return $this->last_id(); } /** * 同lastId,向前兼容 * * @return int * @author EasyChen * @ignore */ public function last_id() { $result = mysqli_insert_id( $this->db_write( false ) ); return $result; } /** * 关闭数据库连接 * * @return bool * @author EasyChen */ public function closeDb() { return $this->close_db(); } /** * 同closeDb,向前兼容 * * @return bool * @author EasyChen * @ignore */ public function close_db() { if( isset( $this->db_read ) ) @mysqli_close( $this->db_read ); if( isset( $this->db_write ) ) @mysqli_close( $this->db_write ); } /** * 同mysqli_real_escape_string * * @param string $str * @return string * @author EasyChen */ public function escape( $str ) { if( isset($this->db_read) ) { $db = $this->db_read; } elseif( isset($this->db_write) ) { $db = $this->db_write; } else { $db = $this->db_read(); } return mysqli_real_escape_string( $db , $str ); } /** * 返回错误码 * * * @return int * @author EasyChen */ public function errno() { return $this->errno; } /** * 返回错误信息 * * @return string * @author EasyChen */ public function error() { return $this->error; } /** * 返回错误信息,error的别名 * * @return string * @author EasyChen */ public function errmsg() { return $this->error(); } /** * @ignore */ private function connect( $is_master = true ) { if ($this->port == 0) { $this->error = 13048; $this->errno = 'Not Initialized'; return false; } if( $is_master ) $host = 'w' . $this->host; else $host = 'r' . $this->host; $db = mysqli_init(); mysqli_options($db, MYSQLI_OPT_CONNECT_TIMEOUT, 5); if( !mysqli_real_connect( $db, $host , $this->accesskey , $this->secretkey , $this->appname , $this->port ) ) { $this->error = mysqli_connect_error(); $this->errno = mysqli_connect_errno(); return false; } mysqli_set_charset( $db, $this->charset); return $db; } /** * @ignore */ private function db_read() { if( isset( $this->db_read ) && mysqli_ping( $this->db_read ) ) { return $this->db_read; } else { if( !$this->do_replication ) return $this->db_write(); else { $this->db_read = $this->connect( false ); return $this->db_read; } } } /** * @ignore */ private function db_write( $reconnect = true ) { if( isset( $this->db_write ) && ( $reconnect == false || mysqli_ping( $this->db_write ) ) ) { return $this->db_write; } else { $this->db_write = $this->connect( true ); return $this->db_write; } } /** * @ignore */ private function save_error($dblink) { $this->error = mysqli_error($dblink); $this->errno = mysqli_errno($dblink); } private $error; private $errno; private $last_sql; } //Documentation generated on Tue, 25 Feb 2014 21:24:45 +0800 by phpDocumentor 1.4.3 $mysql = new SaeMysql();//sae内部类链接数据 $num = "SELECT * FROM `message` "; $mysql->runSql($num); $no=$mysql->affectedRows();//获取行数 echo $no; printf($no);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  (null)
number of ops:  17
compiled vars:  !0 = $mysql, !1 = $num, !2 = $no
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     'Source+for+file+saemysql.class.php%0A%0ADocumentation+is+available+at+saemysql.class.php%0A%0A'
   43     1        DECLARE_CLASS                                            'saemysql', 'saeobject'
  481     2        NEW                                              $3      'SaeMysql'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
  482     5        ASSIGN                                                   !1, 'SELECT+%2A+FROM+%60message%60+'
  483     6        INIT_METHOD_CALL                                         !0, 'runSql'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
  484     9        INIT_METHOD_CALL                                         !0, 'affectedRows'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !2, $8
  485    12        ECHO                                                     !2
  486    13        INIT_FCALL                                               'printf'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class SaeMysql:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  __construct
number of ops:  21
compiled vars:  !0 = $do_replication
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV_INIT                                        !0      <true>
   55     1        ASSIGN_OBJ                                               'port'
          2        OP_DATA                                                  3307
   56     3        ASSIGN_OBJ                                               'host'
          4        OP_DATA                                                  '.rdc.sae.sina.com.cn'
   58     5        FETCH_CONSTANT                                   ~4      'SAE_ACCESSKEY'
          6        ASSIGN_OBJ                                               'accesskey'
          7        OP_DATA                                                  ~4
   59     8        FETCH_CONSTANT                                   ~6      'SAE_SECRETKEY'
          9        ASSIGN_OBJ                                               'secretkey'
         10        OP_DATA                                                  ~6
   60    11        FETCH_R                      global              ~8      '_SERVER'
         12        FETCH_DIM_R                                      ~9      ~8, 'HTTP_APPNAME'
         13        CONCAT                                           ~10     'app_', ~9
         14        ASSIGN_OBJ                                               'appname'
         15        OP_DATA                                                  ~10
   63    16        ASSIGN_OBJ                                               'charset'
         17        OP_DATA                                                  'UTF8'
   65    18        ASSIGN_OBJ                                               'do_replication'
         19        OP_DATA                                                  !0
   66    20      > RETURN                                                   null

End of function __construct

Function setauth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  setAuth
number of ops:  7
compiled vars:  !0 = $akey, !1 = $skey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   78     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   80     2        ASSIGN_OBJ                                               'accesskey'
          3        OP_DATA                                                  !0
   81     4        ASSIGN_OBJ                                               'secretkey'
          5        OP_DATA                                                  !1
   82     6      > RETURN                                                   null

End of function setauth

Function setport:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  setPort
number of ops:  6
compiled vars:  !0 = $port
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E >   RECV                                             !0      
   95     1        ASSIGN_OBJ                                               'port'
          2        OP_DATA                                                  3307
   96     3        ASSIGN_OBJ                                               'host'
          4        OP_DATA                                                  '.rdc.sae.sina.com.cn'
   98     5      > RETURN                                                   null

End of function setport

Function setappname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  setAppname
number of ops:  5
compiled vars:  !0 = $appname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  109     0  E >   RECV                                             !0      
  111     1        CONCAT                                           ~2      'app_', !0
          2        ASSIGN_OBJ                                               'appname'
          3        OP_DATA                                                  ~2
  112     4      > RETURN                                                   null

End of function setappname

Function setcharset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  setCharset
number of ops:  6
compiled vars:  !0 = $charset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  121     0  E >   RECV                                             !0      
  123     1        INIT_METHOD_CALL                                         'set_charset'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  124     5*     > RETURN                                                   null

End of function setcharset

Function set_charset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  set_charset
number of ops:  4
compiled vars:  !0 = $charset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  133     0  E >   RECV                                             !0      
  135     1        ASSIGN_OBJ                                               'charset'
          2        OP_DATA                                                  !0
  136     3      > RETURN                                                   null

End of function set_charset

Function runsql:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  runSql
number of ops:  6
compiled vars:  !0 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  144     0  E >   RECV                                             !0      
  146     1        INIT_METHOD_CALL                                         'run_sql'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  147     5*     > RETURN                                                   null

End of function runsql

Function run_sql:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  run_sql
number of ops:  19
compiled vars:  !0 = $sql, !1 = $dblink, !2 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  157     0  E >   RECV                                             !0      
  159     1        ASSIGN_OBJ                                               'last_sql'
          2        OP_DATA                                                  !0
  160     3        INIT_METHOD_CALL                                         'db_write'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
  161     6        TYPE_CHECK                                    4          !1
          7      > JMPZ                                                     ~6, ->9
  162     8    > > RETURN                                                   <false>
  164     9    >   INIT_FCALL_BY_NAME                                       'mysqli_query'
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $7      
         13        ASSIGN                                                   !2, $7
  165    14        INIT_METHOD_CALL                                         'save_error'
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
  166    17      > RETURN                                                   !2
  167    18*     > RETURN                                                   null

End of function run_sql

Function getdata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  getData
number of ops:  6
compiled vars:  !0 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  176     0  E >   RECV                                             !0      
  178     1        INIT_METHOD_CALL                                         'get_data'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  179     5*     > RETURN                                                   null

End of function getdata

Function get_data:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 31
Branch analysis from position: 41
Branch analysis from position: 31
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
Branch analysis from position: 18
filename:       /in/asU43
function name:  get_data
number of ops:  51
compiled vars:  !0 = $sql, !1 = $data, !2 = $i, !3 = $dblink, !4 = $result, !5 = $Array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  186     0  E >   RECV                                             !0      
  188     1        ASSIGN_OBJ                                               'last_sql'
          2        OP_DATA                                                  !0
  189     3        ASSIGN                                                   !1, <array>
  190     4        ASSIGN                                                   !2, 0
  191     5        FETCH_OBJ_R                                      ~9      'do_replication'
          6      > JMPZ                                                     ~9, ->11
          7    >   INIT_METHOD_CALL                                         'db_read'
          8        DO_FCALL                                      0  $10     
          9        QM_ASSIGN                                        ~11     $10
         10      > JMP                                                      ->14
         11    >   INIT_METHOD_CALL                                         'db_write'
         12        DO_FCALL                                      0  $12     
         13        QM_ASSIGN                                        ~11     $12
         14    >   ASSIGN                                                   !3, ~11
  192    15        TYPE_CHECK                                    4          !3
         16      > JMPZ                                                     ~14, ->18
  193    17    > > RETURN                                                   <false>
  195    18    >   INIT_FCALL_BY_NAME                                       'mysqli_query'
         19        SEND_VAR_EX                                              !3
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $15     
         22        ASSIGN                                                   !4, $15
  197    23        INIT_METHOD_CALL                                         'save_error'
         24        SEND_VAR_EX                                              !3
         25        DO_FCALL                                      0          
  199    26        TYPE_CHECK                                   12          !4
         27      > JMPZ                                                     ~18, ->30
  200    28    > > RETURN                                                   !4
         29*       JMP                                                      ->41
  202    30    > > JMP                                                      ->34
  204    31    >   POST_INC                                         ~19     !2
         32        ASSIGN_DIM                                               !1, ~19
         33        OP_DATA                                                  !5
  202    34    >   INIT_FCALL_BY_NAME                                       'mysqli_fetch_array'
         35        SEND_VAR_EX                                              !4
         36        FETCH_CONSTANT                                   ~21     'MYSQL_ASSOC'
         37        SEND_VAL_EX                                              ~21
         38        DO_FCALL                                      0  $22     
         39        ASSIGN                                           ~23     !5, $22
         40      > JMPNZ                                                    ~23, ->31
  208    41    >   INIT_FCALL_BY_NAME                                       'mysqli_free_result'
         42        SEND_VAR_EX                                              !4
         43        DO_FCALL                                      0          
  210    44        COUNT                                            ~25     !1
         45        IS_SMALLER                                               0, ~25
         46      > JMPZ                                                     ~26, ->49
  211    47    > > RETURN                                                   !1
         48*       JMP                                                      ->50
  213    49    > > RETURN                                                   null
  214    50*     > RETURN                                                   null

End of function get_data

Function getline:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  getLine
number of ops:  6
compiled vars:  !0 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  223     0  E >   RECV                                             !0      
  225     1        INIT_METHOD_CALL                                         'get_line'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  226     5*     > RETURN                                                   null

End of function getline

Function get_line:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  get_line
number of ops:  15
compiled vars:  !0 = $sql, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  236     0  E >   RECV                                             !0      
  238     1        INIT_METHOD_CALL                                         'get_data'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !1, $2
  239     5      > JMPZ                                                     !1, ->13
  240     6    >   BEGIN_SILENCE                                    ~4      
          7        INIT_FCALL                                               'reset'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                         $5      
         10        END_SILENCE                                              ~4
         11      > RETURN                                                   $5
         12*       JMP                                                      ->14
  242    13    > > RETURN                                                   <false>
  244    14*     > RETURN                                                   null

End of function get_line

Function getvar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  getVar
number of ops:  6
compiled vars:  !0 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  253     0  E >   RECV                                             !0      
  255     1        INIT_METHOD_CALL                                         'get_var'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
  256     5*     > RETURN                                                   null

End of function getvar

Function get_var:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  get_var
number of ops:  21
compiled vars:  !0 = $sql, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  266     0  E >   RECV                                             !0      
  268     1        INIT_METHOD_CALL                                         'get_line'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !1, $2
  269     5      > JMPZ                                                     !1, ->19
  270     6    >   BEGIN_SILENCE                                    ~4      
          7        INIT_FCALL                                               'reset'
          8        BEGIN_SILENCE                                    ~5      
          9        INIT_FCALL                                               'array_keys'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        END_SILENCE                                              ~5
         13        SEND_VAR_NO_REF                               0          $6
         14        DO_ICALL                                         $7      
         15        END_SILENCE                                              ~4
         16        FETCH_DIM_R                                      ~8      !1, $7
         17      > RETURN                                                   ~8
         18*       JMP                                                      ->20
  272    19    > > RETURN                                                   <false>
  274    20*     > RETURN                                                   null

End of function get_var

Function affectedrows:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  affectedRows
number of ops:  13
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  284     0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'db_write'
          1      > JMPZ                                                     ~1, ->9
          2    >   INIT_FCALL_BY_NAME                                       'mysqli_affected_rows'
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $2      'db_write'
          5        SEND_FUNC_ARG                                            $2
          6        DO_FCALL                                      0  $3      
          7        QM_ASSIGN                                        ~4      $3
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~4      -1
         10    >   ASSIGN                                                   !0, ~4
  285    11      > RETURN                                                   !0
  286    12*     > RETURN                                                   null

End of function affectedrows

Function lastid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  lastId
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  296     0  E >   INIT_METHOD_CALL                                         'last_id'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
  297     3*     > RETURN                                                   null

End of function lastid

Function last_id:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  last_id
number of ops:  9
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  308     0  E >   INIT_FCALL_BY_NAME                                       'mysqli_insert_id'
          1        INIT_METHOD_CALL                                         'db_write'
          2        SEND_VAL_EX                                              <false>
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR_NO_REF_EX                                       $1
          5        DO_FCALL                                      0  $2      
          6        ASSIGN                                                   !0, $2
  309     7      > RETURN                                                   !0
  310     8*     > RETURN                                                   null

End of function last_id

Function closedb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  closeDb
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  320     0  E >   INIT_METHOD_CALL                                         'close_db'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
  321     3*     > RETURN                                                   null

End of function closedb

Function close_db:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/asU43
function name:  close_db
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  332     0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'db_read'
          1      > JMPZ                                                     ~0, ->9
  333     2    >   BEGIN_SILENCE                                    ~1      
          3        INIT_FCALL_BY_NAME                                       'mysqli_close'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_OBJ_FUNC_ARG                               $2      'db_read'
          6        SEND_FUNC_ARG                                            $2
          7        DO_FCALL                                      0          
          8        END_SILENCE                                              ~1
  335     9    >   ISSET_ISEMPTY_PROP_OBJ                                   'db_write'
         10      > JMPZ                                                     ~4, ->18
  336    11    >   BEGIN_SILENCE                                    ~5      
         12        INIT_FCALL_BY_NAME                                       'mysqli_close'
         13        CHECK_FUNC_ARG                                           
         14        FETCH_OBJ_FUNC_ARG                               $6      'db_write'
         15        SEND_FUNC_ARG                                            $6
         16        DO_FCALL                                      0          
         17        END_SILENCE                                              ~5
  338    18    > > RETURN                                                   null

End of function close_db

Function escape:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/asU43
function name:  escape
number of ops:  20
compiled vars:  !0 = $str, !1 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  347     0  E >   RECV                                             !0      
  349     1        ISSET_ISEMPTY_PROP_OBJ                                   'db_read'
          2      > JMPZ                                                     ~2, ->6
  350     3    >   FETCH_OBJ_R                                      ~3      'db_read'
          4        ASSIGN                                                   !1, ~3
          5      > JMP                                                      ->14
  351     6    >   ISSET_ISEMPTY_PROP_OBJ                                   'db_write'
          7      > JMPZ                                                     ~5, ->11
  352     8    >   FETCH_OBJ_R                                      ~6      'db_write'
          9        ASSIGN                                                   !1, ~6
         10      > JMP                                                      ->14
  354    11    >   INIT_METHOD_CALL                                         'db_read'
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !1, $8
  357    14    >   INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         15        SEND_VAR

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.54 ms | 1428 KiB | 19 Q