3 The connection to the PostgreSQL server.
5 See the [General Usage](pq/Connection/:%20General%20Usage) page for an introduction on how to use this class.
10 (Re-)open a persistent connection.
12 If the connection is not already open, perform the connection attempt [asynchronously](pq/Connection/:%20Asynchronous%20Usage).
14 ### Connection Status:
16 Everything well; if a connection has been newly and synchronously created, the connection will always have this status right after creation.
18 Broken connection; consider pq\Connection::reset() or recreation.
20 Waiting for connection to be made.
22 Connection okay; waiting to send.
24 Waiting for a response from the server.
26 Received authentication; waiting for backend start-up to finish.
28 Negotiating SSL encryption.
30 Negotiating environment-driven parameter settings.
32 ### Transaction Status:
34 No active transaction.
36 A transaction command is in progress.
38 Idling in a valid transaction block.
40 Idling in a failed transaction block.
46 The connection procedure has failed.
48 Select for read-readiness.
50 Select for write-readiness.
52 The connection has been successfully made.
54 ### Event Listener Types:
56 Register the event handler for notices.
58 Register the event handler for any created results.
60 Register the event handler for connection resets.
64 * public (readonly) int $status
65 A [connection status constant](pq/Connection#Connection.Status:) value.
66 * public (readonly) int $transactionStatus
67 A [transaction status constant](pq/Connection#Transaction.Status:) value.
68 * public (readonly) resource $socket
69 The server socket resource.
70 * public (readonly) bool $busy
71 Whether the connection is busy with [asynchronous operations](pq/Connection/:%20Asynchronous%20Usage).
72 * public (readonly) string $errorMessage
73 Any error message on failure.
74 * public (readonly) array $eventHandlers
75 List of registered event handlers.
76 * public string $encoding = NULL
77 Connection character set.
78 * public bool $unbuffered = FALSE
79 Whether to fetch [asynchronous](pq/Connection/:%20Asynchronous%20Usage) results in unbuffered mode, i.e. each row generates a distinct pq\Result.
80 * public bool $nonblocking = FALSE
81 Whether to set the underlying socket nonblocking, useful for asynchronous handling of writes. See also pq\Connection::flush().
83 ### Connection Information:
84 * public (readonly) string $db
85 The database name of the connection.
86 * public (readonly) string $user
87 The user name of the connection.
88 * public (readonly) string $pass
89 The password of the connection.
90 * public (readonly) string $host
91 The server host name of the connection.
92 * public (readonly) string $port
93 The port of the connection.
94 * public (readonly) string $options
95 The command-line options passed in the connection request.
97 ### Inheritable Defaults:
98 * public int $defaultFetchType = pq\Result::FETCH_ARRAY
99 Default fetch type for future pq\Result instances.
100 * public int $defaultAutoConvert = pq\Result::CONV_ALL
101 Default conversion bitmask for future pq\Result instances.
102 * public int $defaultTransactionIsolation = pq\Transaction::READ_COMMITTED
103 Default transaction isolation level for future pq\Transaction instances.
104 * public bool $defaultTransactionReadonly = FALSE
105 Default transaction readonlyness for future pq\Transaction instances.
106 * public bool $defaultTransactionDeferrable = FALSE
107 Default transaction deferrability for future pq\Transaction instances.