Php CodeIgniter相当于发送_long_data(),以避免超过mysql的最大数据包大小

Php CodeIgniter相当于发送_long_data(),以避免超过mysql的最大数据包大小,php,mysql,codeigniter,Php,Mysql,Codeigniter,我到处找,找不到解决问题的办法。我正在尝试将我在其他位置(如smf和wordpress)使用的php类转换为codeigniter库。目前我唯一的问题是将数据发送回数据库。问题的原因是返回的数据量超过了php.ini文件设置的压缩大小,我不想更改ini文件,因为如果以后需要迁移或分发该文件以供他人使用,这会导致问题。所以我需要的是CodeIgniter相当于 // Send XML data in 8196 block chunks $start=0; // The XML data may

我到处找,找不到解决问题的办法。我正在尝试将我在其他位置(如smf和wordpress)使用的php类转换为codeigniter库。目前我唯一的问题是将数据发送回数据库。问题的原因是返回的数据量超过了php.ini文件设置的压缩大小,我不想更改ini文件,因为如果以后需要迁移或分发该文件以供他人使用,这会导致问题。所以我需要的是CodeIgniter相当于

// 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();
//以8196个块块的形式发送XML数据
$start=0;
//XML数据可能很大,因此我们需要
//将数据分块发送到MySQL驱动程序以避免
//超过MySQL的最大数据包大小。
while($startstrlen($xml))$end=strlen($xml);
$statement->send_long_data(3,substr($xml,$start,$end-$start));
$start=$end;
}
$start=0;
while($startstrlen($xml))$end=strlen($xml);
$statement->send_long_data(4,substr($xml,$start,$end-$start));
$start=$end;
}
$statement->execute();

我已将问题缩小到发送长数据。我已经修改了文件中的所有其他内容,并且运行良好。有人知道在CodeIgniter中正确处理最大数据包大小的正确方法吗?

发现了我的问题,该表默认为MyISAM,需要使用InnoDB

为供其他人参考,可使用sql命令更改此设置

ALTER TABLE `tablename` ENGINE = InnoDB;

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

为供其他人参考,可使用sql命令更改此设置

ALTER TABLE `tablename` ENGINE = InnoDB;