postgres blobs and PHP

postgres blobs and PHP

Post by Martin A. Marque » Sun, 03 Dec 2000 07:33:02



I know I bothered with this, but I just don't get it.
Lets say I have a test table like this in a certain database:

CREATE TABLE test (
id_test         SERIAL,
blob_text       oid
);

Now I want to insert a good chunk of text in the blob_text field with PHP.
PHP has some postgres functions like pg_locreate, pg_lowrite, pg_loread, etc,
but it never specifies the table and it doesn't specify the field in the
table.
Now how does php know where to write the chunk of text (or the image, or
whatever)?
Can someone give me a hand?

TIA.

--
"And I'm happy, because you make me feel good, about me." - Melvin Udall
-----------------------------------------------------------------

Santa Fe - Argentina            http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

 
 
 

postgres blobs and PHP

Post by Adam Haberla » Sun, 03 Dec 2000 11:07:39



> I know I bothered with this, but I just don't get it.
> Lets say I have a test table like this in a certain database:

> CREATE TABLE test (
> id_test            SERIAL,
> blob_text  oid
> );

> Now I want to insert a good chunk of text in the blob_text field with PHP.
> PHP has some postgres functions like pg_locreate, pg_lowrite, pg_loread, etc,
> but it never specifies the table and it doesn't specify the field in the
> table.
> Now how does php know where to write the chunk of text (or the image, or
> whatever)?
> Can someone give me a hand?

        It sticks it somewhere.  It is up to you to keep track of the Oid that
lo_create gives you and stash it in your table so you can lo_open it later.

--
Adam Haberlach           |"California's the big burrito, Texas is the big

http://www.veryComputer.com/*.com| the big tamale ... and the only tamale that
'88 EX500                | counts any more." -- Dan Rather

 
 
 

postgres blobs and PHP

Post by Martin A. Marque » Wed, 06 Dec 2000 02:09:40




> > I know I bothered with this, but I just don't get it.
> > Lets say I have a test table like this in a certain database:

> > CREATE TABLE test (
> > id_test               SERIAL,
> > blob_text     oid
> > );

> > Now I want to insert a good chunk of text in the blob_text field with PHP.
> > PHP has some postgres functions like pg_locreate, pg_lowrite, pg_loread, etc,
> > but it never specifies the table and it doesn't specify the field in the
> > table.
> > Now how does php know where to write the chunk of text (or the image, or
> > whatever)?
> > Can someone give me a hand?

>    It sticks it somewhere.  It is up to you to keep track of the Oid that
> lo_create gives you and stash it in your table so you can lo_open it later.

Maybe I wasn't clear enough. I don't see anything related with the oid
field in the lo functions of PHP.
I have done lots of stuffs with PHP and informix, and I think the way
PHP manages the informix blobs is much clearer. I don't know if it's
because of the way informix adds information to the blobs, or that the
guy that made the module had a good idea.
Anyway, I'm still clue-less!

P.D.: If I have to add BIG chunks of text to a database TEXT field, now
a days I would have trouble with Postgres 7.0.x because of the 8k per
tuple limitation. Will this be the same in future 7.1 version? I mean,
will the limitation grow higher, or will it disapear?

Saludos... ;-)

"And I'm happy, because you make me feel good, about me." - Melvin Udall
-----------------------------------------------------------------

Santa Fe - Argentina            http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

 
 
 

postgres blobs and PHP

Post by Adam Lan » Wed, 06 Dec 2000 04:21:53


In 7.1 the limitation will disappear.

**To the list manager:
I think we need to add a disclaimer to the newsgroup messages about this.
Just append something at the bottom of each message. :)

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com

----- Original Message -----



Sent: Monday, December 04, 2000 6:35 AM
Subject: Re: [GENERAL] postgres blobs and PHP



> > > I know I bothered with this, but I just don't get it.
> > > Lets say I have a test table like this in a certain database:

> > > CREATE TABLE test (
> > > id_test SERIAL,
> > > blob_text oid
> > > );

> > > Now I want to insert a good chunk of text in the blob_text field with
PHP.
> > > PHP has some postgres functions like pg_locreate, pg_lowrite,
pg_loread, etc,
> > > but it never specifies the table and it doesn't specify the field in
the
> > > table.
> > > Now how does php know where to write the chunk of text (or the image,
or
> > > whatever)?
> > > Can someone give me a hand?

> > It sticks it somewhere.  It is up to you to keep track of the Oid that
> > lo_create gives you and stash it in your table so you can lo_open it
later.

> Maybe I wasn't clear enough. I don't see anything related with the oid
> field in the lo functions of PHP.
> I have done lots of stuffs with PHP and informix, and I think the way
> PHP manages the informix blobs is much clearer. I don't know if it's
> because of the way informix adds information to the blobs, or that the
> guy that made the module had a good idea.
> Anyway, I'm still clue-less!

> P.D.: If I have to add BIG chunks of text to a database TEXT field, now
> a days I would have trouble with Postgres 7.0.x because of the 8k per
> tuple limitation. Will this be the same in future 7.1 version? I mean,
> will the limitation grow higher, or will it disapear?

> Saludos... ;-)

> "And I'm happy, because you make me feel good, about me." - Melvin Udall
> -----------------------------------------------------------------

> Santa Fe - Argentina http://math.unl.edu.ar/~martin/
> Administrador de sistemas en math.unl.edu.ar
> -----------------------------------------------------------------

 
 
 

1. Postgres BLOBS and PHP

Don't know if this is the right place to ask this but here I go:
Lets say I got a database with 4 tables, each one with a diferent oid field.
Now, maybe I haven't read enough, or the docs aren't that good (PHP docs),
but I can't find out how to open a blob that will write to a determined iod
field of a determined table. Any ideas?

What I want to insert and read are large chunks of text. Will Postgres 7.1 be
able to store any size of tuples? I mean, I have heard about compresion and
other things in the TOAST threads, but will this only pull up the 8K row size
limit to a larger size, or will it let me store any size of rows?

Saludos... ;-)

--
"And I'm happy, because you make me feel good, about me." - Melvin Udall
-----------------------------------------------------------------

Santa Fe - Argentina            http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

2. Top Ten Errors In Data Wareousing

3. PHP, Win32, Postgres 7.0

4. Serial Number and Control Numbers of progress 9.1B

5. useability of apache, PHP, Postgres for real business apps

6. CDAORecordset & BLOBS/memo fields

7. useability of apache, PHP, Postgres for real

8. Deployment of Cube over Web

9. postgres to php

10. PHP performance problems with postgres

11. usability of apache, PHP, Postgres for real business apps

12. Postgres and AOLServer (also: PHP and persistent

13. need help with php authentication using form in postgres