RE: [PHP-DB] 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: [EMAIL PROTECTED] web: www.BarloworldOptimus.com -Original Message- From: Peter Beckman [mailto:beckman;purplecow.com] Sent: 29 October 2002 05:47 PM To: David Russell Cc: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] web: www.BarloworldOptimus.com --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php smime.p7s Description: application/pkcs7-signature
[PHP-DB] Interbase BLOB problem
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: [EMAIL PROTECTED] web: www.BarloworldOptimus.com smime.p7s Description: application/pkcs7-signature
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: [EMAIL PROTECTED] web: www.BarloworldOptimus.com --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Interbase blob question
Hi, is there a way to treat the output of ibase_blob_echo? I want to do some str_replace with its content before displaying it. thank you, yves -- PHP Database 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]
[PHP-DB] Interbase Blob
This is my page to extract image (from blob) in a interbase table. I call it with :echo src=\blob2img.php?id_product=.$id_product.\ ; ?php //BLOB2JPG $conn = ibase_connect($host,$user,$pass,$charset,$buffers,$dialect,$rules) $set = ibase_query(SELECT IMAGE from products where (id_product = $id_product)); $row = ibase_fetch_row($set); ibase_blob_echo($row[0]); header(Content-type: image/jpeg); ibase_close($conn); ? My problem is that the images are too slow. Solutions ? -- PHP Database 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]
[PHP-DB] Interbase BLOB
This is my page to extract image (as blob) in a interbase table. I call it with :echo src=\blob2img.php?id_product=.$id_product.\ ; but i don't see the image ?php //BLOB2JPG // in = id_product $host = 10.10.0.200:/home/interbase/WEB02/WEBG02; $user = TEST_USER; $pass = PassUser; $charset=; $buffers=10; $dialect=3; $rules = CLIENT; $conn = ibase_connect($host,$user,$pass,$charset,$buffers,$dialect,$rules) $set = ibase_query(SELECT IMAGE from products where (id_product = $id_product)); $row = ibase_fetch_row($set); ibase_blob_echo($row[0]); header(Content-type: image/jpeg); ibase_close($conn); ? -- PHP Database 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]
[PHP-DB] Interbase blob
I have many problem to view image stored like blob in interbase6. Is impossible. I Use ibase_blob_echo(). my php is 4.0.5
[PHP-DB] Interbase BLOB Insertion Problem
Hi, I want to insert data in to a blob. So I followed the steps in de docs, but when I try to execute this script in the IBConsole: begin declare section; based on test.v1 document; based on test.v1.segment BlobV1Buffer; based on test.state CA; unsigned short BlobV1Len; end declare section; declare CursorV1 cursor for insert blob v1 into test; open CursorV1 into :document; sprintf(BlobV1Buffer, 'First blob tekst'); BlobV1Len = strlen(BlobV1Buffer); insert cursor CursorV1 values (:BlobV1Buffer:BlobV1Len); close CursorV1; insert into test (state,v1) values ('CA',:document); an error message pops up: error: Dynamic SQL Error SQL error code = -104 Token unknown - line 1, char 0 begin Statement: begin declare section How do I solve this problem? Thanks. -- PHP Database 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]
Odp: [PHP-DB] Interbase BLOB Insertion Problem
Od: "Xanir" [EMAIL PROTECTED] Temat: [PHP-DB] Interbase BLOB Insertion Problem begin declare section; based on test.v1 document; based on test.v1.segment BlobV1Buffer; based on test.state CA; unsigned short BlobV1Len; end declare section; This is DSQL statement, you cann't use it in ISQL! For detailed description of IB BLOB hadling in PHP go to www.open-database.de Cheers Jarek Zgoda -- PHP Database 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]