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_store_result behavior #65

Open mattbucci opened 10 months ago

mattbucci commented 10 months ago

Postgres doesn't have this behavior so we'd have to store it in a global and fake the behavior

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

/**
 * Transfers a result set from the last query.
 *
 * This function is a wrapper for the pg_store_result function. It is used to transfer the
 * result set from the last query executed on the given connection, which used the pg_STORE_RESULT
 * flag. This function must be called after executing a query that returns a result set (like SELECT).
 * It allows the complete result set to be transferred to the client and then utilized via the
 * pg_fetch_* functions. It's particularly useful when the result set is expected to be accessed
 * multiple times.
 *
 * @param PgSql\Connection $connection The pg connection resource.
 * @return \PgSql\Result|false A buffered result object or FALSE if an error occurred.
 */
function wpsqli_store_result(&$connection)
{
    throw new \Exception("PG4WP: Not Yet Implemented");
    // mysqli_store_result => Not needed in PostgreSQL.
    // PostgreSQL's pg_query automatically stores the results without a separate call.
    //return true;
}