note 51173 added to function.mysqli-stmt-bind-result

From: Date: Tue, 22 Mar 2005 17:10:39 +0000
Subject: note 51173 added to function.mysqli-stmt-bind-result
Groups: php.notes 
Request: Send a blank email to php-notes+get-86798@lists.php.net to get a copy of this message
A potential problem exists in binding result parameters from a prepared statement which reference large datatypes like mediumblobs. One of our database tables contains a table of binary image data. Our largest image in this table is around 50Kb, but even so the column is typed as a mediumblob to allow for files larger than 64Kb. I spent a frustrating hour trying to figure out why mysqli_stmt_bind_result choked while trying to allocate 16MB of memory for what should have been at most a 50Kb result, until I realized the function is checking the column type first to find out how big a result _might_ be retrieved, and attempting to allocate that much memory to contain it. My solution was to use a more basic mysqli_result() query. Another option might have been to retype the image data column as blob (64Kb limit). ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-stmt-bind-result.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51173 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51173&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51173&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51173&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51173&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51173&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51173&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86798) next »