PostgreSQL-For-Wordpress / postgresql-for-wordpress

A maintained fork of https://wordpress.org/plugins/postgresql-for-wordpress/
GNU General Public License v2.0
220 stars 71 forks source link

Implement wpsqli_poll #69

Open mattbucci opened 10 months ago

mattbucci commented 10 months ago

https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/bf2ef7f4185d5327543ded7df42efb16ff79fa7c/pg4wp/driver_pgsql.php#L1248

/**
 * Polls connections for results.
 *
 * This function is a wrapper for the pg_poll function. It can be used to poll multiple
 * connections to check if one or more of the connections have results available for client-side
 * processing. It is useful when you have multiple asynchronous queries running and need to handle
 * them as soon as their results become available. The function takes variable references for read,
 * error, and reject arrays, and modifies them to indicate which connections have results, which
 * have errors, and which were rejected respectively.
 *
 * @param array &$read Array of connections to check for outstanding results that can be read.
 * @param array &$error Array of connections on which an error occurred.
 * @param array &$reject Array of connections rejected because no asynchronous query
 *                       has been run on them.
 * @param int $sec Number of seconds to wait, must be non-negative.
 * @param int $usec Number of microseconds to wait, must be non-negative.
 * @return int|false Number of ready connections upon success, FALSE otherwise.
 */
function wpsqli_poll(&...$args)
{
    throw new \Exception("PG4WP: Not Yet Implemented");
    // mysqli_poll => No direct equivalent in PostgreSQL.
    // Polling for result availability is not a concept that is directly exposed in PostgreSQL's PHP functions.
    // Asynchronous query handling in PHP with PostgreSQL typically involves using separate processes or coroutines.
}