sp 中不能同时使用spcache和pager

#1 yuanjianhua

sp 中不能同时使用spcache和pager,一用就报错!

错误如下:SELECT COUNT(sid) AS SP_COUNTER FROM cbd_shop WHERE 1 = 1 && flag in (1,3) && catid = 7
执行错误:
  • D:\wamp\www\CBD\SpeedPHP\Drivers\mysql.php on line 62

57.
{
58.         $this->arrSql[] = $sql;
59.
if( $result = mysql_query($sql, $this->conn) ){
60.
return $result;
61.
}else{
62.             spError("{$sql}
执行错误: "
. mysql_error());

63.
}
64.
}
65.
66.
/**
67.
* 返回影响行数

  • D:\wamp\www\CBD\SpeedPHP\Drivers\mysql.php on line 26
21.
*  
22.
* @param sql  执行的SQL语句
23.
*/
24.
public function getArray($sql)
25.
{
26.
if( ! $result = $this->exec($sql) )return FALSE;

27.
if( ! mysql_num_rows($result) )return FALSE;
28.         $rows = array();
29.
while($rows[] = mysql_fetch_array($result,MYSQL_ASSOC)){}
30.         mysql_free_result($result);
31.         array_pop($rows);

  • D:\wamp\www\CBD\SpeedPHP\Core\spModel.php on line 257
252.             $where = "WHERE ".join(" AND ",$join);
253.
}else{
254.
if(null != $conditions)$where = "WHERE ".$conditions;
255.
}
256.         $sql = "SELECT COUNT({$this->pk}) AS SP_COUNTER FROM {$this->tbl_name}
{$where}";
257.         $result = $this->_db->getArray($sql);

258.
return $result[0]['SP_COUNTER'];
259.
}
260.
261.
/**
262.
* 魔术函数,执行模型扩展类的自动加载及使用

  • D:\wamp\www\CBD\SpeedPHP\Core\spModel.php on line 438
433.         $pageSize = $this->input_args[1];
434.
@list($conditions, $sort, $fields ) = $func_args;
435.
if('findSql'==$func_name){
436.             $total_count = array_pop( array_pop( $this->model_obj->findSql("SELECT COUNT({$this->model_obj->pk}) as sp_counter FROM ($conditions) sp_tmp_table_pager1") ) );
437.
}else{
438.             $total_count = $this->model_obj->findCount($conditions);

439.
}
440.
if($total_count > $pageSize){
441.             $total_page = ceil( $total_count / $pageSize );
442.             $page = min(intval(max($page, 1)), $total_count); // 对页码进行规范运算
443.             $this->pageData = array(

2010-11-20 10:09:08

#2 xqx3395529

{:2_36:}{:2_36:}{:2_36:}{:2_36:}{:2_36:}

2010-11-20 11:01:14

#3 jake

之前测试过,的确spCache不能和spPager或者spLinker连用:L

所以spCache的主要作用只是用在对封装成员函数的缓存上面。

2010-11-20 21:00:20