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 Thread Functions #59

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#L271C1-L286C2

/**
 * Returns the thread ID for the current connection.
 *
 * This function is a wrapper for the pg_thread_id function. It retrieves the thread ID used by
 * the current connection to the PostgreSQL server. This ID can be used as an argument to the KILL
 * statement to terminate a connection. It is useful for debugging and managing PostgreSQL connections
 * and can be used to uniquely identify the connection within the server's process.
 *
 * @param PgSql\Connection $connection The pg connection resource.
 * @return int The thread ID for the current connection.
 */
function wpsqli_thread_id(&$connection)
{
    throw new \Exception("PG4WP: Not Yet Implemented");
    // mysqli_thread_id => No direct equivalent. PostgreSQL does not provide thread ID in the same manner as MySQL.
}

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

/**
 * Returns whether the client library is thread-safe.
 *
 * This function is a wrapper for the pg_thread_safe function. It indicates whether the 
 * pg client library that PHP is using is thread-safe. This is important information when 
 * running PHP in a multi-threaded environment such as with the worker MPM in Apache or when
 * using multi-threading extensions in PHP.
 *
 * @return bool Returns TRUE if the client library is thread-safe, FALSE otherwise.
 */
function wpsqli_thread_safe()
{
    throw new \Exception("PG4WP: Not Yet Implemented");
    // mysqli_thread_safe => No direct equivalent. PostgreSQL's thread safety is dependent on PHP's thread safety.
}