X-Original-To: pgsql-docs-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A415C9DC867 for ; Sun, 1 Jan 2006 12:25:04 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25170-02 for ; Sun, 1 Jan 2006 12:25:03 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fep04.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) by postgresql.org (Postfix) with ESMTP id B98239DC84E for ; Sun, 1 Jan 2006 12:24:17 -0400 (AST) Received: from alamut ([85.97.162.227]) by fep04.ttnet.net.tr with ESMTP id <20060101162130.BHHR1378.fep04.ttnet.net.tr@alamut> for ; Sun, 1 Jan 2006 18:21:30 +0200 Date: Sun, 1 Jan 2006 18:21:08 +0200 From: Volkan YAZICI To: pgsql-docs@postgresql.org Subject: PHP, PostgreSQL Extension Message-ID: <20060101162107.GA1589@alamut> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-NAI-Spam-Rules: 1 Rules triggered BAYES_00=-2.5 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.227 required=5 tests=[AWL=-0.571, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, DNS_FROM_RFC_WHOIS=0.879] X-Spam-Score: 2.227 X-Spam-Level: ** X-Archive-Number: 200601/1 X-Sequence-Number: 3391 Hi, Async. functions are introduced in the 5.1.0 release, but in my opinion, there doesn't exist any supportive functions to use 'em. Let's discuss this on an example: if (!pg_connection_busy($dbconn)) { pg_send_query($dbconn, "select * from authors; select count(*) from authors;"); } $res1 = pg_get_result($dbconn); Above example is brought you from the official pg_get_result() documentation. 1. How will we learn whether the data arrived from server or not? There doesn't exist any PQsocket() similar function to make a socket_select() call on it. There're two ways to solve this problem: 1.1. Pray god to make our queries finished before calling pg_get_result(). 1.2. Enter to an endless loop bounded by pg_connection_busy(). Furthermore, you're free to try any adhoc sleep() method inside the loop. (Recommended way in the documenation.) IMHO, this is a very important missing property in the async. functions. Without this, there shouldn't be any place of async. queries in a production server. 2. What if we couldn't transmit whole data out of socket? Is there any equivalent for PQflush() or PQconsumeInput()? Yes, there're some places in the code which hold PQconsumeInput() calls, but shouldn't it be better if we'd mention about this in the documentation? Other issues: 3. Can somebody explain me the existence of non-standard pg_select(), pg_insert(), pg_update() and pg_delete() functions? Are there any equivalent of these functions in other PHP interfaces? Anyway, this is not the matter. What's the targeted crowd in the implementation of these functions? Are there any stuff we cannot achieve without using these functions? 4. I don't want to mention about the not described properties in the documentation. (For instance, pg_select() function's options parameter.) Regards.