ccxxcc
金牌会员
 
有钱啦 有钱啦
UID 63944
精华
0
积分 2249
帖子 338
金钱 2249 喜悦币
威望 0
人脉 0
阅读权限 70
注册 2005-4-2
状态 离线
|
[推荐阅读] 谁知道Gallery2怎样换皮肤啊
效率测试代码
<?php
/**
* description
*
* Copyright(c) 2007 by ccxxcc(小超) All rights reserved
*
* To contact the author write to {@link mailto:ucitmc@163.com}
*
* @author ccxxcc
* @version $Id: {filename},v 1.0 {time} $
* @package system
*/
function getMicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$db['dbtype'] = "mysql";
$db['dbhost'] = "127.0.0.1";
$db['dbname'] = "blog_bbs";
$db['dbuser'] = "root";
$db['dbpwd'] = "11111";
require_once 'database.class.php';
require_once 'exception.class.php';
// 连接数据库
if(!empty($db))
{
// 实例化数据库对象
$DatabaseHandler = new DatabaseHandler($db['dbhost'], $db['dbuser'], $db['dbpwd'], $db['dbname']);
}
else
{
die("无数据库设置");
}
$sql = "select id FROM blog_to_bbs";
$rs = $DatabaseHandler->exeCute($sql);
while (!$rs->EOF)
{
$data_id_array[] = $rs->fields['id'];
$rs->MoveNext();
}
$str = "(";
$item = "";
foreach($data_id_array AS $key=>$val)
{
$str .= $item.$val;
$item = ",";
}
$str .= ")";
$start_time = getMicrotime();
/*$sql = "DELETE FROM blog_to_bbs WHERE id in {$str}";
$DatabaseHandler->exeCute($sql);*/
foreach($data_id_array as $key=>$val)
{
$sql = "DELETE * FROM blog_to_bbs WHERE id={$val} limit 1";
$DatabaseHandler->exeCute($sql);
}
$end_time = getMicrotime();
echo("\n执行时间:\n");
echo($end_time-$start_time."秒");
?>
|  在线查词http://www.iciba.com/
web编程站http://www.eb163.com
|
|