当前位置: 首页>>代码示例>>PHP>>正文


PHP adodb_perf::table方法代码示例

本文整理汇总了PHP中adodb_perf::table方法的典型用法代码示例。如果您正苦于以下问题:PHP adodb_perf::table方法的具体用法?PHP adodb_perf::table怎么用?PHP adodb_perf::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在adodb_perf的用法示例。


在下文中一共展示了adodb_perf::table方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clearsql

 function clearsql()
 {
     $perf_table = adodb_perf::table();
     // using the naive "delete from $perf_table where created<".$this->conn->sysTimeStamp will cause the table to lock, possibly
     // for a long time
     $sql = "DECLARE cnt pls_integer;\r\nBEGIN\r\n\tcnt := 0;\r\n\tFOR rec IN (SELECT ROWID AS rr FROM {$perf_table} WHERE created<SYSDATE) \r\n\tLOOP\r\n\t  cnt := cnt + 1;\r\n\t  DELETE FROM {$perf_table} WHERE ROWID=rec.rr;\r\n\t  IF cnt = 1000 THEN\r\n\t  \tCOMMIT;\r\n\t\tcnt := 0;\r\n\t  END IF;\r\n\tEND LOOP;\r\n\tcommit;\r\nEND;";
     $ok = $this->conn->Execute($sql);
 }
开发者ID:ndumisom,项目名称:ANYC-Project,代码行数:8,代码来源:perf-oci8.inc.php

示例2: query

