logo       

RE: Interbase BLOB problem: msg#00705

Subject: RE: Interbase BLOB problem
Hi Peter,

Thanks for this. I have been waiting for the PHP Manuals to include
documentation on the interbase BLOB functions. I need to find a real
connection and download it <grin>

Actually my problem was that I have 2 machines - Windows (development
and testing) and Linux (Server). The site was initially made in an all
Linux environment. Now I am maintaining and expanding on my Windows box.

The problem was with the fopen(<file> "r") which on Windows needs to be
fopen(<file>, "rb") for binary files.

It is all working now.

Thanks again to all.

David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: DavidR@xxxxxxxxxxxxxxxxxxxxx
web: www.BarloworldOptimus.com

-----Original Message-----
From: Peter Beckman [mailto:beckman@xxxxxxxxxxxxx] 
Sent: 29 October 2002 05:47 PM
To: David Russell
Cc: php-db@xxxxxxxxxxxxx
Subject: Re: [PHP-DB] Interbase BLOB problem


Your SQL query doesn't need that semicolon at the end of the query --
lose it.

I never used ibase, so here's what I found from the PHP Manual page for
ibase_query:

Using BLOB

Insert BLOB:

/* create blob */
$blob_id = ibase_blob_create();

/* fill blob */
ibase_blob_add($blob_id, $var_datablob);

/* close new blob */
$blob_id_str = ibase_blob_close($blob_id);

/* insert into table */
ibase_query("INSERT INTO BLOB_TABLE (ID, BLOB) VALUES (1,
?)",$blob_id_str);

Open BLOB:

/* query */
$set = ibase_query("SELECT BLOB FROM BLOB_TABLE WHERE ID = 1");

/* fetche a row */
$row = ibase_fetch_object($set);

/* open BLOB for read */
$blob_id = ibase_blob_open($row->BLOB);

/* get BLOB data */
$stringBLOB = ibase_blob_get($blob_id);

/* print BLOB */
echo $stringBLOB;

/* close new blob */
ibase_blob_close($blob_id);

/* free result */
ibase_free_result($set);

Peter

On Tue, 29 Oct 2002, David Russell wrote:

> Hi all,
>
> I have a file I need to insert into a blob in a interbase table. Code 
> as
> follows:
>
>     $filehandle = fopen($file, "r");
>     $blob_id = ibase_blob_import($filehandle);
>     $qry = "INSERT INTO BPFATTACHMENTS ";
>     $qry = $qry . "(BPFATTACHMENTNO, BPF, ATTACHMENTTYPE, FILENAME, 
> FILESIZE, ATTACHMENT)";
>     $qry = $qry . "VALUES";
>     $qry = $qry . "($bpfAttNo, $BPFNo, $AttachmentType, '$file_name', 
> $file_size, ?);";
>     $res = ibase_query($qry, $blob_id);
>
> I have a ibase_pconnect prior to this.
>
> The problem is that is only adds a tiny part of the file (ie 5k of the

> 200k file) What should I be looking for?
>
> Thanks
>
> David Russell
> IT Support Manager
> Barloworld Optimus (Pty) Ltd
> Tel: +2711 444-7250
> Fax: +2711 444-7256
> e-mail: DavidR@xxxxxxxxxxxxxxxxxxxxx
> web: www.BarloworldOptimus.com
>

------------------------------------------------------------------------
---
Peter Beckman            Systems Engineer, Fairfax Cable Access
Corporation
beckman@xxxxxxxxxxxxx
http://www.purplecow.com/
------------------------------------------------------------------------
---


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Attachment: smime.p7s
Description: S/MIME cryptographic signature

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe