typo, parameter and type fixes
[mdref/mdref-pq] / pq / Connection.md
1 # class pq\Connection
2
3 The connection to the PostgreSQL server.
4
5 See the [General Usage](pq/Connection/: General Usage) page for an introduction on how to use this class.
6
7 ## Constants:
8 ### Connection Flags:
9 * PERSISTENT
10 (Re-)open a persistent connection.
11 * ASYNC
12 If the connection is not already open, perform the connection attempt [asynchronously](pq/Connection/: Asynchronous Usage).
13
14 ### Connection Status:
15 * OK
16 Everything well; if a connection has been newly and synchronously created, the connection will always have this status right after creation.
17 * BAD
18 Broken connection; consider pq\Connection::reset() or recreation.
19 * STARTED
20 Waiting for connection to be made.
21 * MADE
22 Connection okay; waiting to send.
23 * AWAITING_RESPONSE
24 Waiting for a response from the server.
25 * AUTH_OK
26 Received authentication; waiting for backend start-up to finish.
27 * SSL_STARTUP
28 Negotiating SSL encryption.
29 * SETENV
30 Negotiating environment-driven parameter settings.
31
32 ### Transaction Status:
33 * TRANS_IDLE
34 No active transaction.
35 * TRANS_ACTIVE
36 A transaction command is in progress.
37 * TRANS_INTRANS
38 Idling in a valid transaction block.
39 * TRANS_INERROR
40 Idling in a failed transaction block.
41 * TRANS_UNKNOWN
42 Bad connection.
43
44 ### Polling Status:
45 * POLLING_FAILED
46 The connection procedure has failed.
47 * POLLING_READING
48 Select for read-readiness.
49 * POLLING_WRITING
50 Select for write-readiness.
51 * POLLING_OK
52 The connection has been successfully made.
53
54 ### Event Listener Types:
55 * EVENT_NOTICE
56 Register the event handler for notices.
57 * EVENT_RESULT
58 Register the event handler for any created results.
59 * EVENT_RESET
60 Register the event handler for connection resets.
61
62
63 ## Properties:
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/: Asynchronous Usage).
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/: Asynchronous Usage) 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().
82
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.
96
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.