[PHP-DB] PHP5 + Postgres 8.0.0 + pg_transaction_status

2005-07-05 Thread Jo

Sorry if this was already mentioned on the list, but I couldn't find it.

One of our developpers wants to use the pg_transaction_status() command 
on one of our servers.


This sample code (as taken from de documentation):

  $dbconn = pg_connect(dbname=x host=xxx.xxx.xxx.xxx user= 
password=xxx) or die(Could not connect);

  $stat = pg_transaction_status($dbconn);
  if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
 echo 'Connection is bad';
  } else if ($stat === PGSQL_TRANSACTION_IDLE) {
 echo 'Connection is currently idle';
  } else {
 echo 'Connection is in a transaction state';
  }

produces the following error:

Fatal error: Call to undefined function pg_transaction_status() in 
test.php on line 14


The php manual states the following:

 Not all functions are supported by all builds. It depends on your 
libpq (The PostgreSQL C Client interface) version and how libpq is 
compiled. If there is missing function, libpq does not support the 
feature required for the function.


I have installed Postgresql 8.0.0 from source and php 5.0.4 also from 
source.


so my question is: how does postgresql 8.0.x need to be 
compiled/installed for the pg_transaction_status() command to work?


Thanks for any ideas you might have.

Kind regard,
Jo.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] PHP5 + Postgres 8.0.0 + pg_transaction_status

2005-07-05 Thread Jo De Haes
Thanks for your reply, I think I've found the cause. The function just 
doesn't exist in php 5.0.4. It's in the CVS, we're checking now if it's 
available in the 5.1b2 release.

This url is a similar discussion where they point to updates in the CVS.
http://groups.google.be/group/pgsql.interfaces.php/browse_frm/thread/d3341e51e51094d8/be3c9e252b5ee3fa?q=pg_transaction_status()rnum=1hl=nl#be3c9e252b5ee3fa

On 7/5/05, Martín Marqués martin@bugs.unl.edu.ar wrote:
 
 El Mar 05 Jul 2005 06:33, Jo escribió:
 
  This sample code (as taken from de documentation):
 
  $dbconn = pg_connect(dbname=x host=xxx.xxx.xxx.xxx user=
  password=xxx) or die(Could not connect);
  $stat = pg_transaction_status($dbconn);
  if ($stat === PGSQL_TRANSACTION_UNKNOWN) {
  echo 'Connection is bad';
  } else if ($stat === PGSQL_TRANSACTION_IDLE) {
  echo 'Connection is currently idle';
  } else {
  echo 'Connection is in a transaction state';
  }
 
  produces the following error:
 
  Fatal error: Call to undefined function pg_transaction_status() in
  test.php on line 14
 
 pg_connect seems to work, so I would guess (I haven't install PG8, nor 
 PHP5
 yet) that something in the compiling didn't work properly. Maybe you 
 should
 look for error detecting certain PG components, or see which version of 
 libpq
 it found, and if it is the version on libpq that you installed with PG8.
 
 You don't by the way have another version on PG installed?
 
  The php manual states the following:
 
  Not all functions are supported by all builds. It depends on your
  libpq (The PostgreSQL C Client interface) version and how libpq is
  compiled. If there is missing function, libpq does not support the
  feature required for the function.
 
 Yes, but you have the latest version of libpq (the one that comes with
 PostgreSQL 8.0.0). The only thing that can be happening is that PHP is
 finding another libpq in the way.
 
  I have installed Postgresql 8.0.0 from source and php 5.0.4 also from
  source.
 
 Update PostgreSQL to the latest 8.0.x version (lots of bugs were fixed 
 since).
 
 
 --
 09:33:15 up 2 days, 18:18, 1 user, load average: 0.83, 0.70, 0.63
 -
 Lic. Martín Marqués | select 'mmarques' || '@' || 
 'unl.edu.arhttp://unl.edu.ar
 '
 Centro de Telematica | DBA, Programador, Administrador
 Universidad Nacional
 del Litoral
 -