function &adodb_log_sql(&$conn, $sql, $inputarr)
{
    /**
     OXID changes - create separate mysql connection for logging for not loosing info from last query (R)
    */
    $_logSqlDbInstance = $conn->_logSqlDbInstance;
    $perf_table = adodb_perf::table();
    $conn->_logsql = false;
    // replaces setting ::fnExecute=false in ADOdb
    $t0 = microtime();
    $rs =& $conn->Execute($sql, $inputarr);
    $t1 = microtime();
    $conn->_logsql = true;
    // reverse setting ::_logsql=false
    if (!$_logSqlDbInstance) {
        $myConfig = oxConfig::getInstance();
        $conn->_logSqlDbInstance = $_logSqlDbInstance =& NewADOConnection($myConfig->getConfigParam("dbType"));
        $_logSqlDbInstance->_connect($conn->host, $conn->username, $conn->password, $conn->database, false, true);
    }
    if (!empty($conn->_logsql)) {
        //$conn->_logsql = false; // disable logsql error simulation
        $dbT = $conn->dbtype;
        $a0 = explode(' ', $t0);
        $a0 = (double) $a0[1] + (double) $a0[0];
        $a1 = explode(' ', $t1);
        $a1 = (double) $a1[1] + (double) $a1[0];
        $time = $a1 - $a0;
        if (!$rs) {
            $errM = $conn->ErrorMsg();
            $errN = $conn->ErrorNo();
            $tracer = substr('ERROR: ' . htmlspecialchars($errM), 0, 250);
        } else {
            $tracer = '';
            $errM = '';
            $errN = 0;
        }
        if (isset($_SERVER['HTTP_HOST'])) {
            $tracer .= '<br>' . $_SERVER['HTTP_HOST'];
            if (isset($_SERVER['PHP_SELF'])) {
                $tracer .= $_SERVER['PHP_SELF'];
            }
        } elseif (isset($_SERVER['PHP_SELF'])) {
            $tracer .= '<br>' . $_SERVER['PHP_SELF'];
        }
        // OXID - added backtrace
        $_aTrace = debug_backtrace();
        $_sTrace = '';
        foreach ($_aTrace as $_trace) {
            $_sTrace .= "{$_trace['file']} - {$_trace['function']}:{$_trace['line']}\n";
        }
        $tracer .= "\n\nBacktrace:\n" . $_sTrace;
        $tracer = (string) substr($tracer, 0, 5000);
        if (is_array($inputarr)) {
            if (is_array(reset($inputarr))) {
                $params = 'Array sizeof=' . sizeof($inputarr);
            } else {
                // Quote string parameters so we can see them in the
                // performance stats. This helps spot disabled indexes.
                $xar_params = $inputarr;
                foreach ($xar_params as $xar_param_key => $xar_param) {
                    if (gettype($xar_param) == 'string') {
                        $xar_params[$xar_param_key] = '"' . $xar_param . '"';
                    }
                }
                $params = implode(', ', $xar_params);
                if (strlen($params) >= 3000) {
                    $params = substr($params, 0, 3000);
                }
            }
        } else {
            $params = '';
        }
        if (is_array($sql)) {
            $sql = $sql[0];
        }
        $arr = array('b' => strlen($sql) . '.' . crc32($sql), 'c' => substr($sql, 0, 3900), 'd' => $params, 'e' => $tracer, 'f' => adodb_round($time, 6));
        //$saved = $_logSqlDbInstance->debug;
        //$_logSqlDbInstance->debug = 0;
        $d = $conn->sysTimeStamp;
        if (empty($d)) {
            $d = date("'Y-m-d H:i:s'");
        }
        /*
        // OCI/Informix/ODBC_MSSQL - not sure if/how available in adodb-lite so I've commented out the section for now - (Pádraic)
        */
        /*if ($dbT == 'oci8' && $dbT != 'oci8po')
                {
                    $isql = "insert into $perf_table values($d,:b,:c,:d,:e,:f)";
                }
                elseif($dbT == 'odbc_mssql' || $dbT == 'informix')
                {
                    $timer = $arr['f'];
                    if ($dbT == 'informix') $sql2 = substr($sql2,0,230);
        
                    $sql1 = $conn->qstr($arr['b']);
                    $sql2 = $conn->qstr($arr['c']);
                    $params = $conn->qstr($arr['d']);
                    $tracer = $conn->qstr($arr['e']);
        
                    $isql = "insert into $perf_table (created,sql0,sql1,params,tracer,timer) values($d,$sql1,$sql2,$params,$tracer,$timer)";
//.........这里部分代码省略.........
开发者ID:OXIDprojects,项目名称:debugax,代码行数:101,代码来源:adodb-perf.inc.php

示例3: UI

 function UI($pollsecs = 5)
 {
     global $ADODB_LOG_CONN;
     $perf_table = adodb_perf::table();
     $conn = $this->conn;
     $app = $conn->host;
     if ($conn->host && $conn->database) {
         $app .= ', db=';
     }
     $app .= $conn->database;
     if ($app) {
         $app .= ', ';
     }
     $savelog = $this->conn->LogSQL(false);
     $info = $conn->ServerInfo();
     if (isset($_GET['clearsql'])) {
         $this->clearsql();
     }
     $this->conn->LogSQL($savelog);
     // magic quotes
     if (isset($_GET['sql']) && get_magic_quotes_gpc()) {
         $_GET['sql'] = $_GET['sql'] = str_replace(array("\\'", '\\"'), array("'", '"'), $_GET['sql']);
     }
     if (!isset($_SESSION['ADODB_PERF_SQL'])) {
         $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
     } else {
         $nsql = $_SESSION['ADODB_PERF_SQL'];
     }
     $app .= $info['description'];
     if (isset($_GET['do'])) {
         $do = $_GET['do'];
     } else {
         if (isset($_POST['do'])) {
             $do = $_POST['do'];
         } else {
             if (isset($_GET['sql'])) {
                 $do = 'viewsql';
             } else {
                 $do = 'stats';
             }
         }
     }
     if (isset($_GET['nsql'])) {
         if ($_GET['nsql'] > 0) {
             $nsql = $_SESSION['ADODB_PERF_SQL'] = (int) $_GET['nsql'];
         }
     }
     echo "<title>ADOdb Performance Monitor on {$app}</title><body bgcolor=white>";
     if ($do == 'viewsql') {
         $form = "<td><form># SQL:<input type=hidden value=viewsql name=do> <input type=text size=4 name=nsql value={$nsql}><input type=submit value=Go></td></form>";
     } else {
         $form = "<td>&nbsp;</td>";
     }
     $allowsql = !defined('ADODB_PERF_NO_RUN_SQL');
     global $ADODB_PERF_MIN;
     $app .= " (Min sql timing \$ADODB_PERF_MIN={$ADODB_PERF_MIN} secs)";
     if (empty($_GET['hidem'])) {
         echo "<table border=1 width=100% bgcolor=lightyellow><tr><td colspan=2>\n\t<b><a href=http://adodb.sourceforge.net/?perf=1>ADOdb</a> Performance Monitor</b> <font size=1>for {$app}</font></tr><tr><td>\n\t<a href=?do=stats><b>Performance Stats</b></a> &nbsp; <a href=?do=viewsql><b>View SQL</b></a>\n\t &nbsp; <a href=?do=tables><b>View Tables</b></a> &nbsp; <a href=?do=poll><b>Poll Stats</b></a>", $allowsql ? ' &nbsp; <a href=?do=dosql><b>Run SQL</b></a>' : '', "{$form}", "</tr></table>";
     }
     switch ($do) {
         default:
         case 'stats':
             if (empty($ADODB_LOG_CONN)) {
                 echo "<p>&nbsp; <a href=\"?do=viewsql&clearsql=1\">Clear SQL Log</a><br>";
             }
             echo $this->HealthCheck();
             //$this->conn->debug=1;
             echo $this->CheckMemory();
             global $ADODB_LOG_CONN;
             break;
         case 'poll':
             $self = htmlspecialchars($_SERVER['PHP_SELF']);
             echo "<iframe width=720 height=80% \n\t\t\t\tsrc=\"{$self}?do=poll2&hidem=1\"></iframe>";
             break;
         case 'poll2':
             echo "<pre>";
             $this->Poll($pollsecs);
             break;
         case 'dosql':
             if (!$allowsql) {
                 break;
             }
             $this->DoSQLForm();
             break;
         case 'viewsql':
             if (empty($_GET['hidem'])) {
                 echo "&nbsp; <a href=\"?do=viewsql&clearsql=1\">Clear SQL Log</a><br>";
             }
             echo $this->SuspiciousSQL($nsql);
             echo $this->ExpensiveSQL($nsql);
             echo $this->InvalidSQL($nsql);
             break;
         case 'tables':
             echo $this->Tables();
             break;
     }
     global $ADODB_vers;
     echo "<p><div align=center><font size=1>{$ADODB_vers} Sponsored by <a href=http://phplens.com/>phpLens</a></font></div>";
 }
开发者ID:justinlyon,项目名称:scc,代码行数:99,代码来源:adodb-perf.inc.php

示例4: microtime

function &adodb_log_sql(&$conn, $sql, $inputarr)
{
    $perf_table = adodb_perf::table();
    $conn->_logsql = false;
    // replaces setting ::fnExecute=false in ADOdb
    $t0 = microtime();
    $rs =& $conn->Execute($sql, $inputarr);
    $t1 = microtime();
    $conn->_logsql = true;
    // reverse setting ::_logsql=false
    if (!empty($conn->_logsql)) {
        $conn->_logsql = false;
        // disable logsql error simulation
        $dbT = $conn->dbtype;
        $a0 = split(' ', $t0);
        $a0 = (double) $a0[1] + (double) $a0[0];
        $a1 = split(' ', $t1);
        $a1 = (double) $a1[1] + (double) $a1[0];
        $time = $a1 - $a0;
        if (!$rs) {
            $errM = $conn->ErrorMsg();
            $errN = $conn->ErrorNo();
            $tracer = substr('ERROR: ' . htmlspecialchars($errM), 0, 250);
        } else {
            $tracer = '';
            $errM = '';
            $errN = 0;
        }
        if (isset($_SERVER['HTTP_HOST'])) {
            $tracer .= '<br>' . $_SERVER['HTTP_HOST'];
            if (isset($_SERVER['PHP_SELF'])) {
                $tracer .= $_SERVER['PHP_SELF'];
            }
        } elseif (isset($_SERVER['PHP_SELF'])) {
            $tracer .= '<br>' . $_SERVER['PHP_SELF'];
        }
        $tracer = (string) substr($tracer, 0, 500);
        if (is_array($inputarr)) {
            if (is_array(reset($inputarr))) {
                $params = 'Array sizeof=' . sizeof($inputarr);
            } else {
                // Quote string parameters so we can see them in the
                // performance stats. This helps spot disabled indexes.
                $xar_params = $inputarr;
                foreach ($xar_params as $xar_param_key => $xar_param) {
                    if (gettype($xar_param) == 'string') {
                        $xar_params[$xar_param_key] = '"' . $xar_param . '"';
                    }
                }
                $params = implode(', ', $xar_params);
                if (strlen($params) >= 3000) {
                    $params = substr($params, 0, 3000);
                }
            }
        } else {
            $params = '';
        }
        if (is_array($sql)) {
            $sql = $sql[0];
        }
        $arr = array('b' => strlen($sql) . '.' . crc32($sql), 'c' => substr($sql, 0, 3900), 'd' => $params, 'e' => $tracer, 'f' => adodb_round($time, 6));
        $saved = $conn->debug;
        $conn->debug = 0;
        $d = $conn->sysTimeStamp;
        if (empty($d)) {
            $d = date("'Y-m-d H:i:s'");
        }
        /*
        // OCI/Informix/ODBC_MSSQL - not sure if/how available in adodb-lite so I've commented out the section for now - (Pádraic)
        */
        /*if ($dbT == 'oci8' && $dbT != 'oci8po')
        		{
        			$isql = "insert into $perf_table values($d,:b,:c,:d,:e,:f)";
        		}
        		elseif($dbT == 'odbc_mssql' || $dbT == 'informix')
        		{
        			$timer = $arr['f'];
        			if ($dbT == 'informix') $sql2 = substr($sql2,0,230);
        
        			$sql1 = $conn->qstr($arr['b']);
        			$sql2 = $conn->qstr($arr['c']);
        			$params = $conn->qstr($arr['d']);
        			$tracer = $conn->qstr($arr['e']);
        			
        			$isql = "insert into $perf_table (created,sql0,sql1,params,tracer,timer) values($d,$sql1,$sql2,$params,$tracer,$timer)";
        			if ($dbT == 'informix') $isql = str_replace(chr(10),' ',$isql);
        			$arr = false;
        		} else {*/
        $isql = "insert into {$perf_table} (created,sql0,sql1,params,tracer,timer) values( {$d},?,?,?,?,?)";
        //}
        $ok = $conn->Execute($isql, $arr);
        $conn->debug = $saved;
        if ($ok) {
            $conn->_logsql = true;
        } else {
            $err2 = $conn->ErrorMsg();
            $conn->_logsql = true;
            // enable logsql error simulation
            $perf =& NewPerfMonitor($conn);
            if ($perf) {
//.........这里部分代码省略.........
开发者ID:henryhe514,项目名称:ChineseCommercial,代码行数:101,代码来源:adodb-perf.inc.php

示例5: oosDBInit

/**
 * Initializes the database connection.
 *
 * This function loads up ADODB  and starts the database
 * connection using the required parameters then it sets
 * the table prefixes and xartables up and returns true
 *
 * @access protected
 * @global object db database connection object
 * @global integer ADODB_FETCH_MODE array fectching by associative or numeric keyed arrays
 * @global array oosDB_tables database tables used by OOS [OSIS Online Shop]
 * @return bool true on success, false on failure
 */
function oosDBInit()
{
    // Get database parameters
    $dbtype = OOS_DB_TYPE;
    $dbhost = OOS_DB_SERVER;
    $dbname = OOS_DB_DATABASE;
    // Decode encoded DB parameters
    if (OOS_ENCODED == '1') {
        $dbuname = base64_decode(OOS_DB_USERNAME);
        $dbpass = base64_decode(OOS_DB_PASSWORD);
    } else {
        $dbuname = OOS_DB_USERNAME;
        $dbpass = OOS_DB_PASSWORD;
    }
    // Start connection
    global $ADODB_CACHE_DIR;
    $ADODB_CACHE_DIR = oos_get_local_path(OOS_TEMP_PATH . 'adodb_cache/');
    $dbconn = ADONewConnection($dbtype);
    if (!$dbconn->Connect($dbhost, $dbuname, $dbpass, $dbname)) {
        $dbpass = "****";
        $dbuname = "****";
        die("{$dbtype}://{$dbuname}:{$dbpass}@{$dbhost}/{$dbname} failed to connect " . $dbconn->ErrorMsg());
    }
    if (function_exists('memcache_pconnect')) {
        $dbconn->memCache = true;
        // should we use memCache instead of caching in files
        $dbconn->memCacheHost = '126.0.1.1';
        // $db->memCacheHost = array($ip1, $ip2, $ip3); // $db->memCacheHost = $ip1; still works
        $dbconn->memCachePort = '11211';
        // this is default memCache port
        $dbconn->memCacheCompress = false;
        // Use '1' to store the item compressed (uses zlib)
    }
    global $ADODB_FETCH_MODE;
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    //$dbconn->debug = true;
    if (OOS_LOG_SQL == '1') {
        include 'includes/lib/adodb/adodb-perf.inc.php';
        adodb_perf::table(ADODB_LOGSQL_TABLE);
        $dbconn->LogSQL();
    }
    $GLOBALS['oosDB_connections'][0] =& $dbconn;
    $GLOBALS['oosDB_tables'] = array();
    return true;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:58,代码来源:function_db.php

示例6: ini_set

ini_set('url_rewriter.tags', '');
// Ensure that the session id is *not* passed on the url - this is a possible security hole for logins - including admin.
global $ADODB_CRYPT_KEY;
global $ADODB_SESSION_CONNECT, $ADODB_SESSION_USER, $ADODB_SESSION_DB;
$ADODB_SESS_CONN = '';
$ADODB_SESSION_TBL = $db_prefix . "sessions";
// We explicitly use encrypted sessions, but this adds compression as well.
ADODB_Session::encryptionKey($ADODB_CRYPT_KEY);
// The data field name "data" violates SQL reserved words - switch it to SESSDATA
ADODB_Session::dataFieldName('SESSDATA');
global $db;
connectdb();
$db->prefix = $db_prefix;
$db->logging = $db_logging;
if ($db_logging) {
    adodb_perf::table("{$db->prefix}adodb_logsql");
    $db->LogSQL();
    // Turn on adodb performance logging
}
if (!isset($index_page)) {
    $index_page = false;
}
if (!$index_page) {
    // Ensure that we do not set cookies on the index page, until the player chooses to allow them.
    if (!isset($_SESSION)) {
        session_start();
    }
}
// reg_global_fix,0.1.1,22-09-2004,BNT DevTeam
if (!defined('reg_global_fix')) {
    define('reg_global_fix', True, TRUE);
开发者ID:kagetenshi,项目名称:xenoberage,代码行数:31,代码来源:global_cleanups.php

示例7: UI

	function UI($pollsecs=5)
	{
	global $HTTP_GET_VARS,$HTTP_SERVER_VARS,$HTTP_POST_VARS;
	
    $perf_table = adodb_perf::table();
	$conn = $this->conn;
	
	$app = $conn->host;
	if ($conn->host && $conn->database) $app .= ', db=';
	$app .= $conn->database;
	
	if ($app) $app .= ', ';
	$savelog = $this->conn->LogSQL(false);	
	$info = $conn->ServerInfo();
	if (isset($HTTP_GET_VARS['clearsql'])) {
		$this->conn->Execute("delete from $perf_table");
	}
	$this->conn->LogSQL($savelog);
	
	// magic quotes
	
	if (isset($HTTP_GET_VARS['sql']) && get_magic_quotes_gpc()) {
		$_GET['sql'] = $HTTP_GET_VARS['sql'] = str_replace(array("\\'",'\"'),array("'",'"'),$HTTP_GET_VARS['sql']);
	}
	
	if (!isset($_SESSION['ADODB_PERF_SQL'])) $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
	else  $nsql = $_SESSION['ADODB_PERF_SQL'];
	
	$app .= $info['description'];
	
	
	if (isset($HTTP_GET_VARS['do'])) $do = $HTTP_GET_VARS['do'];
	else if (isset($HTTP_POST_VARS['do'])) $do = $HTTP_POST_VARS['do'];
	 else if (isset($HTTP_GET_VARS['sql'])) $do = 'viewsql';
	 else $do = 'stats';
	 
	if (isset($HTTP_GET_VARS['nsql'])) {
		if ($HTTP_GET_VARS['nsql'] > 0) $nsql = $_SESSION['ADODB_PERF_SQL'] = (integer) $HTTP_GET_VARS['nsql'];
	}
	echo "<title>ADOdb Performance Monitor on $app</title><body bgcolor=white>";
	if ($do == 'viewsql') $form = "<td><form># SQL:<input type=hidden value=viewsql name=do> <input type=text size=4 name=nsql value=$nsql><input type=submit value=Go></td></form>";
	else $form = "<td>&nbsp;</td>";
	
	$allowsql = !defined('ADODB_PERF_NO_RUN_SQL');
	
	if  (empty($HTTP_GET_VARS['hidem']))
	echo "<table border=1 width=100% bgcolor=lightyellow><tr><td colspan=2>
	<b><a href=http://php.weblogs.com/adodb?perf=1>ADOdb</a> Performance Monitor</b> <font size=1>for $app</font></tr><tr><td>
	<a href=?do=stats><b>Performance Stats</b></a> &nbsp; <a href=?do=viewsql><b>View SQL</b></a>
	 &nbsp; <a href=?do=tables><b>View Tables</b></a> &nbsp; <a href=?do=poll><b>Poll Stats</b></a>",
	 $allowsql ? ' &nbsp; <a href=?do=dosql><b>Run SQL</b></a>' : '',
	 "$form",
	 "</tr></table>";

	 
	 	switch ($do) {
		default:
		case 'stats':
			echo $this->HealthCheck();
			//$this->conn->debug=1;
			echo $this->CheckMemory();
			break;
		case 'poll':
			echo "<iframe width=720 height=80% 
				src=\"{$HTTP_SERVER_VARS['PHP_SELF']}?do=poll2&hidem=1\"></iframe>";
			break;
		case 'poll2':
			echo "<pre>";
			$this->Poll($pollsecs);
			break;
		
		case 'dosql':
			if (!$allowsql) break;
			
			$this->DoSQLForm();
			break;
		case 'viewsql':
			if (empty($HTTP_GET_VARS['hidem']))
				echo "&nbsp; <a href=\"?do=viewsql&clearsql=1\">Clear SQL Log</a><br>";
			echo($this->SuspiciousSQL($nsql));
			echo($this->ExpensiveSQL($nsql));
			echo($this->InvalidSQL($nsql));
			break;
		case 'tables': 
			echo $this->Tables(); break;
		}
		global $ADODB_vers;
		echo "<p><div align=center><font size=1>$ADODB_vers Sponsored by <a href=http://phplens.com/>phpLens</a></font></div>";
	}
开发者ID:songchin,项目名称:Cacti,代码行数:89,代码来源:adodb-perf.inc.php


注:本文中的adodb_perf::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。