pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nick Stone <nick@harelane.com>
To: 'Volkan YAZICI' <volkan.yazici@gmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Pqsocket not implemented in PHP
Date: Thu, 30 Jun 2005 13:25:56 +0100
Message-ID: <20050630122757.B99AE252A5E@smtp.nildram.co.uk> (raw)
In-Reply-To: <7104a73705063004386e866f92@mail.gmail.com>

Ok that's fair enough - I was concerned that the internal structure of PHP
might be a stumbling block - also since nearly every other function was
implemented I suspected there had to be a good reason why that's not been. I
can easily write the code a different way.

Thanks for your help

Nick 

-----Original Message-----
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]
On Behalf Of Volkan YAZICI
Sent: 30 June 2005 12:38
To: Nick Stone
Cc: pgsql-php@postgresql.org
Subject: Re: [PHP] Pqsocket not implemented in PHP

Hi,

On 6/30/05, Nick Stone <nick@harelane.com> wrote:
> I'm a bit confused the FD is all that is required for the select call 
> - so I think what you're saying is that the postgres socket open 
> mechanism isn't the same in php as the postgres C development library.

No. PHP has an internal struct type to record `resource's. (As you know,
resources are data sources for other functions and they're specific to PHP.)
Therefore, it's not just passing PQsocket() value to
select() function. I'm not very experienced in the PHP internals, but AFAIC,
you need to store socket FD in a specific struct and use other Zend API
calls to proccess 'em.

To sum up, I'd advice you to take a look at ext/socket/socket.c in PHP
source code for a better point of view.

> I say this because I've implemented this exact mechanism in C++ before 
> without problem so I'm really not quite following - sorry.

In C++, you just passed PQsocket() value to select() condition. But in PHP
it's not as easy as this. You need to store PQsocket() value in a specific
struct. Let me explain this in PHP way:

When we look at socket_create() function:
  resource socket_create ( int domain, int type, int protocol )
socket_create() doesn't return an `int' for socket FD, it returns a socket
`resource'. That's what I try to mean with "PHP's internal data source
representation".

Regards.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend






view thread (5+ messages)

Message-ID: <20050630122757.B99AE252A5E@smtp.nildram.co.uk>
Permalink:  ../20050630122757.B99AE252A5E@smtp.nildram.co.uk/
Also on:    postgresql.org/message-id/20050630122757.B99AE252A5E@smtp.nildram.co.uk

 · 

reply

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: nick@harelane.com, volkan.yazici@gmail.com
  Subject: Re: Pqsocket not implemented in PHP
  In-Reply-To: <20050630122757.B99AE252A5E@smtp.nildram.co.uk>
  References: <7104a73705063004386e866f92@mail.gmail.com> <20050630122757.B99AE252A5E@smtp.nildram.co.uk>

* 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