diff --git a/functions/pgsql.xml b/functions/pgsql.xml index 4723f03c26..5264c8124a 100644 --- a/functions/pgsql.xml +++ b/functions/pgsql.xml @@ -237,6 +237,34 @@ $dbconn3 = pg_Connect ("user=lamb passwd=baaaa dbname=mary "); + + + pg_end_copy + Sync with PostgreSQL backend + + + Description + + + bool pg_end_copy + resource + connection + + + + + pg_end_copy syncs PostgreSQL frontend with + the backend after doing a copy operation. It must be issued or + the backend may get "out of sync" with the frontend. Returns + TRUE if successfull, FALSE otherwise. + + + For further details and an example, see also + pg_put_line. + + + + pg_errormessage @@ -1056,6 +1084,57 @@ for ($i=0; $i<$num; $i++) { + + + pg_put_line + Send a NULL-terminated string to PostgreSQL backend + + + Description + + + bool pg_put_line + resource + connection_id + + string data + + + + pg_put_line sends a NULL-terminated string + to the PostgreSQL backend server. This is useful for example for + very high-speed inserting of data into a table, initiated by + starting a PostgreSQL copy-operation. That final NULL-character + is added automatically. Returns TRUE if successfull, FALSE + otherwise. + + + + Note the application must explicitly send the two characters "\." + on a final line to indicate to the backend that it has finished + sending its data. + + + + See also pg_end_copy. + + High-speed insertion of data into a table + +<?php + $conn = pg_pconnect ("dbname=foo"); + pg_exec($conn, "create table bar (a int4, b char(16), d float8)"); + pg_exec($conn, "copy bar from stdin"); + pg_put_line($conn, "3\thello world\t4.5\n"); + pg_put_line($conn, "4\tgoodbye world\t7.11\n"); + pg_put_line($conn, "\\.\n"); + pg_end_copy($conn); +?> + + + + + + pg_result