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
|
||||
@@ -20,13 +22,13 @@ if (!defined('ADODB_DIR')) die();
|
||||
Notice that PostgreSQL has no sql query cache
|
||||
*/
|
||||
class perf_postgres extends adodb_perf{
|
||||
|
||||
var $tablesSQL =
|
||||
|
||||
var $tablesSQL =
|
||||
"select a.relname as tablename,(a.relpages+CASE WHEN b.relpages is null THEN 0 ELSE b.relpages END+CASE WHEN c.relpages is null THEN 0 ELSE c.relpages END)*8 as size_in_K,a.relfilenode as \"OID\" from pg_class a left join pg_class b
|
||||
on b.relname = 'pg_toast_'||trim(a.relfilenode)
|
||||
on b.relname = 'pg_toast_'||trim(a.relfilenode)
|
||||
left join pg_class c on c.relname = 'pg_toast_'||trim(a.relfilenode)||'_index'
|
||||
where a.relname in (select tablename from pg_tables where tablename not like 'pg_%')";
|
||||
|
||||
|
||||
var $createTableSQL = "CREATE TABLE adodb_logsql (
|
||||
created timestamp NOT NULL,
|
||||
sql0 varchar(250) NOT NULL,
|
||||
@@ -34,8 +36,8 @@ class perf_postgres extends adodb_perf{
|
||||
params text NOT NULL,
|
||||
tracer text NOT NULL,
|
||||
timer decimal(16,6) NOT NULL
|
||||
)";
|
||||
|
||||
)";
|
||||
|
||||
var $settings = array(
|
||||
'Ratios',
|
||||
'statistics collector' => array('RATIO',
|
||||
@@ -86,45 +88,45 @@ class perf_postgres extends adodb_perf{
|
||||
'Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a>'),
|
||||
false
|
||||
);
|
||||
|
||||
function perf_postgres(&$conn)
|
||||
|
||||
function __construct(&$conn)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
}
|
||||
|
||||
var $optimizeTableLow = 'VACUUM %s';
|
||||
|
||||
var $optimizeTableLow = 'VACUUM %s';
|
||||
var $optimizeTableHigh = 'VACUUM ANALYZE %s';
|
||||
|
||||
/**
|
||||
* @see adodb_perf#optimizeTable
|
||||
*/
|
||||
|
||||
function optimizeTable($table, $mode = ADODB_OPT_LOW)
|
||||
function optimizeTable($table, $mode = ADODB_OPT_LOW)
|
||||
{
|
||||
if(! is_string($table)) return false;
|
||||
|
||||
|
||||
$conn = $this->conn;
|
||||
if (! $conn) return false;
|
||||
|
||||
|
||||
$sql = '';
|
||||
switch($mode) {
|
||||
case ADODB_OPT_LOW : $sql = $this->optimizeTableLow; break;
|
||||
case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break;
|
||||
default :
|
||||
default :
|
||||
{
|
||||
ADOConnection::outp(sprintf("<p>%s: '%s' using of undefined mode '%s'</p>", __CLASS__, 'optimizeTable', $mode));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$sql = sprintf($sql, $table);
|
||||
|
||||
return $conn->Execute($sql) !== false;
|
||||
|
||||
return $conn->Execute($sql) !== false;
|
||||
}
|
||||
|
||||
|
||||
function Explain($sql,$partial=false)
|
||||
{
|
||||
$save = $this->conn->LogSQL(false);
|
||||
|
||||
|
||||
if ($partial) {
|
||||
$sqlq = $this->conn->qstr($sql.'%');
|
||||
$arr = $this->conn->GetArray("select distinct distinct sql1 from adodb_logsql where sql1 like $sqlq");
|
||||
@@ -150,4 +152,3 @@ class perf_postgres extends adodb_perf{
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user