PHP.nl

pg_set_chunked_rows_size

pg_set_chunked_rows_size

Set the query results to be retrieved in chunk mode

bool **pg_set_chunked_rows_size** PgSql\Connection $connection int $size

Set the query results to be retrieved in chunk mode. The query results returned afterward will be divided into multiple chunks, each containing up to rows. This function must be called before retrieving results with . This function is only available when libpq is version 17 or higher. size``pg_get_result

connection``sizeThe number of rows to be retrieved in each chunk.

return.success

If is less than , a will be thrown. size``1``ValueError

Voorbeeld: example

<?php

$conn = pg_connect($conn_str);

for ($i = 0; $i < 10; $i ++) {
  pg_query($conn, "INSERT INTO users DEFAULT VALUES");
}

pg_send_query($conn, "SELECT * FROM users");
pg_set_chunked_rows_size($conn, 1);

$result = pg_get_result($conn);
var_dump(pg_num_rows($result));

// No effect after the result is retrieved
var_dump(pg_set_chunked_rows_size($conn, 10));
int(1)
bool(false)

pg_get_result``pg_result_status