diff --git a/reference/pgsql/functions/pg-end-copy.xml b/reference/pgsql/functions/pg-end-copy.xml index db5be676d7..5ad7f05eca 100644 --- a/reference/pgsql/functions/pg-end-copy.xml +++ b/reference/pgsql/functions/pg-end-copy.xml @@ -1,5 +1,5 @@ - + @@ -19,7 +19,55 @@ doing a copy operation performed by pg_put_line. pg_end_copy must be issued, otherwise the PostgreSQL server may get out of - sync with the frontend and will report an error. &return.success; + sync with the frontend and will report an error. + + + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + + <function>pg_end_copy</function> example + + +]]> + + diff --git a/reference/pgsql/functions/pg-put-line.xml b/reference/pgsql/functions/pg-put-line.xml index c73ecb45f9..53097aa81a 100644 --- a/reference/pgsql/functions/pg-put-line.xml +++ b/reference/pgsql/functions/pg-put-line.xml @@ -1,5 +1,5 @@ - + @@ -20,16 +20,23 @@ 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. &return.success; + to the PostgreSQL backend server. This is needed in conjunction + with PostgreSQL's COPY FROM command. + + COPY is a high-speed data loading interface + supported by PostgreSQL. Data is passed in without being parsed, + and in a single transaction. + + + An alternative to using raw pg_put_line commands + is to use pg_copy_from. This is a far simpler + interface. The application must explicitly send the two characters "\." on the last line to indicate to the backend that it has finished - sending its data. + sending its data, before issuing pg_end_copy. @@ -43,11 +50,46 @@ + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + data + + + A line of text to be sent directly to the PostgreSQL backend. A NULL + terminator is added automatically. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + &reftitle.examples; - High-speed insertion of data into a table + <function>pg_put_line</function> example - + @@ -19,33 +19,20 @@ stringquery - pg_query returns a query result resource if - query could be executed. It returns &false; on failure or if - connection is not a valid connection. Details about the error can + pg_query executes the query + on the specified database connection. + + + If an error occurs, and &false; is returned, details of the error can be retrieved using the pg_last_error - function if connection is valid. - pg_query sends an SQL statement to - the PostgreSQL database specified by the - connection resource. The - connection must be a valid connection that - was returned by pg_connect or - pg_pconnect. The return value of this - function is an query result resource to be used to access the - results from other PostgreSQL functions such as - pg_fetch_array. + function if the connection is valid. + + - - connection is an optional parameter for - pg_query. If - connection is not set, default - connection is used. Default connection is the last connection - made by pg_connect or - pg_pconnect. - Although connection can be omitted, it - is not recommended, since it could be a cause of hard to find - bug in script. + is not recommended, since it can be the cause of hard to find + bugs in scripts. @@ -53,11 +40,78 @@ This function used to be called pg_exec. pg_exec is still available for compatibility - reasons but users are encouraged to use the newer name. + reasons, but users are encouraged to use the newer name. + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + query + + + The SQL statement or statements to be executed. + + + + + + + + + &reftitle.returnvalues; + + A query result resource on success, or &false; on failure. + + + + + &reftitle.examples; + + + <function>pg_query</function> example + +\n"; +} + +?> +]]> + + + + + &reftitle.seealso; diff --git a/reference/pgsql/functions/pg-send-query.xml b/reference/pgsql/functions/pg-send-query.xml index 355331c3f2..463adefc79 100644 --- a/reference/pgsql/functions/pg-send-query.xml +++ b/reference/pgsql/functions/pg-send-query.xml @@ -1,5 +1,5 @@ - + @@ -21,29 +21,66 @@ stringquery - pg_send_query send asynchronous query to the + pg_send_query sends a query or queries asynchronously to the connection. Unlike - pg_query, it can send multiple query to - PostgreSQL and get the result one by one using - pg_get_result. Script execution is not blocked - while query is executing. Use - pg_connection_busy to check connection is - busy (i.e. query is executing). Query may be cancelled by calling + pg_query, it can send multiple queries at once to + PostgreSQL and get the results one by one using + pg_get_result. + + + Script execution is not blocked while the queries are executing. Use + pg_connection_busy to check if the connection is + busy (i.e. the query is executing). Queries may be cancelled using pg_cancel_query. - Although user can send multiple query at once, user cannot send - multiple query over busy connection. If query is sent while - connection is busy, it waits until last query is finished and - discards all result. + Although the user can send multiple queries at once, multiple queries + cannot be sent over a busy connection. If a query is sent while + the connection is busy, it waits until the last query is finished and + discards all its results. + + + + + &reftitle.parameters; + + + + connection + + + PostgreSQL database connection resource. When + connection is not present, the default connection + is used. The default connection is the last connection made by + pg_connect or pg_pconnect. + + + + + query + + + The SQL statement or statements to be executed. + + + + + + &reftitle.returnvalues; + &return.success; + + Use pg_get_result to determine the query result. + + + &reftitle.examples; - Asynchronous Queries + <function>pg_send_query</function> example