$this -> queryID -> close();
public function query($str) {
$this -> initConnect(false);
if (!$this -> _linkID) {
return false;
}
$this -> queryStr = $str;
//释放前次的查询结果
if ($this -> queryID)
$this -> free();
N('db_query', 1);
// 记录开始执行时间
G('queryStartTime');
$this -> queryID = $this -> _linkID -> query($str);
// 对存储过程改进
$ret = array();
$this -> debug();
if (false === $this -> queryID) {
$this -> error();
return false;
} else {
$this -> numRows = $this -> queryID -> num_rows;
$this -> numCols = $this -> queryID -> field_count;
$ret = $this -> getAll();
}
//主要将这段移动了一下,关闭结果集
if ($this -> _linkID -> more_results()) {
while (($res = $this -> _linkID -> next_result()) != NULL) {
$this -> queryID -> close();
}
}
return $ret ;
}
$db = new mysqli(C("DB_HOST"), C("DB_USER"), C("DB_PWD"), C("DB_NAME"));
if (mysqli_connect_errno())
throw_exception(mysqli_connect_error());
$t2 = microtime(true);
echo "数据库连接用时:" . (($t2 - $t1)) . "s <br />";
$arr = array();
// 1st Query
$procedure = "call p1()";
$result = $db->query($procedure);
if ($result) {
// Cycle through results
while ($row = $result->fetch_object()) {
//添加到对象数组
$arr[] = $row;
}
// 这里是最重要的,需要将游标移动下一个结果集
$result->close();
$db->next_result();
}
$procedure = "call p2()";
$result = $db->query($procedure);
if ($result) {
// Cycle through results
while ($row = $result->fetch_object()) {
//添加到对象数组
$arr[] = $row;
}
// 这里是最重要的,需要将游标移动下一个结果集
$result->close();
$db->next_result();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有