本文整理汇总了PHP中mysql_stat函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_stat函数的具体用法?PHP mysql_stat怎么用?PHP mysql_stat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_stat函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getAttribute
public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null)
{
if ($source == null) {
$source =& $this->driver_options;
}
switch ($attribute) {
case EhrlichAndreas_Pdo_Abstract::ATTR_AUTOCOMMIT:
$result = mysql_unbuffered_query('SELECT @@AUTOCOMMIT', $this->link);
if (!$result) {
$this->set_driver_error(null, EhrlichAndreas_Pdo_Abstract::ERRMODE_EXCEPTION, $func);
}
$row = mysql_fetch_row($result);
mysql_free_result($result);
return intval($row[0]);
break;
case EhrlichAndreas_Pdo_Abstract::ATTR_TIMEOUT:
return intval(ini_get('mysql.connect_timeout'));
break;
case EhrlichAndreas_Pdo_Abstract::ATTR_CLIENT_VERSION:
return mysql_get_client_info();
break;
case EhrlichAndreas_Pdo_Abstract::ATTR_CONNECTION_STATUS:
return mysql_get_host_info($this->link);
break;
case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_INFO:
return mysql_stat($this->link);
break;
case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_VERSION:
return mysql_get_server_info($this->link);
break;
default:
return parent::getAttribute($attribute, $source, $func, $last_error);
break;
}
}
开发者ID:ehrlichandreas,项目名称:ehrlichandreas1-pdo,代码行数:35,代码来源:Mysql.php
示例2: estado_enlace
public function estado_enlace()
{
$stat = explode(' ', mysql_stat($this->link));
foreach ($stat as $campo => $valor) {
echo '<b>' . $campo . '</b> ' . $valor . '<br />';
}
}
开发者ID:redigaffi,项目名称:SimpleForum,代码行数:7,代码来源:practicas.php
示例3: chk_db_connect
function chk_db_connect($post)
{
if ($post['dbtype'] == 'mysql') {
$conn = @mysql_connect($post['host'], $post['user'], $post['pass']);
return @mysql_stat($conn);
} elseif ($post['dbtype'] == 'postgresql') {
$conn = pg_connect("host=" . $post['host'] . " port=5432 dbname=template1 user=" . $post['user'] . " password=" . $post['pass']);
return $conn;
}
}
开发者ID:shaman33,项目名称:pwsm2,代码行数:10,代码来源:wisard.inc.php
示例4: getDBStatus
public static function getDBStatus()
{
Piwik::checkUserIsSuperUser();
$configDb = Zend_Registry::get('config')->database->toArray();
// we decode the password. Password is html encoded because it's enclosed between " double quotes
$configDb['password'] = htmlspecialchars_decode($configDb['password']);
if (!isset($configDb['port'])) {
// before 0.2.4 there is no port specified in config file
$configDb['port'] = '3306';
}
$link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
$status = mysql_stat($link);
mysql_close($link);
return $status;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:15,代码来源:API.php
示例5: getDBStatus
/**
* Gets general database info that is not specific to any table.
*
* @return array See http://dev.mysql.com/doc/refman/5.1/en/show-status.html .
*/
public function getDBStatus()
{
if (function_exists('mysql_connect')) {
$configDb = Piwik_Config::getInstance()->database;
$link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
$status = mysql_stat($link);
mysql_close($link);
$status = explode(" ", $status);
} else {
$fullStatus = Piwik_FetchAssoc('SHOW STATUS');
if (empty($fullStatus)) {
throw new Exception('Error, SHOW STATUS failed');
}
$status = array('Uptime' => $fullStatus['Uptime']['Value'], 'Threads' => $fullStatus['Threads_running']['Value'], 'Questions' => $fullStatus['Questions']['Value'], 'Slow queries' => $fullStatus['Slow_queries']['Value'], 'Flush tables' => $fullStatus['Flush_commands']['Value'], 'Open tables' => $fullStatus['Open_tables']['Value'], 'Opens' => 'unavailable', 'Queries per second avg' => 'unavailable');
}
return $status;
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:22,代码来源:MySQLMetadataProvider.php
示例6: connect
/**
* Connects to the database specified in the options.
* If autoconnect is enabled (which is is by default),
* this function will be called upon class instantiation.
*/
public function connect()
{
if (!$this->conn) {
// don't open a new connection if one already exists
$this->conn = @mysql_connect($this->host, $this->user, $this->password);
if (!$this->conn) {
throw new OsimoException(OSIMODB_CONNECT_FAIL, "Could not connect to database at {$this->host}");
}
$this->conn_db = @mysql_select_db($this->name);
if (!$this->conn_db) {
throw new OsimoException(OSIMODB_SELECT_FAIL, "Could not select the database: {$this->name}");
}
get('debug')->logMsg('OsimoDB', 'events', 'Opening database connection...');
$status = explode(' ', mysql_stat());
get('debug')->logMsg('OsimoDB', 'events', "Current database status:\n" . print_r($status, true));
}
}
开发者ID:Rastrian,项目名称:Osimo-Forum-System-v2,代码行数:22,代码来源:db2.module.php
示例7: getDBStatus
public function getDBStatus()
{
Piwik::checkUserIsSuperUser();
if(function_exists('mysql_connect'))
{
$configDb = Zend_Registry::get('config')->database->toArray();
// we decode the password. Password is html encoded because it's enclosed between " double quotes
$configDb['password'] = htmlspecialchars_decode($configDb['password']);
if(!isset($configDb['port']))
{
// before 0.2.4 there is no port specified in config file
$configDb['port'] = '3306';
}
$link = mysql_connect($configDb['host'], $configDb['username'], $configDb['password']);
$status = mysql_stat($link);
mysql_close($link);
$status = explode(" ", $status);
}
else
{
$db = Zend_Registry::get('db');
$fullStatus = $db->fetchAssoc('SHOW STATUS;');
if(empty($fullStatus)) {
throw new Exception('Error, SHOW STATUS failed');
}
$status = array(
'Uptime' => $fullStatus['Uptime']['Value'],
'Threads' => $fullStatus['Threads_running']['Value'],
'Questions' => $fullStatus['Questions']['Value'],
'Slow queries' => $fullStatus['Slow_queries']['Value'],
'Flush tables' => $fullStatus['Flush_commands']['Value'],
'Open tables' => $fullStatus['Open_tables']['Value'],
// 'Opens: ', // not available via SHOW STATUS
// 'Queries per second avg' =/ // not available via SHOW STATUS
);
}
return $status;
}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:43,代码来源:API.php
示例8: index
/**
* Show general table stats
*
* @access public
*/
public function index()
{
// -------------------------------------
// Get basic info
// -------------------------------------
$raw_stats = explode(' ', mysql_stat());
$data = array();
$data['stats'] = array();
foreach ($raw_stats as $stat) {
$break = explode(':', $stat);
$data['stats'][trim($break[0])] = trim($break[1]);
}
// -------------------------------------
// Get Processes
// -------------------------------------
$this->load->helper('number');
$data['processes'] = $this->db->query('SHOW PROCESSLIST')->result();
// -------------------------------------
$this->template->build('admin/overview', $data);
}
开发者ID:gamchantoi,项目名称:sisfo-ft,代码行数:25,代码来源:admin.php
示例9: __construct
public function __construct(Credentials $credentials, $workspace, $config)
{
$link = @mysql_connect($config->server, $credentials->getUserID(), $credentials->getPassword(), 1);
if (mysql_stat($link) !== null) {
if (!mysql_select_db($workspace, $link)) {
$sql = "CREATE DATABASE {$workspace}";
if (mysql_query($sql, $link)) {
mysql_select_db($workspace, $link);
$sql = "CREATE TABLE c (p text NOT NULL,\n\t\t\t\t\t\t\t\tn text NOT NULL,\n\t\t\t\t\t\t\t\tv text NOT NULL,\n\t\t\t\t\t\t\t\tKEY INDEX1 (p (1000)),\n\t\t\t\t\t\t\t\tKEY INDEX2 (p (850), n (150)),\n\t\t\t\t\t\t\t\tKEY INDEX3 (p (550), n (150), v (300)),\n\t\t\t\t\t\t\t\tKEY INDEX4 (v (1000)))\n\t\t\t\t\t\t\t\tENGINE = MyISAM DEFAULT CHARSET = latin1";
mysql_query($sql, $link);
} else {
throw new RepositoryException("in MySQL, cannot create workspace: {$workspace}");
}
}
$this->credentials = $credentials;
$this->workspace = $workspace;
$this->config = $config;
$this->link = $link;
$this->isLive = true;
}
}
开发者ID:samueljwilliams,项目名称:pcr,代码行数:21,代码来源:MySQLPersistenceManager.php
示例10: stat
function stat()
{
/* 取得当前系统状态 */
return mysql_stat($this->LinkId);
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:5,代码来源:db.php
示例11: cacheTestConnection
public function cacheTestConnection()
{
$status = '';
if ($this->cacheDbType != '' && $this->cacheDbh != false) {
if (strtolower($this->cacheDbType) == 'mysql') {
$status = mysql_stat($this->cacheDbh);
if ($status && $status != '') {
$this->cachingOn = true;
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
开发者ID:ankita-parashar,项目名称:magento,代码行数:20,代码来源:XwebSoapClient.php
示例12: mysqli_get_server_info
if (is_object($database->DbHandle)) {
$title = "MySQLi Info";
$server_info = mysqli_get_server_info($database->DbHandle);
$host_info = mysqli_get_host_info($database->DbHandle);
$proto_info = mysqli_get_proto_info($database->DbHandle);
$client_info = mysqli_get_client_info($database->DbHandle);
$client_encoding = mysqli_character_set_name($database->DbHandle);
$status = explode(' ', mysqli_stat($database->DbHandle));
} else {
$title = "MySQL Info";
$server_info = mysql_get_server_info();
$host_info = mysql_get_host_info();
$proto_info = mysql_get_proto_info();
$client_info = mysql_get_client_info();
$client_encoding = mysql_client_encoding();
$status = explode(' ', mysql_stat());
}
$strictMode = $database->get_one('SELECT @@sql_mode');
$strict_info = (strpos($strictMode, 'STRICT_TRANS_TABLES') !== false or strpos($strictMode, 'STRICT_ALL_TABLES') !== false) ? "MySQL strict mode active" : "MySQL strict mode not active\n";
?>
<table cellpadding="3" border="0">
<tbody>
<tr class="h">
<td><h1 class="p"><?php
echo $title;
?>
</h1></td>
</tr>
</tbody>
</table>
<br/>
开发者ID:WebsiteBaker-modules,项目名称:sysinfo,代码行数:31,代码来源:mysqlinfo.php
示例13: sql_query
sql_query("UPDATE `profiler` SET `prfCount` = `prfCount` + 1, " . "`prfTime` = `prfTime` + '" . $generationTime . "' " . "WHERE `prfPage` = '" . addslashes($page) . "'");
} else {
sql_values(array("prfPage" => $page, "prfCount" => 1, "prfTime" => $generationTime));
sql_insert("profiler");
}
}
// Show "Page generated in N seconds" if the user is at least
// a moderator.
if (atLeastSModerator() || $_auth["useid"] == 34814) {
include_once "serverload.php";
$time_start = $_stats["startTime"];
$time_end = gettimeofday();
$secdiff = $time_end["sec"] - $time_start["sec"];
$usecdiff = $time_end["usec"] - $time_start["usec"];
$generationTime = round(($secdiff * 1000000 + $usecdiff) / 1000000, 3);
$mysqlStat = mysql_stat();
$queriesPerSecond = round(preg_replace('/.*' . preg_quote("Queries per second avg: ") . '([0-9\\.]+).*/', "\\1", $mysqlStat), 2);
//if( isset( $_stats[ "startQueries" ]))
//{
// $queryCount = preg_replace( '/.*'.preg_quote( "Questions: " ).
// '([0-9]+).*/', "\\1", $mysqlStat ) - $_stats[ "startQueries" ];
//}
//else
//{
// $queryCount = 0;
//}
$mysqlUptime = round(preg_replace('/.*' . preg_quote("Uptime: ") . '([0-9\\.]+).*/', "\\1", $mysqlStat), 2);
$upDays = floor($mysqlUptime / 60 / 60 / 24);
$upHours = floor($mysqlUptime / 60 / 60) % 24;
$upMinutes = $mysqlUptime / 60 % 60;
echo " <br /> " . sprintf(_PAGE_GENERATED, $generationTime) . ", MySQL: " . $queriesPerSecond . " queries/sec, " . "uptime " . $upDays . "d " . $upHours . "h " . $upMinutes . "m. · Server load: {$loadavg}";
开发者ID:brocococonut,项目名称:yGallery,代码行数:31,代码来源:layout-20120318.php
示例14: status
/**
* Get details about the current system status
* @return array details
*/
public function status()
{
return explode(' ', mysql_stat($this->link_id));
}
开发者ID:anhvn,项目名称:pokerspot,代码行数:8,代码来源:db.class.php
示例15: GetStatistics
/**
* Return a few database statistics in an array.
*
* @return array Returns an array of statistics values on success or FALSE on error.
*/
public function GetStatistics()
{
$this->ResetError();
if (!$this->IsConnected()) {
return $this->SetError('No connection', -1);
} else {
$result = mysql_stat($this->mysql_link);
if (empty($result)) {
$this->SetError('Failed to obtain database statistics', -1);
// do NOT return to caller yet!
return array('Query Count' => $this->query_count);
}
$tot_count = preg_match_all('/([a-z ]+):\\s*([0-9.]+)/i', $result, $matches);
$info = array('Query Count' => $this->query_count);
for ($i = 0; $i < $tot_count; $i++) {
$info[$matches[1][$i]] = $matches[2][$i];
}
return $info;
}
}
开发者ID:GerHobbelt,项目名称:CompactCMS,代码行数:25,代码来源:mysql.class.php
示例16: isConnected
/**
* Checks if current mysql connection is alive
* @return bool Returns TRUE if connection is alive, else returns FALSE
*/
public function isConnected()
{
return isset($this->dbLink) && $this->dbLink !== NULL && mysql_stat($this->dbLink) !== NULL;
}
开发者ID:jonathan-vallet,项目名称:craftanat,代码行数:8,代码来源:MysqlDatabaseConnectionModel.class.php
示例17: php_uname
$your_version.="<tr><td align=\"right\">Current version:</td><td align=\"left\">".implode(" ",$last_version)."</td></tr>\n";
$your_version.="<tr><td colspan=\"2\" align=\"center\">Get Last Version <a href=\"http://www.btiteam.org\" target=\"_blank\">here</a>!</td></tr>\n</table>";
}
else
{
$your_version.="You have the latest xBtit version installed.($tracker_version Rev.$tracker_revision)";
}
if (!empty($your_version))
$admin["xbtit_version"]=$your_version."<br />\n";
*/
$admin["infos"] .= "<br />\n<table border=\"0\">\n";
$admin["infos"] .= "<tr><td class=\"header\" align=\"center\">Server's OS</td></tr><tr><td align=\"left\">" . php_uname() . "</td></tr>";
$admin["infos"] .= "<tr><td class=\"header\" align=\"center\">PHP version</td></tr><tr><td align=\"left\">" . phpversion() . "</td></tr>";
$sqlver = mysql_fetch_row(do_sqlquery("SELECT VERSION()"));
$admin["infos"] .= "\n<tr><td class=\"header\" align=\"center\">MYSQL version</td></tr><tr><td align=\"left\">{$sqlver['0']}</td></tr>";
$sqlver = mysql_stat();
$sqlver = explode(' ', $sqlver);
$admin["infos"] .= "\n<tr><td valign=\"top\" class=\"header\" align=\"center\">MYSQL stats</td></tr>\n";
for ($i = 0; $i < count($sqlver); $i++) {
$admin["infos"] .= "<tr><td align=\"left\">{$sqlver[$i]}</td></tr>\n";
}
$admin["infos"] .= "\n</table><br />\n";
unset($sqlver);
// check for news on btiteam site (read rss from comunication forum)
/*
if($btit_url_rss!="")
{
include("$THIS_BASEPATH/include/class.rssreader.php");
$btit_news=get_cached_version($btit_url_rss);
开发者ID:r4kib,项目名称:cyberfun-xbtit,代码行数:30,代码来源:admin.main.php
示例18: COUNT
$row = $mysqldb->fetchObject();
$approvedcomments = $row->commenty;
$mysqldb->query("SELECT COUNT(*) as commentn FROM articles WHERE Approved = 'N' AND ParentID>0");
$row = $mysqldb->fetchObject();
$pendingcomments = $row->commentn;
$mysqldb->query("SELECT count(*) as qy from articles WHERE Approved = 'Q'");
$row = $mysqldb->fetchObject();
$pendingquestions = $row->qy;
$mysqldb->query("SELECT count(*) as qn from articles WHERE Approved = 'A'");
$row = $mysqldb->fetchObject();
$respondedquestions = $row->qn;
$totalarticles = $pendingarticles + $approvedarticles;
$totalcomments = $approvedcomments + $pendingcomments;
$totalquestions = $respondedquestions + $pendingquestions;
// if all is good, we've got our count variables
$mysqlstat = explode(' ', mysql_stat());
$rwxcheck = permcheck();
head_page($page_title);
menu_options($title, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($title);
echo <<<_EOF
<font color="red">{$rwxcheck}</font>
<br />
<table>
<tr>
<td><a href="pending.php?acq=a">Pending Articles</a></td><td><a href="a_pendinga.php">{$pendingarticles}</a></td>
</tr>
<tr>
<td>Approved Articles</td><td>{$approvedarticles}</td>
</tr>
<tr>
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:31,代码来源:a_index.php
示例19: getStatus
/**
* get server status.
* get a status string from the mysql server.
*
* - uptime
* - threads
* - questions handled
* - # slow queries
* - open connections
* - # flush tables
* - # open tables
* - # queries / second
*
* @access public
* @return string
*/
public function getStatus()
{
if ($this->connect()) {
return mysql_stat($this->_connection);
}
return null;
}
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:23,代码来源:MySql.php
示例20: printf
<?php
include_once "connect.inc";
$dbname = 'test';
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysql_stat($link))) {
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!is_null($tmp = @mysql_stat($link, "foo"))) {
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
if (!is_string($stat = mysql_stat($link)) || '' === $stat) {
printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($stat), $stat, mysql_errno($link), mysql_error($link));
}
if (version_compare(PHP_VERSION, '5.9.9', '>') == 1 && !is_unicode($stat)) {
printf("[004] Expecting Unicode error message!\n");
var_inspect($stat);
}
if (!is_string($stat_def = mysql_stat()) || '' === $stat_def) {
printf("[003] Expecting non empty string, got %s/'%s', [%d] %s\n", gettype($stat_def), $stat_def, mysql_errno(), mysql_error());
}
assert(soundex($stat) === soundex($stat_def));
mysql_close($link);
if (false !== ($tmp = mysql_stat($link))) {
printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
print "done!";
开发者ID:badlamer,项目名称:hhvm,代码行数:29,代码来源:mysql_stat.php
注:本文中的mysql_stat函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论