Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Mysql longblob / longtext as resource #613

KJLJon opened this Issue Jul 11, 2013 · 5 comments


3 participants

KJLJon commented Jul 11, 2013

I think we should allow support for importing resources into longblob or longtext columns

I think it makes sense to have longblob and longtext as a resource because you can run into max_packet_size limits with mysql if it isn't a resource.

See: Yii issue/2634

KJLJon commented Jul 16, 2013

Alright, as I have looked more into this issue, PDO seems to still limited it by the max_packet_size (mysql server setting), but it allows for the client to send it in chunks to mysql (making bigger files to be sent to the mysql server). The PDO has a max_packet_size limit which using this method goes around.

Server has max_packet_size set to 1M. Usually PDO wont be able to send a large file (500K) w/o chunking it into smaller pieces (using PDO::PARAM_LOB to bind the param). But the mysql server will still only allow the max size to be 1M.

@cebe cebe was assigned Sep 18, 2013


cebe commented Sep 18, 2013

Have done this for cubrid, will check it for mysql too.

@qiangxue qiangxue modified the milestone: 2.1, 2.0 RC, 2.0 GA Apr 16, 2014

@cebe cebe added a commit that referenced this issue Jun 25, 2014

@cebe cebe added mysql blob and longblob to the list
issue #613

@cebe cebe modified the milestone: 2.0 GA, 2.0 RC Jun 25, 2014


cebe commented Jun 25, 2014

@KJLJon can you show how you would retrieve data as resource with plain PDO?
As far as I see this is just not possible with MySQL and it will give you a string anyway...

KJLJon commented Jun 26, 2014

Unfortunately, for retrieving the data, there seems to be a bug in the MySQL PDO:

When I initially created this ticket I was only working with storing the data, but I could see why you might not want to implement it if it's retrieving it as a string instead of a resource.

@tvdavid tvdavid pushed a commit to tvdavid/yii2 that referenced this issue Jul 24, 2014

@cebe cebe added mysql blob and longblob to the list
issue #613

@qiangxue qiangxue modified the milestone: 2.0.1, 2.0 GA Sep 27, 2014

@cebe cebe modified the milestone: 2.0.1, 2.0.x Oct 19, 2014


cebe commented Nov 27, 2016

seems this is not possible due to PDO bug. Closing this for now.

@cebe cebe closed this Nov 27, 2016

@cebe cebe removed this from the 2.0.x milestone Nov 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment