I want to store huge content in db and my sample text is 16129 characters in length when i tried to execute this query it is showing "error:The requested URL could not be retrieved" in firefox and "no-data received" in chrome.
I use LONGTEXT
as datatype for column content
in DB.
I also tried to execute the query directly in phpmyadmin with same huge content.It is working correctly.
The code is shown below.
public function _getConnection($type = 'core_write') {
return Mage::getSingleton('core/resource')->getConnection($type);
}
public function testdbAction(){
$db = $this->_getConnection();
$current_time=now();
$text="The European languages are members of the same family...... ...Europe uses the same vocabulary. The ";
//$text is 16129 characters in length
$sql = "INSERT into test(`usercontent_id`,`app_id`,`module_id`,`customer_id`,`content`,`created_time`,`updated_time`,`item_id`,`index_id`,`position_id`) VALUES (NULL, 15, 9,2,'" .$text. "','" . $current_time . "','" . $current_time . "',1003,5,4)";
//echo $sql; exit;
$db->query($sql);
}
But when I tried the same in Magento, $db->query($sql);
does not able to run the query. Kindly advice on this.
$db->exec($sql)
it executes the query and returns the amount of affected rows. Not sure if this will make a difference for you.