Thread: 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? TIA. -- "And I'm happy, because you make me feel good, about me." - Melvin Udall ----------------------------------------------------------------- Martín Marqués email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------
On Fri, Dec 01, 2000 at 07:30:19PM -0300, Martin A. Marques wrote: > 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 adam@newsnipple.com | taco ... and following that theme, Florida is http://www.newsnipple.com| the big tamale ... and the only tamale that '88 EX500 | counts any more." -- Dan Rather
On Fri, 1 Dec 2000, Adam Haberlach wrote: > On Fri, Dec 01, 2000 at 07:30:19PM -0300, Martin A. Marques wrote: > > 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 ----------------------------------------------------------------- Martín Marqués email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------
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 ----- From: "Martin A. Marques" <martin@math.unl.edu.ar> To: "Adam Haberlach" <adam@newsnipple.com> Cc: <pgsql-general@postgresql.org> Sent: Monday, December 04, 2000 6:35 AM Subject: Re: [GENERAL] postgres blobs and PHP > On Fri, 1 Dec 2000, Adam Haberlach wrote: > > > On Fri, Dec 01, 2000 at 07:30:19PM -0300, Martin A. Marques wrote: > > > 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 > ----------------------------------------------------------------- > Martín Marqués email: martin@math.unl.edu.ar > Santa Fe - Argentina http://math.unl.edu.ar/~martin/ > Administrador de sistemas en math.unl.edu.ar > -----------------------------------------------------------------