不支持 sqlsrv 批量添加 addAll 修正

浏览:1162 发布日期:2014/12/10
3.2.2 - 普通 - 未处理
标题:ThinkPHP 3.2.2 不支持 sqlsrv 批量添加 addAll 修正
时间:2014-12-9 18:32:28 星期二
描述:
  在 ThinkPHP 3.2.2 中,对 sqlsrv 的 addAll 功能扑街。。。

系统环境:
OS: Windows 7 64bit
PHP:5.5 nts 32bit
DLL: php_pdo_sqlsrv_55_nts.dll、php_sqlsrv_55_nts.dll
DB: MSSQL 2008 R2

系统提示:
PHP Fatal error: Call to undefined method Think\Db\Driver\Sqlsrv::insertAll()

错误文件:
./ThinkPHP/Library/Think/Model.class.php 第339行

错误代码:
$result = $this->db->insertAll($dataList,$options,$replace);

修改代码:
if(C('DB_TYPE') == 'sqlsrv'){
$SWarraycount = count($dataList);

for($SWLoopI = 0; $SWLoopI < $SWarraycount; $SWLoopI++){
$result = $this->db->insert($dataList[$SWLoopI],$options,$replace);
}
}
else{
$result = $this->db->insertAll($dataList,$options,$replace);
}
评论(
后面还有条评论,点击查看>>