duan00529 2012-03-02 19:33 采纳率: 100%
浏览 73

Zend_Db_Table插入大内容的问题

I've been using Zend Framework for quite a while now, but now I have an issue that's got me puzzled. I have a table (MySQL) with just 2 columns (id and msg). The id field is an auto increment value and the msg field is a longtext type.

The following code should work just fine for inserting a record into the table:

$t = new Zend_Db_Table('table1');
$id = $t->insert(array('msg' => $content));

Whenever $content is just a plain string value like 'blah', it works just fine, like it should. But the fieldtype is not a longtext type for no reason, the content will be quite large. So now I try to place about 14kb of data in $content, no exception occurs, the database insert seems to have worked, but only for the first 6kb. The rest of the data is just gone?!

When I try to use to oldfashioned mysql_connect, mysql_query, etc routines, it all works like a charm. So it's really seems to be a Zend framework issue... Has anybody else experienced this?

  • 写回答

1条回答 默认 最新

  • doudg60800 2012-03-10 10:42
    关注

    Configuration

    • Zend Framework v1.11.10
    • Zend_Db_Table is configured with the PDO_MYSQL adapter
    • MySQL database table two columns; id (autoincrement)

    Issue

    • Attempting to INSERT 14kb of UTF8-encoded HTML into longtext column
    • Zend_Db_Table truncates the data at 6kb

    Tests

    • mysql_query can INSERT the same data without issue
    • Zend_Db_Table can SELECT all the data without issue
    • setting error_reporting(-1) reveals 'no errors, warnings or notices'
    • mediumblob works fine

    Isolating the issue

    • Change the column to a mediumtext. Does the insert work now?
    • Have you checked what the query actually looks like? See comment above from namesnik.
    • How many bytes get written on the failed inserts? Is it consistent?
    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法