pg_set_chunked_rows_size
(PHP 8 >= 8.4.0)
pg_set_chunked_rows_size — Set the query results to be retrieved in chunk mode
说明
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 size
rows.
This function must be called before retrieving results with pg_get_result().
This function is only available when libpq is version 17 or higher.
参数
connection
-
PgSql\Connection 实例。
size
- The number of rows to be retrieved in each chunk.
错误/异常
If size
is less than 1
,
a ValueError will be thrown.
示例
示例 #1 pg_result_memory_size() 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() - 获得查询结果的状态
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/function.pg-set-chunked-rows-size.php