howto insert file in data blob?

openedge2010

New Member
In php:
INSERT INTO PUB.tabla VALUES (values, ,$contenfile,values)";

Where $contenfile is the path of the file you want to put the blob field

Progress Openedge 10.1
Field blob x(8)

Error: [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Syntax error in SQL statement at or about ":\ruta\CFD_B" (10713)
 
KB P91964:
Cause:
Currently for both ODBC and JDBC applications, the values for CLOB (LVARCHAR) and BLOB (LVARBINARY) columns cannot be put directly into the INSERT or UPDATE SQL statements.
...
Fixes:
Use a Prepared Statement to INSERT or UPDATE values for a CLOB or BLOB field as a parameter.

if you are doing this in PHP then use odbc_prepare/odbc_execute... something along the line:

Code:
$handle = fopen($contenfile, "rb");
$contents = fread($handle, filesize($contenfile));
fclose($handle);

$stmt    = odbc_prepare($conn, 'INSERT INTO PUB.tabla VALUES (values, ?, values)');
$success = odbc_execute($stmt, array($contents));
 
Back
Top