Re: [ADMIN] PHP and autocommit of PostgreSQL 7.4

From: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: aspire420(at)hotpop(dot)com, Sai Hertz And Control Systems <sank89(at)sancharnet(dot)in>, pgsql-php(at)postgresql(dot)org, Rui Hirokawa <rui_hirokawa(at)ybb(dot)ne(dot)jp>, Stig Bakken <ssb(at)fast(dot)no>
Subject: Re: [ADMIN] PHP and autocommit of PostgreSQL 7.4
Date: 2003-12-12 12:43:09
Message-ID: 200312120943.09487.martin@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-php

El Jue 11 Dic 2003 21:36, Martin Marques escribió:
> El Jue 11 Dic 2003 20:25, Robert Treat escribió:
> > (personally i'm down with Scott, application developers should just use
> > begin/commit, but i've met some folks who really look at it the other
> > way)
>
> $db = DB::Connect("pgsql://user:pass(at)host/db");
> $db->autocommit(false);
> $db->query(query1);
> $db->query(query2);
> $db->commit();

Replying to myself isn't a good thing, but I found something interesting here.

By default PEAR::DB has autocommit set to true (it's defined at the begining
on the class), but with the changes in PG 7.4 the default should be false,
which would make it work right.

Now, the problem that I additionally find is that when autocommit is set to
true there isn't a BEGIN / END before and after the query. This should also
change, unless a new function is added to have autocommit changed in the DB
conection and PEAR::DB uses it to change the autocommit setting.

P.D.: I'm adding the pgsql.php authors to the mail to see that they get a copy

--
09:21:01 up 16 days, 15:37, 2 users, load average: 0.61, 0.67, 0.45
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Greg Spiegelberg 2003-12-12 15:05:08 Reindex database
Previous Message Rhaoni Chiu Pereira 2003-12-12 12:39:59 ODBC Driver generates a too big "windows swap file" and it's too slow

Browse pgsql-php by date

  From Date Subject
Next Message Gerard Samuel 2003-12-12 14:19:36 Re: [PHP-DB] pg_result_error()
Previous Message Martin Marques 2003-12-12 00:36:43 Re: [ADMIN] PHP and autocommit of PostgreSQL 7.4