typo, parameter and type fixes
[mdref/mdref-pq] / pq / Result.md
1 # class pq\Result implements Traversable, Countable
2
3 A query result.
4
5 See [Fetching Results](pq/Result/: Fetching Results) for a general overview.
6
7 ## Constants:
8
9 ### Status values:
10
11 * EMPTY_QUERY
12 The query sent to the server was empty.
13 * COMMAND_OK
14 The query did not generate a result set and completed successfully.
15 * TUPLES_OK
16 The query successfully generated a result set.
17 * SINGLE_TUPLE
18 The result contains a single row of the result set when using pq\Connection::$unbuffered.
19 * COPY_OUT
20 COPY data can be received from the server.
21 * COPY_IN
22 COPY data can be sent to the server.
23 * COPY_BOTH
24 COPY in/out data transfer in progress.
25 * BAD_RESPONSE
26 The server sent a bad response.
27 * NONFATAL_ERROR
28 A nonfatal error (notice or warning) occurred.
29 * FATAL_ERROR
30 A fatal error occurred.
31
32
33 ### Fetch types:
34
35 * FETCH_ARRAY
36 Fetch rows numerically indexed, where the index start with 0.
37 * FETCH_ASSOC
38 Fetch rows associatively indexed by column name.
39 * FETCH_OBJECT
40 Fetch rows as stdClass instance, where the column names are the property names.
41
42 ### Conversion bits:
43
44 * CONV_BOOL
45 Automatically convert 'f' and 't' to FALSE and TRUE and vice versa.
46 * CONV_INT
47 Automatically convert integral strings to either int if it fits into maximum integer size or else to float and vice versa.
48 * CONV_FLOAT
49 Automatically convert floating point numbers.
50 * CONV_SCALAR
51 Do all scalar conversions listed above.
52 * CONV_ARRAY
53 Automatically convert arrays.
54 * CONV_DATETIME
55 Automatically convert date strings to pq\DateTime and vice versa.
56 * CONV_JSON
57 Automatically convert JSON.
58 * CONV_ALL
59 Do all of the above.
60
61
62 ## Properties:
63
64 * public (readonly) int $status
65 A [status constant](pq/Result#Status.values:).
66 * public (readonly) string $statusMessage
67 The accompanying status message.
68 * public (readonly) string $errorMessage
69 Any error message if $status indicates an error.
70 * public (readonly) int $numRows
71 The number of rows in the result set.
72 * public (readonly) int $numCols
73 The number of fields in a single tuple of the result set.
74 * public (readonly) int $affectedRows
75 The number of rows affected by a statement.
76 * public (readonly) array $diag
77 Error details. See [PQresultErrorField](https://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD) docs.
78 * public int $fetchType = pq\Result::FETCH_ARRAY
79 The [type of return value](pq/Result#Fetch.types:) the fetch methods should return when no fetch type argument was given. Defaults to pq\Connection::$defaultFetchType.
80 * public int $autoConvert = pq\Result::CONV_ALL
81 What [type of conversions](pq/Result#Conversion.bits:) to perform automatically.