xref: /PHP-8.4/ext/pgsql/tests/06copy_2.phpt (revision c15988aa)
1--TEST--
2PostgreSQL copy functions, part 2
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php include("inc/skipif.inc"); ?>
7--FILE--
8<?php
9
10include('inc/config.inc');
11$table_name = 'table_06copy_2';
12
13$db = pg_connect($conn_str);
14
15pg_query($db, "CREATE TABLE {$table_name} (x int)");
16
17pg_query($db, "COPY {$table_name} FROM STDIN");
18
19pg_put_line($db, "1\n");
20pg_put_line($db, "\\N\n");
21pg_put_line($db, "\\.\n");
22pg_end_copy($db);
23
24var_dump(pg_fetch_all_columns(pg_query($db, "SELECT * FROM {$table_name} ORDER BY 1")));
25?>
26--CLEAN--
27<?php
28include('inc/config.inc');
29$table_name = 'table_06copy_2';
30
31$db = pg_connect($conn_str);
32pg_query($db, "DROP TABLE IF EXISTS {$table_name}");
33?>
34--EXPECT--
35array(2) {
36  [0]=>
37  string(1) "1"
38  [1]=>
39  NULL
40}
41