adodb 최신버전으로 변경
<? 를 <?php 로 변경
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
V5.09 25 June 2009 (c) 2000-2009 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
/*
|
||||
@version v5.20.9 21-Dec-2016
|
||||
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
|
||||
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
|
||||
Released under both BSD license and Lesser GPL library license.
|
||||
Whenever there is any discrepancy between the two licenses,
|
||||
the BSD license will take precedence. See License.txt.
|
||||
Set tabs to 4 for best viewing.
|
||||
|
||||
|
||||
Latest version is available at http://adodb.sourceforge.net
|
||||
|
||||
Library for basic performance monitoring and tuning
|
||||
|
||||
|
||||
Library for basic performance monitoring and tuning
|
||||
|
||||
*/
|
||||
|
||||
// security - hide paths
|
||||
@@ -29,7 +31,7 @@ class perf_mssql extends adodb_perf{
|
||||
tracer varchar(500) NOT NULL,
|
||||
timer decimal(16,6) NOT NULL
|
||||
)";
|
||||
|
||||
|
||||
var $settings = array(
|
||||
'Ratios',
|
||||
'data cache hit ratio' => array('RATIO',
|
||||
@@ -46,7 +48,7 @@ class perf_mssql extends adodb_perf{
|
||||
"select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page reads/sec'"),
|
||||
'data writes' => array('IO',
|
||||
"select cntr_value from master.dbo.sysperfinfo where counter_name = 'Page writes/sec'"),
|
||||
|
||||
|
||||
'Data Cache',
|
||||
'data cache size' => array('DATAC',
|
||||
"select cntr_value*8192 from master.dbo.sysperfinfo where counter_name = 'Total Pages' and object_name='SQLServer:Buffer Manager'",
|
||||
@@ -63,9 +65,9 @@ class perf_mssql extends adodb_perf{
|
||||
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
function perf_mssql(&$conn)
|
||||
|
||||
|
||||
function __construct(&$conn)
|
||||
{
|
||||
if ($conn->dataProvider == 'odbc') {
|
||||
$this->sql1 = 'sql1';
|
||||
@@ -73,10 +75,10 @@ class perf_mssql extends adodb_perf{
|
||||
}
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
|
||||
function Explain($sql,$partial=false)
|
||||
{
|
||||
|
||||
|
||||
$save = $this->conn->LogSQL(false);
|
||||
if ($partial) {
|
||||
$sqlq = $this->conn->qstr($sql.'%');
|
||||
@@ -88,18 +90,18 @@ class perf_mssql extends adodb_perf{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$s = '<p><b>Explain</b>: '.htmlspecialchars($sql).'</p>';
|
||||
$this->conn->Execute("SET SHOWPLAN_ALL ON;");
|
||||
$sql = str_replace('?',"''",$sql);
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
$rs = $this->conn->Execute($sql);
|
||||
//adodb_printr($rs);
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
if ($rs) {
|
||||
if ($rs && !$rs->EOF) {
|
||||
$rs->MoveNext();
|
||||
$s .= '<table bgcolor=white border=0 cellpadding="1" callspacing=0><tr><td nowrap align=center> Rows<td nowrap align=center> IO<td nowrap align=center> CPU<td align=left> Plan</tr>';
|
||||
while (!$rs->EOF) {
|
||||
@@ -107,20 +109,20 @@ class perf_mssql extends adodb_perf{
|
||||
$rs->MoveNext();
|
||||
}
|
||||
$s .= '</table>';
|
||||
|
||||
|
||||
$rs->NextRecordSet();
|
||||
}
|
||||
|
||||
|
||||
$this->conn->Execute("SET SHOWPLAN_ALL OFF;");
|
||||
$this->conn->LogSQL($save);
|
||||
$s .= $this->Tracer($sql);
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
function Tables()
|
||||
{
|
||||
global $ADODB_FETCH_MODE;
|
||||
|
||||
|
||||
$save = $ADODB_FETCH_MODE;
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
|
||||
//$this->conn->debug=1;
|
||||
@@ -142,23 +144,21 @@ class perf_mssql extends adodb_perf{
|
||||
$ADODB_FETCH_MODE = $save;
|
||||
return $s.'</table>';
|
||||
}
|
||||
|
||||
|
||||
function sp_who()
|
||||
{
|
||||
$arr = $this->conn->GetArray('sp_who');
|
||||
return sizeof($arr);
|
||||
}
|
||||
|
||||
|
||||
function HealthCheck($cli=false)
|
||||
{
|
||||
|
||||
|
||||
$this->conn->Execute('dbcc traceon(3604)');
|
||||
$html = adodb_perf::HealthCheck($cli);
|
||||
$this->conn->Execute('dbcc traceoff(3604)');
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user