Skip to content

Commit

Permalink
Add test for pg_put_line() and pg_end_copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeccati committed Oct 5, 2021
1 parent a19f655 commit be36bf5
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ext/pgsql/tests/06copy_2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
PostgreSQL copy functions, part 2
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php

include('config.inc');

$db = pg_connect($conn_str);

pg_query($db, 'CREATE TABLE test_copy (x int)');

pg_query($db, 'COPY test_copy FROM STDIN');

pg_put_line($db, "1\n");
pg_put_line($db, "\\N\n");
pg_put_line($db, "\\.\n");
pg_end_copy($db);

var_dump(pg_fetch_all_columns(pg_query($db, 'SELECT * FROM test_copy ORDER BY 1')));

pg_query($db, 'DROP TABLE test_copy');

?>
--EXPECT--
array(2) {
[0]=>
string(1) "1"
[1]=>
NULL
}

0 comments on commit be36bf5

Please sign in to comment.