2013-06-05 23 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; 
相關問題