#35155 [Fbk->Opn]: prepared statement with blob field does not work

From: Date: Tue, 08 Nov 2005 22:27:01 +0000
Subject: #35155 [Fbk->Opn]: prepared statement with blob field does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-87889@lists.php.net to get a copy of this message
ID: 35155 User updated by: f dot engelhardt at 21torr dot com Reported By: f dot engelhardt at 21torr dot com -Status: Feedback +Status: Open Bug Type: MySQLi related Operating System: Linux 2.6 PHP Version: 5.0.5 New Comment: it doesn´t work, but the behavior changed a little: Every insert without mysqli_stmt_send_long_data() inserts 0 Bytes into the blob field, with this function it works as in the other version (5.0.5) Previous Comments: ------------------------------------------------------------------------ [2005-11-08 17:43:53] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-11-08 17:06:50] f dot engelhardt at 21torr dot com it seems to work with mysqli_stmt_send_long_data(), but it has to work without, as the doc says, you only have to use it, if you send data larger than max_allowed_packet. This value is set to 16M, that data is only 2mb. Kind regards ------------------------------------------------------------------------ [2005-11-08 17:06:19] sniper@php.net RTFM: http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php ------------------------------------------------------------------------ [2005-11-08 15:29:36] f dot engelhardt at 21torr dot com Description: ------------ Inserting a data into a blob column only inserts some of the data, in most cases between 1 and 200 Bytes, but not allways the same and never all data (which is in this case about 2 mb). I also tried it with mysqli_stmt_send_long_data(), but that was not working either. The table is as followes: CREATE TABLE dbfs_data_chunk ( fileid smallint(5) unsigned NOT NULL, version smallint(5) unsigned NOT NULL default '0', data mediumblob, PRIMARY KEY (fileid,version) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; MySQL-Version: 5.0.15 If i do a base64_encode() it works, but this isn´t a solution, only a bad workaround, which is not acceptable. I also tried MyISAM, the same result. Reproduce code: --------------- <?php $GLOBALS['CONN'] = mysqli_connect(...); $s = file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2'); $one = 1; $two = 2; $q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)'; $stmt = mysqli_stmt_init($GLOBALS['CONN']); mysqli_stmt_prepare($stmt,$q); mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s); //mysqli_stmt_send_long_data($stmt,2,$s); mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); exit; ?> Expected result: ---------------- Should insert the binary data into the table Actual result: -------------- only 1 to 200 Bytes get inserted. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35155&edit=1

« previous php.bugs (#87889) next »