magento mysql 5.6_mysql – 如何在magento中执行大型SQL查询?

我想在db中存储大量内容,我的示例文本长度为16129个字符,当我尝试执行此查询时,它显示“错误:无法检索请求的URL”在firefox中并且“无数据已收到”在chrome中.

此外,我使用LONGTEXT作为DB中文本的数据类型.

我也尝试直接在phpmyadmin中执行查询它是否正常工作.

代码如下所示.

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)";

$db->query($sql);

}

我该如何处理?任何建议或帮助..

解决方法:

尝试使用$db-> exec($sql)而不是$db->查询($sql)

标签:mysql,magento

来源: https://codeday.me/bug/20190703/1370399.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值