WPDB driver does not use multiquery so I haven't implemented it.
Since PostgreSQL does not have a built-in PHP function that directly mimics mysqli_more_results(), you would manage multi-statement transaction control differently.
In PostgreSQL, you can execute multiple statements with a single call to pg_query(), but you will get back only the result of the last statement. To execute multiple statements and handle them individually, you would typically use multiple calls to pg_query()
flush() specifically calls the functions wpsqli_more_results and wpsqli_next_result which I've currently just set to return false
/**
* Executes one or multiple queries which are concatenated by a semicolon.
*
* This function is a wrapper for the pg_multi_query function. It allows execution of
* multiple SQL statements sent to the PostgreSQL server in a single call. This can be useful to
* perform a batch of SQL operations such as an atomic transaction that should either complete
* entirely or not at all. After calling this function, the results of the queries can be
* processed using pg_store_result() and pg_next_result(). It is important to ensure
* that any user input included in the queries is properly sanitized to avoid SQL injection.
*
* @param PgSql\Connection $connection The pg connection resource.
* @param string $query The queries to execute, concatenated by semicolons.
* @return bool Returns TRUE on success or FALSE on the first error that occurred.
* If the first query succeeds, the function will return TRUE even if
* a subsequent query fails.
*/
function wpsqli_multi_query(&$connection, $query)
{
// Store the initial SQL query
$initial = $query;
// Rewrite the SQL query for compatibility with Postgres
$sql = pg4wp_rewrite($query);
throw new \Exception("PG4WP: Not Yet Implemented");
// mysqli_multi_query => No direct equivalent. Multiple queries must be executed separately in PostgreSQL.
}
/**
* Checks if there are any more result sets from a multi query.
*
* mysqli_more_results => No direct equivalent in PostgreSQL.
* PostgreSQL does not support multiple results like MySQL's multi_query function.
* It returns TRUE if one or more result sets are available from the previous calls to
* pg_multi_query(), otherwise FALSE.
*
* @param PgSql\Connection $connection The pg connection resource.
* @return bool Returns TRUE if there are more result sets from previous multi queries and
* FALSE otherwise.
*/
function wpsqli_more_results(&$connection)
{
// mysqli_more_results => No direct equivalent in PostgreSQL.
// PostgreSQL does not have a built-in function to check for more results from a batch of queries.
return false;
}
/**
* Moves the internal result pointer to the next result set returned from a multi query.
*
* mysqli_next_result => No direct equivalent in PostgreSQL.
* PostgreSQL does not support multiple results like MySQL's multi_query function.
* FALSE if there are no more result sets, or FALSE with an error if there is a problem moving the result pointer.
*
* @param PgSql\Connection $connection The pg connection resource.
* @return bool Returns TRUE on success or FALSE on failure (no more results or an error occurred).
*/
function wpsqli_next_result(&$connection)
{
// mysqli_next_result => No direct equivalent in PostgreSQL.
// PostgreSQL does not support multiple results like MySQL's multi_query function.
return false;
}
WPDB driver does not use multiquery so I haven't implemented it.
Since PostgreSQL does not have a built-in PHP function that directly mimics mysqli_more_results(), you would manage multi-statement transaction control differently.
In PostgreSQL, you can execute multiple statements with a single call to pg_query(), but you will get back only the result of the last statement. To execute multiple statements and handle them individually, you would typically use multiple calls to pg_query()
flush() specifically calls the functions
wpsqli_more_results
andwpsqli_next_result
which I've currently just set to return falsehttps://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/bf2ef7f4185d5327543ded7df42efb16ff79fa7c/pg4wp/driver_pgsql.php#L521C1-L545C2
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/bf2ef7f4185d5327543ded7df42efb16ff79fa7c/pg4wp/driver_pgsql.php#L989
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/bf2ef7f4185d5327543ded7df42efb16ff79fa7c/pg4wp/driver_pgsql.php#L1006