2013-06-05 24 views
0

所以我一直在寻找无处不在,无法找到解决我的问题的方法。我试图将我在其他位置使用的php类(如smf和wordpress)转换为codeignitor库。我现在唯一的问题就是将数据发送回数据库。问题的原因是返回的数据量超过了php.ini文件设置的压缩大小,我不想更改ini文件,因为如果需要将其迁移或分发给其他人以便稍后再解决问题,使用。所以我需要的CodeIgnitor相当于...CodeIgnitor相当于send_long_data(),以避免超过mysql的最大数据包大小

// Send XML data in 8196 block chunks 
$start=0; 

// The XML data may be large in size, so we need to 
// send the data in chunks to the MySQL driver to not 
// exceed the max packet size for MySQL. 
while ($start < strlen($xml)) 
{ 
    $end = $start + 8192; 
    if ($end > strlen($xml)) $end = strlen($xml); 
    $statement->send_long_data(3,substr($xml,$start,$end-$start)); 
    $start = $end; 
} 
$start=0; 
while ($start < strlen($xml)) 
{ 
    $end = $start + 8192; 
    if ($end > strlen($xml)) $end = strlen($xml); 
    $statement->send_long_data(4,substr($xml,$start,$end-$start)); 
    $start = $end; 
} 
$statement->execute(); 

我已经将问题缩小到send_long_data。我已经修改了文件中的所有其他内容,并且运行得非常好。有没有人知道在CodeIgnitor中正确处理最大数据包大小的正确方法?

回答

0

发现我的问题,表默认为MyISAM,需要成为InnoDB。

对于参考其他SQL命令来改变,这是

ALTER TABLE `tablename` ENGINE = InnoDB; 
相关问题