note 37551 added to function.mysql-stat

From: Date: Wed, 19 Nov 2003 16:04:23 +0000
Subject: note 37551 added to function.mysql-stat
Groups: php.notes 
Request: Send a blank email to php-notes+get-60624@lists.php.net to get a copy of this message
ex class <?php // connect \\ class DateBaseServer { var $CloseSS ; var $ConnSQL ; var $SlDbSQL ; var $ConnDBs ; var $ConnStat ; var $DBS = array() ; function Add($Var,$Value) { $this->DBS[$Var] = $Value ; } function Connect() { $ConnQuery = $this->DBS['Serv'].$this->DBS['ConTp']; $ConnSeleD = $this->DBS['Serv'].'select_db'; $this->ConnSQL = $ConnQuery ("{$this->DBS['Host']}:{$this->DBS['Port']}", "{$this->DBS['User']}", "{$this->DBS['Pass']}") or die($this->DBS['Serv'].errno().': '.$this->DBS['Serv'].error()."\n"); $this->SlDbSQL = $ConnSeleD ("{$this->DBS['DBase']}",$this->ConnSQL) or die($this->DBS['Serv'].errno().': '.$this->DBS['Serv'].error()."\n"); return($this->ConnSQL) ; } function Stats($TypeStatus) { if($TypeStatus=='ConnGet') { $ConnGetS = $this->DBS['Serv'].'get_server_info' ; $ConnGetP = $this->DBS['Serv'].'get_proto_info' ; $ConnGetH = $this->DBS['Serv'].'get_host_info' ; $ConnGetC = $this->DBS['Serv'].'get_client_info' ; $ServGet[] = $this->DBS['Serv']."server version: " .$ConnGetS() ; $ServGet[] = $this->DBS['Serv']."protocol version: ".$ConnGetP() ; $ServGet[] = $this->DBS['Serv']."host info: " .$ConnGetH() ; $ServGet[] = $this->DBS['Serv']."client info: " .$ConnGetC() ; return(print_r($ServGet)) ; }else if($TypeStatus=='ConnStat') { $ConnStat = $this->DBS['Serv'].$this->DBS['Status'] ; $Result = explode(' ',$ConnStat($this->DBS['Link'])) ; return(print_r($Result)) ; }else if($TypeStatus=='ConnDBs') { $ConnDBs = $this->DBS['Serv'].'query' ; $ReslBDs = $this->DBS['Serv'].'fetch_array' ; $Result = $ConnDBs('SHOW INNODB STATUS') ; $Result = $ReslBDs($Result) ; $StrgBar = str_pad('',60,'-',STR_PAD_BOTH) ; return(print($StrgBar.$Result['Status'])) ; }else if($TypeStatus=='ConnLst') { $ConnLstP = $this->DBS['Serv'].'list_processes' ; $ConnLstA = $this->DBS['Serv'].'fetch_assoc' ; $ConnLstF = $this->DBS['Serv'].'free_result' ; $Results = $ConnLstP($this->DBS['Link']) ; @$ConnLstF ($Result) ; while ($row = $ConnLstA($Results)) {$Process[] = $row["Id"].' '.$row["Host"].' '.$row["db"].' '.$row["Command"].' '.$row["Time"];} return(print_r($Process)) ; } } // call class \\ $Connect = new DateBaseServer ; $Connect->Add('Host' ,'localhost') ; $Connect->Add('Port' ,'3306') ; $Connect->Add('User' ,'dtbase') ; $Connect->Add('Pass' ,'mypass') ; $Connect->Add('DBase' ,'dtbase') ; $Connect->Add('Serv' ,'mysql_') ; // u can change other db server (...) $Connect->Add('ConTp' ,'connect') ; $Connect->Add('Status' ,'stat') ; $ConnSQL = $Connect->Connect() ; $Connect->Add('Link',$ConnSQL) ; ?> ---- Manual Page -- http://www.php.net/manual/en/function.mysql-stat.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37551 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37551&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37551&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60624) next »