From: Volkan YAZICI <volkan.yazici@gmail.com>
To: Nick Stone <nick@harelane.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Pqsocket not implemented in PHP
Date: Thu, 30 Jun 2005 13:10:48 +0300
Message-ID: <7104a7370506300310710e365c@mail.gmail.com> (raw)
In-Reply-To: <20050630093709.3A198252676@smtp.nildram.co.uk>
References: <20050630093709.3A198252676@smtp.nildram.co.uk>
Hi,
On 6/30/05, Nick Stone <nick@harelane.com> wrote:
> I'm currently implementing a standalone app using php cli. Part of the app
> connects to Postgres and waits for a notification using the "Listen
> <tablename>" SQL. In the postgres C lib there is a function called
> "Pqsocket" which returns the file-descriptor of the socket connection to
> Postgres. With this I can use a simple select server to sleep on this
> interface and others in the application.
>
> Does anybody now of a patch to make this available under PHP or does the
> structure of PHP code effectively make this type approach impossible?
You can write a very simple patch returns socket FD using PQsocket().
But, AFAIC, it's not as simple as it seems to listen a socket using
just its FD value. As I understand from the source code, resource
required by socket_open() function has its own internal struct
representation, which means you need to be familiar with PHP internal
data types and mechanism before writing a patch. Therefore, it's not
impossible to implement such a feature, but, to be honest, it needs a
hard work.
IMHO, you can enter a loop with pg_last_notice() by using usleep(). I
won't think it'd cost so much system resource for you.
Regards.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: volkan.yazici@gmail.com, nick@harelane.com
Subject: Re: Pqsocket not implemented in PHP
In-Reply-To: <7104a7370506300310710e365c@mail.gmail.com>
References: <20050630093709.3A198252676@smtp.nildram.co.uk> <7104a7370506300310710e365c@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox