From: Daniel Lowrey Date: Mon, 17 Mar 2014 12:45:37 +0000 (-0600) Subject: Merge branch 'pgsql-async' into PHP-5.6 X-Git-Tag: php-5.6.0beta1~3^2~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=098b4e8f5a900d05b6719d834ea39537f36f2d5f;p=php Merge branch 'pgsql-async' into PHP-5.6 * pgsql-async: Support async pgsql connections and non-blocking queries --- 098b4e8f5a900d05b6719d834ea39537f36f2d5f diff --cc NEWS index c5fbb6cd99,1682ef0669..d5d1ddb859 --- a/NEWS +++ b/NEWS @@@ -75,6 -68,6 +75,17 @@@ PH without preparing them, while still passing parameters separately from the command text using PQexecParams. (Matteo) ++- Pgsql: ++ . Read-only access to the socket stream underlying database connections is ++ exposed via a new pg_socket() function to allow read/write polling when ++ establishing asynchronous connections and executing queries in non-blocking ++ applications. (Daniel Lowrey) ++ . Asynchronous connections are now possible using the PGSQL_CONNECT_ASYNC ++ flag in conjunction with a new pg_connect_poll() function and connection ++ polling status constants. (Daniel Lowrey) ++ . New pg_flush() and pg_consume_input() functions added to manually complete ++ non-blocking reads/writes to underlying connection sockets. (Daniel Lowrey) ++ - SQLite: . Updated the bundled libsqlite to the version 3.8.3.1 (Anatol) diff --cc UPGRADING index 9cfc0a642d,9cfc0a642d..0ae1d4a6ec --- a/UPGRADING +++ b/UPGRADING @@@ -127,6 -127,6 +127,12 @@@ PHP 5.6 UPGRADE NOTE - Stream crypto method specification now accepts flags instead of values allowing support for multiple discrete protocols in a given stream. ++- PostgreSQL database connections may now be established asynchronously using ++ new constants and polling functions in ext/pgsql. ++ ++- Non-blocking read/write query behavior now optionally available in database ++ operations using the ext/pgsql extension. ++ ======================================== 2. Changes in SAPI modules ======================================== @@@ -177,6 -177,6 +183,12 @@@ - Pgsql: pg_insert()/pg_select()/pg_update()/pg_delete() are no longer EXPERIMENTAL. ++ The following functions no longer block until query write completion if the ++ socket stream underlying a database connection is set to non-blocking mode: ++ . pg_send_execute() ++ . pg_send_prepare() ++ . pg_send_query() ++ . pg_send_query_params() ======================================== 5. New Functions @@@ -198,6 -198,6 +210,12 @@@ Added ldap_modify_batch($link_identifier, $dn, $modifications) described in https://wiki.php.net/rfc/ldap_modify_batch. ++- Pgsql: ++ Added pg_socket($connection) to allow async connections and non-blocking IO ++ Added pg_connect_poll($connection) for establishing async connections ++ Added pg_consume_input($connection) for non-blocking query result consumption ++ Added pg_flush($connection) for non-blocking query write completion ++ - PDO_pgsql Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0) Added PDO::pgsqlGetPid() @@@ -256,6 -256,6 +274,12 @@@ - pg_select() returns PostgreSQL query resource when query is executed. - Added extended flag parameter for pg_meta_data(). pg_meta_data() always returns "is enum" attribute. ++ - The new pg_socket() function returns a socket stream with no behavior other ++ than to allow IO-readiness polling on a DB connection socket. Calling ++ stream_set_blocking() on its result enables non-blocking behavior. ++ - Passing the new PGSQL_CONNECT_ASYNC flag to pg_connect() allows applications ++ to poll for IO readiness via pg_connect_poll() and establish connections ++ asynchronously. - PDO_pgsql: - Added PDO::PGSQL_ATTR_DISABLE_PREPARES constant to execute the queries @@@ -274,6 -274,6 +298,18 @@@ - Pgsql: PGSQL_DML_ESCAPE int(4096) ++ PGSQL_CONNECT_ASYNC ++ PGSQL_CONNECTION_STARTED ++ PGSQL_CONNECTION_MADE ++ PGSQL_CONNECTION_AWAITING_RESPONSE ++ PGSQL_CONNECTION_AUTH_OK ++ PGSQL_CONNECTION_SSL_STARTUP ++ PGSQL_CONNECTION_SETENV ++ PGSQL_POLLING_FAILED ++ PGSQL_POLLING_READING ++ PGSQL_POLLING_WRITING ++ PGSQL_POLLING_OK ++ PGSQL_POLLING_ACTIVE - OpenSSL: STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT int(9)