Reputation: 73
I've got a question regarding a mysterious doctrine query error. Long story short: I'm trying to store longblob data within my database (which can go up to x00mb for example), so i did the following steps: Create my own longblob type and field, register it according to: https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html Doctrine custom data type
My MySQL database looks like: so i think it works?
mysql> describe DataBlocks;
+-----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| data_type_id_id | int(11) | NO | MUL | NULL | |
| project_id_id | int(11) | NO | MUL | NULL | |
| data_block_name | varchar(100) | YES | | NULL | |
| content | longblob | YES | | NULL | |
| comment | longtext | YES | | NULL | |
| ts_added | datetime | NO | | NULL | |
+-----------------+--------------+------+-----+---------+----------------+
My Symfony4.1 FormType file field is as follows:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('dataBlockName', TextType::class)
->add('content', FileType::class)
I also adjusted the lines in my php.ini file for unlimited file size (i know this isn't really secure but.. it's just for now)
post_max_size = 0M
upload_max_filesize = 0M
And I get this error when my entity manager flushes the entity:
An exception occurred while executing 'INSERT INTO
DataBlocks
(data_block_name, content, comment, ts_added, data_type_id_id, project_id_id) VALUES (?, ?, ?, ?, ?, ?)' with params ["BTC_DOGE_tradehistory", Resource id #66, "450mb", "2018-10-08 10:19:44", 1, 1]: Warning: Error while sending QUERY packet. PID=6016
Your help would be kindly appreciated!
FYI: it works for small files, but when i try to upload something big it becomes that vague error
Upvotes: 3
Views: 252
Reputation: 639
The query describe in the exception tells you that the column content
has for value a PHP resource. So i think it's a cast problem. Blob data are stored as bytes string. You also have possible issue with server configuration. There is Apache/Nginx or whatever, PHP but also the server sql.
Here an example for mysql: doc
Upvotes: 1