Hi Thomas,

unfortunately using the files from http://cvs.php.net/viewcvs.cgi/pecl/maxdb
didn't solve the problem, we still get the "-10414 Conversion from binary value to string is not enabled for parameter/column (1)" - error.

If it helps to figure out what we are doing wrong: We are using PHP Version 4.4.2 and Apache 2 running on a linux box.

Any further hints?

Thanks and best regards,
Mario

Hi,

The PHP program you use to insert blob data is correct. Please use the actual 
version of php_maxdb.c on http://cvs.php.net/viewcvs.cgi/pecl/maxdb to avoid 
the conversion error.

If you want to use maxdb_stmt_send_long_data you must use 'b' as bind string in 
maxdb_stmt_bind_param. Of course, the error message you got from binding with 
's' has a wrong parameter number. This will be fixed in a future release.

Regards,

Thomas Simenec
SAP Labs Berlin

-----Original Message-----
From: Mario Rutz [mailto:[EMAIL PROTECTED] Sent: Montag, 27. März 2006 11:05
To: maxdb@lists.mysql.com
Subject: [LIKELY JUNK]PHP module: Inserting values into blob column

Dear List,

I run into problems while trying to insert values into a blob column via the php module. As far as I understand the documentation I would do that with a command sequence like this(assuming that $connection holds a valid connection):

$insert_query = "insert into blobtable (nr, value) values(1,?)";
$insert_stmt = maxdb_prepare($connection, $insert_query);

$null = NULL;
$value ="VALUE";
maxdb_stmt_bind_param($insert_stmt, 'b', $null);
maxdb_stmt_execute($insert_stmt);

maxdb_stmt_send_long_data ($insert_stmt, 0, $value);
maxdb_stmt_close_long_data($insert_stmt, 0);

echo "Row inserted.";

The Table blobtable is created with this statement:

CREATE TABLE "MT"."BLOBTABLE"
(
     "NR" Fixed (6,0) NOT NULL,
     "VALUE"  LONG BYTE  NOT NULL,
     PRIMARY KEY ("NR")
)

When calling the above php-script I get this waring:
maxdb_stmt_execute(): -10414 Conversion from binary value to string is not enabled for parameter/column (1)

Which in a way makes sense, because $value is of type string. Apart from the fact, that this is not what I want to do(storing really large strings and binary data), changing the binding of the parameter to this:
maxdb_stmt_bind_param($insert_stmt, 's', $null);

ends up in this warning:
maxdb_stmt_send_long_data(): Initialization failed [Parameter -1073756220 is not a lob]

Has anyone a hint or an example on how to insert large binary/string values into a blob column via the php module correctly?

Any help is appreciated!

Best regards,
Mario


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to