X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1CC055297B for ; Thu, 30 Jun 2005 08:38:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 99121-01 for ; Thu, 30 Jun 2005 11:38:05 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id 4843552970 for ; Thu, 30 Jun 2005 08:38:04 -0300 (ADT) Received: by wproxy.gmail.com with SMTP id i21so74903wra for ; Thu, 30 Jun 2005 04:38:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LyuYkDohzjQvgCVNucTayUiK6TPZ5vzAhsOF06QtCpVcB5AOFtpQnkIAVsavUF2WI/fY6TfZdCIJXeGfxE22kNQ0R9aHwq+1XD+5bxSlfPnQNso/ebWHA8qZGrISXle8pSH/pYNliT9aOAcNUy0PbjolIH/i8BXSHFRJlLwFKp4= Received: by 10.54.142.11 with SMTP id p11mr319559wrd; Thu, 30 Jun 2005 04:38:08 -0700 (PDT) Received: by 10.54.30.45 with HTTP; Thu, 30 Jun 2005 04:38:08 -0700 (PDT) Message-ID: <7104a73705063004386e866f92@mail.gmail.com> Date: Thu, 30 Jun 2005 14:38:08 +0300 From: Volkan YAZICI Reply-To: Volkan YAZICI To: Nick Stone Subject: Re: Pqsocket not implemented in PHP Cc: pgsql-php@postgresql.org In-Reply-To: <20050630105730.9D3E124D2D3@smtp.nildram.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <7104a7370506300310710e365c@mail.gmail.com> <20050630105730.9D3E124D2D3@smtp.nildram.co.uk> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.125 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200506/28 X-Sequence-Number: 3187 Hi, On 6/30/05, Nick Stone 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.