Re: Best WebInterface...?
От | Robert McGinnis |
---|---|
Тема | Re: Best WebInterface...? |
Дата | |
Msg-id | Pine.LNX.4.30.0101300721270.17695-100000@localhost обсуждение исходный текст |
Ответ на | Re: Best WebInterface...? (Alfred Perlstein <bright@wintelcom.net>) |
Список | pgsql-novice |
On Mon, 29 Jan 2001, Alfred Perlstein wrote: > Date: Mon, 29 Jan 2001 14:13:38 -0800 > From: Alfred Perlstein <bright@wintelcom.net> > To: Herb Pabst <herbie@nextearth.com> > Cc: pgsql-list <pgsql-novice@postgresql.org> > Subject: Re: Best WebInterface...? > > * Herb Pabst <herbie@nextearth.com> [010129 14:00] wrote: > > I'm think of using PHP with Postgresql. Are there > > any limitations to PHP that will keep me from > > using PGsql to it fullest? Any recommendations? > > I'm not sure if this is true, but I think php doesn't support > cursors, so large queiries may have to be sucked into the > webserver instead of processed one row at a time. > > I have used cursors with php for over a year. The problem is that is does not support them natively; any code that tests the call for pg_exec may fail since the return is undefined. Here's how I write the code: //Note this is off the top of my head, you code may vary :-) $q = "begin"; $count = "select count (*) from clients where active='t'"; $qry = "declare fred cursor for select * from clients where active='t'; $fetch = "fetch 20 from fred"; $fini = "commit"; if(! $res1 = pg_exec( $connect, $count ) ){ return 0; } if ( 0 < pg_numrows( $res1 ) ){ pg_exec( $connect, $q ); //undefined behavior pg_exec( $connect, $qry ); //undefined behavior if (! $res= pg_exec( $connect, $q ) ){ return 0; } pg_exec($connect, $fini); //undefined bevhavior if ( 0 >= pg_numrows( $res ) ){ return 0; } do_something ( $res ) } pg_free_result( $res ); pg_free_result( $res1); Move forward and backward works as before the fetch. The part that I don't like is the inability to check whether the transaction block querys work; I had to console myself with counting the number of results I should get for the same query. The bad part is that there is WAY to many queries being executed; the good part is it save a great many lines of quasi-convoluted logic whilst incrementing to the n or n+1 row of an answer. I hope this helps, --+*==#==*+----+*==#==*+----+*==#==*+----+*==#==*+----+*==#==*+----+*==#==*+-- fprefect@dustpuppy.net Currently doing fieldwork as: Elite.net Support Robert McGinnis "So an object class contains the data, plus everything the class can do. But is it a direct object, indirect object, or object of a preposition?"6/7/97
В списке pgsql-novice по дате отправления: