diff --git a/functions/pgsql.xml b/functions/pgsql.xml
index f0e597361c..5870d9e741 100644
--- a/functions/pgsql.xml
+++ b/functions/pgsql.xml
@@ -35,17 +35,17 @@
postmaster &
- pg_connect("", "", "", "", "dbname");
+ pg_connect("dbname=MyDbName");
OK
postmaster -i &
- pg_connect("", "", "", "", "dbname");
+ pg_connect("dbname=MyDbName";
OK
postmaster &
- pg_connect("localhost", "", "", "", "dbname");
+ pg_connect("host=localhost dbname=MyDbName");
Unable to connect to PostgreSQL server: connectDB() failed:
Is the postmaster running and accepting TCP/IP (with -i)
@@ -55,7 +55,7 @@
postmaster -i &
- pg_connect("localhost", "", "", "", "dbname");
+ pg_connect("host=localhost dbname=MyDbName");
OK
@@ -63,9 +63,18 @@
- One can also establish a connection with the following command:
- $conn = pg_Connect("host=localhost port=5432
- dbname=chris");
+ One can establish a connection with the following value pairs
+ set in the command string:
+ $conn = pg_Connect("host=myHost port=myPort tty=myTTY
+ options=myOptions user=myUser password=myPassword dbname=myDB");
+
+
+
+ The previous syntax of:
+ $conn = pg_connect ("host", "port", "options", "tty",
+ "dbname")
+
+ Has been depreciated.
To use the large object (lo) interface, it is necessary to enclose
@@ -78,7 +87,7 @@
Using Large Objects
<?php
- $database = pg_Connect ("", "", "", "", "jacarta");
+ $database = pg_Connect ("dbname=jacarta");
pg_exec ($database, "begin");
$oid = pg_locreate ($database);
echo ("$oid\n");
@@ -164,29 +173,42 @@ echo $cmdtuples . " <- cmdtuples affected.";
int pg_connect
- string host
- string port
- string options
- string tty
- string dbname
+ string conn_string
Returns a connection index on success, or false if the connection
- could not be made. Opens a connection to a PostgreSQL
- database. Each of the arguments should be a quoted string,
- including the port number. The options and tty arguments are
- optional and can be left out. This function returns a connection
- index that is needed by other PostgreSQL functions. You can have
- multiple connections open at once.
+ could not be made. Opens a connection to a PostgreSQL database.
+ The arguments should be within a quoted string.
+
+ Using pg_connect arguments
+
+<?php
+$dbconn = pg_Connect ("dbname=mary");
+//connect to a database named "mary"
+$dbconn2 = pg_Connect ("host=localhost port=5432 dbname=mary");
+//connect to a database named "mary" on "localhost" at port "5432"
+$dbconn3 = pg_Connect ("user=lamb passwd=baaaa dbname=mary ");
+//connect to a database named "mary" with a username and password
+?>
+
+
+ The arguments available include dbname
+ port, host,
+ tty, options,
+ user, and password
- A connection can also established with the following command:
- $conn = pg_connect("dbname=marliese port=5432");
- Other parameters besides dbname and
- port are host,
- tty, options,
- user, and password.
+ This function returns a connection index that is needed by other
+ PostgreSQL functions. You can have multiple connections open at
+ once.
+
+
+ The previous syntax of:
+ $conn = pg_connect ("host", "port", "options", "tty",
+ "dbname")
+
+ Has been depreciated.
See also pg_pconnect.
@@ -326,7 +348,7 @@ echo $cmdtuples . " <- cmdtuples affected.";
PostgreSQL fetch array
<?php
-$conn = pg_pconnect ("", "", "", "", "publisher");
+$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
@@ -401,7 +423,7 @@ echo $arr["author"] . " <- array\n";
<?php
$database = "verlag";
-$db_conn = pg_connect ("localhost", "5432", "", "", $database);
+$db_conn = pg_connect ("host=localhost port=5432 dbname=$database");
if (!$db_conn): ?>
<H1>Failed connecting to postgres database <? echo $database ?></H1> <?
exit;
@@ -474,7 +496,7 @@ pg_close ($db_conn);
Postgres fetch row
<?php
-$conn = pg_pconnect ("", "", "", "", "publisher");
+$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
@@ -1012,42 +1034,41 @@ for ($i=0; $i<$num; $i++) {
-
+
- pg_pconnect
-
- Open a persistent PostgreSQL connection
-
+ pg_connect
+ Open a PostgreSQL connection
Description
- int pg_pconnect
- string host
- string port
- string options
- string tty
- string dbname
+ int pg_connect
+ string conn_string
Returns a connection index on success, or false if the connection
- could not be made. Opens a persistent connection to a PostgreSQL
- database. Each of the arguments should be a quoted string,
- including the port number. The options and tty arguments are
- optional and can be left out. This function returns a connection
- index that is needed by other PostgreSQL functions. You can have
- multiple persistent connections open at once. See also
- pg_connect.
+ could not be made. Opens a connection to a PostgreSQL database.
+ The conn_string should be a quoted string.
+ The arguments available include dbname
+ port, host,
+ tty, options,
+ user, and password
- A connection can also established with the following command:
- $conn = pg_pconnect("dbname=marliese port=5432");
- Other parameters besides dbname and
- port are host,
- tty, options,
- user and password.
+ This function returns a connection index that is needed by other
+ PostgreSQL functions. You can have multiple connections open at once.
+
+
+ The previous syntax of:
+ $conn = pg_pconnect ("host", "port", "options", "tty",
+ "dbname")
+
+ Has been depreciated.
+
+
+ See also pg_connect.