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


PHP Mysql::get_num_queries方法代码示例

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


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

示例1: updateEpgBySetting


//.........这里部分代码省略.........
             return _("Source") . " " . $setting['uri'] . " " . _("failed to open") . "\n";
         }
         $tmpfname = tempnam("/tmp", "xmltv");
         $fp = fopen($tmpfname, "w");
         while (!gzeof($handle)) {
             $contents = gzread($handle, 1000000);
             fwrite($fp, $contents);
         }
         gzclose($handle);
         $xml = simplexml_load_file($tmpfname);
         unlink($tmpfname);
     } else {
         $xml = simplexml_load_file($setting['uri']);
     }
     $ids_arr = $this->getITVids();
     $data_arr = array();
     $start_time = microtime(1);
     $total_need_to_delete = array();
     foreach ($xml->programme as $programme) {
         $itv_id_arr = @$ids_arr[$setting['id_prefix'] . strval($programme->attributes()->channel)];
         if ($itv_id_arr) {
             $start = strtotime(strval($programme->attributes()->start));
             $stop = strtotime(strval($programme->attributes()->stop));
             $title = strval($this->getElementByLangCode($programme->title, $setting['lang_code']));
             $descr = strval($this->getElementByLangCode($programme->desc, $setting['lang_code']));
             $category = array();
             $director = array();
             $actor = array();
             if (!empty($programme->category)) {
                 foreach ($programme->category as $_category) {
                     $category[] = strval($this->getElementByLangCode($_category, $setting['lang_code']));
                 }
             }
             $category = implode(', ', $category);
             if (!empty($programme->credits->director)) {
                 foreach ($programme->credits->director as $_director) {
                     $director[] = strval($this->getElementByLangCode($_director, $setting['lang_code']));
                 }
             }
             $director = implode(', ', $director);
             if (!empty($programme->credits->actor)) {
                 foreach ($programme->credits->actor as $_actor) {
                     $actor[] = strval($this->getElementByLangCode($_actor, $setting['lang_code']));
                 }
             }
             $actor = implode(', ', $actor);
             foreach ($itv_id_arr as $itv_id) {
                 $correction_time = $this->getCorrectionTimeByChannelId($itv_id);
                 $start_ts = $start + $correction_time * 60;
                 $need_to_delete = $this->getProgramIdsForClean($start_ts, $itv_id);
                 if ($need_to_delete) {
                     $total_need_to_delete = array_merge($total_need_to_delete, $need_to_delete);
                 }
             }
             foreach ($itv_id_arr as $itv_id) {
                 $correction_time = $this->getCorrectionTimeByChannelId($itv_id);
                 $start_ts = $start + $correction_time * 60;
                 $mysql_start = date("Y-m-d H:i:s", $start_ts);
                 $stop_ts = $stop + $correction_time * 60;
                 $mysql_stop = date("Y-m-d H:i:s", $stop_ts);
                 $duration = $stop_ts - $start_ts;
                 $real_id = $itv_id . '_' . $start_ts;
                 if (isset($this->real_ids[$real_id])) {
                     continue;
                 }
                 $this->real_ids[$real_id] = true;
                 $data_arr[] = array('ch_id' => $itv_id, 'time' => $mysql_start, 'time_to' => $mysql_stop, 'duration' => $duration, 'real_id' => $real_id, 'name' => $title, 'descr' => $descr, 'category' => $category, 'director' => $director, 'actor' => $actor);
                 $this->channels_updated[$itv_id] = 1;
             }
         }
     }
     $xml = null;
     $total_need_to_delete = array_diff($total_need_to_delete, $this->new_ids);
     if (!empty($total_need_to_delete)) {
         Mysql::getInstance()->query('delete from epg where id in (' . implode(', ', array_unique($total_need_to_delete)) . ')');
         Mysql::getInstance()->query('OPTIMIZE TABLE epg');
     }
     if (!empty($data_arr)) {
         $result = $this->db->insert('epg', $data_arr);
         $real_ids = array_map(function ($item) {
             return $item['real_id'];
         }, $data_arr);
         $this->new_ids = array_merge(Mysql::getInstance()->from('epg')->in('real_id', $real_ids)->get()->all('id'), $this->new_ids);
     } else {
         $result = true;
     }
     $setting['etag'] = $etag;
     $this->setSettings($setting);
     //$str = sprintf(_("Updated %d channels from %d, %d errors"), $done, $total, $err)." \n";
     $str = "\n";
     if (!$result) {
         $str .= "<b>" . _("Errors") . ": </b> 1\n";
     }
     $str .= "<b>" . sprintf(_("Successful: %s channels"), count($this->channels_updated)) . "</b>\n";
     $str .= "<b>" . sprintf(_("Deleted: %s records"), count($total_need_to_delete)) . "</b>\n";
     $str .= "<b>" . _("Queries") . ": </b>" . Mysql::get_num_queries() . "\n";
     $str .= "<b>" . _("Exec time") . ": </b>" . round(microtime(1) - $start_time, 2) . 's';
     $this->channels_updated = array();
     return $str;
 }
开发者ID:saydulk,项目名称:stalker_portal,代码行数:101,代码来源:epg.class.php

示例2: microtime

<?php

$start_time = microtime(1);
// no cache
header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
header("Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate");
require_once "init.php";
set_error_handler(array($debug = Debug::getInstance(), 'parsePHPError'));
print "generated in: " . round(microtime(1) - $start_time, 3) . "s; query counter: " . Mysql::get_num_queries() . "; cache hits: " . Mysql::get_cache_hits() . "; cache miss: " . Mysql::get_cache_misses() . "; " . $debug->getErrorStr();
开发者ID:kamekun,项目名称:WrapperPHP,代码行数:11,代码来源:load.php

示例3: _

        echo "<td><b>#</b></td>";
        echo "<td><b>" . _('Movie') . "</b></td>";
        echo "<td><b>" . _('Date') . "</b></td>";
        echo "<td><b>" . _('Opening date') . "</b></td>";
        echo "<td>&nbsp;</td>";
        echo "</tr>";
        $num = 0;
        while ($arr = $tasks->next()) {
            $num++;
            echo "<tr>";
            echo "<td>" . $num . "</td>";
            //echo "<td><a href='msgs.php?task={$arr['id']}'>".get_media_name_by_id($arr['media_id'])."</a></td>";
            echo "<td>" . $arr['name'] . "</td>";
            echo "<td>" . $arr['login'] . "</td>";
            echo "<td>" . $arr['start_time'] . "</td>";
            echo '<td><a href="reject_task.php?id=' . $arr['id'] . '&send_to=' . $arr['media_id'] . '">' . _('reject') . '</a></td>';
            echo "</tr>";
        }
        echo "</table>";
    }
    echo "<br>";
    echo "<br>";
    echo "<br>";
}
?>
</td>
</tr>
</table>
<?php 
echo 'queries: ' . Mysql::get_num_queries() . '<br>';
echo 'generated in: ' . round(microtime(1) - $start_time, 3) . 's';
开发者ID:Eugen1985,项目名称:stalker_portal,代码行数:31,代码来源:tasks.php


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