File: pg_set_chunked_rows_size.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (49 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--TEST--
PostgreSQL pg_set_chunked_rows_size
--EXTENSIONS--
pgsql
--SKIPIF--
<?php 
include("inc/skipif.inc");
if (!function_exists("pg_set_chunked_rows_size")) die("skip pg_set_chunked_rows_size unsupported");
?>
--FILE--
<?php

include('inc/config.inc');
$table_name = "test_chunked_rows_size";

$conn = pg_connect($conn_str);
pg_query($conn, "CREATE TABLE {$table_name} (num int, str text)");

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

var_dump(pg_send_query($conn, "SELECT * FROM ".$table_name.";"));
try {
	pg_set_chunked_rows_size($conn, -1);
} catch (\ValueError $e) {
	echo $e->getMessage() . PHP_EOL;
}

var_dump(pg_set_chunked_rows_size($conn, 1));
$result = pg_get_result($conn);
var_dump(pg_result_status($result) === PGSQL_TUPLES_CHUNK);
var_dump(pg_num_rows($result));
var_dump(pg_set_chunked_rows_size($conn, 10));
?>
--CLEAN--
<?php
include('inc/config.inc');
$table_name = "test_chunked_rows_size";

$conn = pg_connect($conn_str);
pg_query($conn, "DROP TABLE IF EXISTS {$table_name}");
?>
--EXPECTF--
bool(true)
pg_set_chunked_rows_size(): Argument #2 ($size) must be between 1 and %d
bool(true)
bool(true)
int(1)
bool(false)