Hello,

Mike Baranski wrote:
> 
> Sorry about the previous one, that was a mistake.
> 
> I have the following code to insert a blob into an access OLE object field:

I am not sure if using SQL is the appropriate way to update such object
field.

Anyway, to make this work, such object must be of ODBC type
ODBC_LONGVARBINARY .

Metabase can create tables with BLOB fields properly declared. You may
want to try the driver test script to see what it does and how it shows
in access. Look in lob_test.schema to see how you can define a schema
with LOB fields so Metabase manager class can create one for your needs.

 
> if(($prepared_query=MetabasePrepareQuery($database,"UPDATE incident_blob SET
> data_blob=?, description='new'")))
> {
> 
>   $binary_lob=array(
> 
>                     "Type"=>"inputfile",
>                     "Database"=>$database,
>                     "Error"=>"",
>                     "FileName"=>"test.php"
> 
>                     );
>   if(($success=MetabaseCreateLOB($binary_lob,$blob)))
>     {
>       MetabaseQuerySetBLOB($database,$prepared_query,1,$blob,"data_blob");
>       if(!MetabaseExecuteQuery($database,$prepared_query))
>         $error=MetabaseError($database);
>       MetabaseDestroyLOB($blob);
>     }
>   else
>     {
>       $error=$binary_lob["Error"];
>       echo "Error 1 (CreateLOB): $error\n";
>     }
>   MetabaseFreePreparedQuery($database,$prepared_query);
> 
> }
> else
> {
>   $error=MetabaseError($database);
>   echo "Error 2 (Prepare): $error\n";
> }
> 
> I can connect and query the database otherwise, and it works fine.  The
> problem is with the Blobs, that update statement is not getting run.  There's
> only 1 row in the table, but the description and ole object do not get
> updated.  If I switch the driver to use mysql as opposed to odbc, it works
> fine on an identical table (on linux, not windows).  Any ideas?

Did you verify that MetabaseExecuteQuery call above succeeds? If it does
not succeed, what is the error message that is returned?

Regards,
Manuel Lemos


> 
> Mike B.
> 
> On Wednesday 26 December 2001 02:49 pm, Manuel Lemos wrote:
> > Hello,
> >
> > Mike Baranski wrote:
> > > Hi, I'm trying to store a binary file in an access database, I'm using an
> > > ole type, and I think that it's getting inserted OK.  My problem is that
> > > I don't know how to pull it out...  How do you select the stuff that's in
> > > an ole object out of the database and display it, a jpg, for example.  I
> > > can't even get the raw data.  I've tried converting it to base 16 and
> > > inserting it, but I still can't pull it out.  I know how to do this in
> > > mysql, so posting that won't help.  I need to know how to do this with
> > > access.
> >
> > If you are using ODBC, you may want to try Metabase because it supports
> > BLOB fields with any ODBC driver. Metabase is Open Source and is freely
> > available here.
> >
> > http://phpclasses.UpperDesign.com/browse.html/package/20
> >
> > Regards,
> > Manuel Lemos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to