Skip to content

Commit be36bf5

Browse files
committed
Add test for pg_put_line() and pg_end_copy()
1 parent a19f655 commit be36bf5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

ext/pgsql/tests/06copy_2.phpt

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
PostgreSQL copy functions, part 2
3+
--SKIPIF--
4+
<?php include("skipif.inc"); ?>
5+
--FILE--
6+
<?php
7+
8+
include('config.inc');
9+
10+
$db = pg_connect($conn_str);
11+
12+
pg_query($db, 'CREATE TABLE test_copy (x int)');
13+
14+
pg_query($db, 'COPY test_copy FROM STDIN');
15+
16+
pg_put_line($db, "1\n");
17+
pg_put_line($db, "\\N\n");
18+
pg_put_line($db, "\\.\n");
19+
pg_end_copy($db);
20+
21+
var_dump(pg_fetch_all_columns(pg_query($db, 'SELECT * FROM test_copy ORDER BY 1')));
22+
23+
pg_query($db, 'DROP TABLE test_copy');
24+
25+
?>
26+
--EXPECT--
27+
array(2) {
28+
[0]=>
29+
string(1) "1"
30+
[1]=>
31+
NULL
32+
}

0 commit comments

Comments
 (0)