The problem with inserting Zend_Db_Table with great content

I've been using the Zend Framework for a long time, but now I have a problem that puzzled me. I have a table (MySQL) with two columns ( id and msg ). The id field is the auto-increment value, and the msg field is the longtext type.

The following code should work fine to insert a record into a table:

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

Whenever $content is just a blah string value, it works just fine, as it should. But fieldtype not a longtext type for no reason, the content will be quite large. So, now I'm trying to place about 14kb of data in $content , an exception does not occur, inserting the database seems to work, but only for the first 6kb. The rest of the data is already gone ?!

When I try to use mysql_connect , mysql_query , etc. in oldfashioned, it all works like a charm. So this is really a problem with the Zend base ... Has anyone else experienced this?

+4
source share
1 answer

Configuration

  • Zend Framework v1.11.10
  • Zend_Db_Table configured using PDO_MYSQL adapter
  • MySQL database table for two columns; id (auto increment)

Problem

  • UTF8 encoded INSERT 14kb HTML in longtext column
  • Zend_Db_Table truncates data to 6kb

Test

  • mysql_query can mysql_query the same data without problems
  • Zend_Db_Table can SELECT all data without problems
  • error_reporting(-1) shows "no errors, warnings or notifications"
  • mediumblob works great

Problem isolation

  • Change the column to mediumtext . Does the insert work?
  • Have you checked what the query looks like? See Comment above from namesnik.
  • How many bytes are written in failed inserts? Is it consistent?
0
source

Source: https://habr.com/ru/post/1399454/


All Articles