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

2005-11-11 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Bogus
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

Well, i allready tried this:



Exaclty the same problem.

Fix it.

Kind Regards

Florian Engelhardt


Previous Comments:


[2005-11-11 08:51:46] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from http://www.php.net/mysql_stmt_bind_param

Character Description
b corresponding variable is a blob and will be send in
packages

For sending a blob in packages, you have to use
mysql_stmt_send_long_data. If you don't want to do this (e.g. your data
doesn't need escaping and is < max_allowed_package) use type "s"
(=string).



[2005-11-09 16:07:10] f dot engelhardt at 21torr dot com

This Problem is very annoying, becouse i am using innodb tables with
foreign key constraints, and if i use mysqli_stmt_send_long_data() for
any of the fields, all the other arent NULL anymore. So my constraint
fails!

Example:


without mysqli_stmt_send_long_data() i have the problem as described,
and with mysqli_stmt_send_long_data() on the blob field, mysql tells
me, that the constraint gets violated!
This can only happen, if the variables $one and $two are not  NULL.



[2005-11-08 23:28:54] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-08 23:26:59] f dot engelhardt at 21torr dot com

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)



[2005-11-08 17:43:53] [EMAIL PROTECTED]

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





The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/35155

-- 
Edit this bug report at http://bugs.php.net/?id=35155&edit=1


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

2005-11-08 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Bogus
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5.0.5
 New Comment:

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


Previous Comments:


[2005-11-08 17:06:19] [EMAIL PROTECTED]

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:
---


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