@@ -12,19 +12,19 @@ |
||
12 | 12 | */ |
13 | 13 | class ConnectionException extends \RuntimeException |
14 | 14 | { |
15 | - /** |
|
16 | - * @param string|resource $message alternatively to the message, a connection handler may be given - the last error |
|
17 | - * message on this connection is considered then |
|
18 | - * @param int $code |
|
19 | - * @param Exception $previous |
|
20 | - */ |
|
21 | - public function __construct($message = '', $code = 0, Exception $previous = null) |
|
22 | - { |
|
23 | - if (is_resource($message)) { |
|
24 | - $message = pg_last_error($message); |
|
25 | - } |
|
15 | + /** |
|
16 | + * @param string|resource $message alternatively to the message, a connection handler may be given - the last error |
|
17 | + * message on this connection is considered then |
|
18 | + * @param int $code |
|
19 | + * @param Exception $previous |
|
20 | + */ |
|
21 | + public function __construct($message = '', $code = 0, Exception $previous = null) |
|
22 | + { |
|
23 | + if (is_resource($message)) { |
|
24 | + $message = pg_last_error($message); |
|
25 | + } |
|
26 | 26 | |
27 | - parent::__construct($message, $code, $previous); |
|
28 | - } |
|
27 | + parent::__construct($message, $code, $previous); |
|
28 | + } |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -14,165 +14,165 @@ |
||
14 | 14 | |
15 | 15 | class QueryResult extends Result implements IQueryResult |
16 | 16 | { |
17 | - use RelationMacros; |
|
18 | - |
|
19 | - private $typeDictionary; |
|
20 | - private $numRows; |
|
21 | - private $populated = false; |
|
22 | - /** @var Column[] */ |
|
23 | - private $columns; |
|
24 | - /** @var int[] map: column name => offset of the first column of the name */ |
|
25 | - private $colNameMap; |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * @param resource $resultHandler the result, with the internal pointer at the beginning |
|
30 | - * @param ITypeDictionary $typeDictionary |
|
31 | - * @param string|null $lastNotice last notice captured on the connection |
|
32 | - */ |
|
33 | - public function __construct($resultHandler, ITypeDictionary $typeDictionary, $lastNotice = null) |
|
34 | - { |
|
35 | - parent::__construct($resultHandler, $lastNotice); |
|
36 | - |
|
37 | - $this->typeDictionary = $typeDictionary; |
|
38 | - |
|
39 | - $this->numRows = $this->fetchNumRows(); |
|
40 | - $this->populate(); // not lazy - chances are, when the query was made, the caller will care about its results |
|
41 | - } |
|
42 | - |
|
43 | - private function fetchNumRows() |
|
44 | - { |
|
45 | - $numRows = pg_num_rows($this->handler); |
|
46 | - if ($numRows >= 0 && $numRows !== null) { // NOTE: besides -1, pg_num_rows() might return NULL on error |
|
47 | - return $numRows; |
|
48 | - } |
|
49 | - else { |
|
50 | - throw new ResultException('Error retrieving number of rows of the result.'); |
|
51 | - } |
|
52 | - } |
|
17 | + use RelationMacros; |
|
18 | + |
|
19 | + private $typeDictionary; |
|
20 | + private $numRows; |
|
21 | + private $populated = false; |
|
22 | + /** @var Column[] */ |
|
23 | + private $columns; |
|
24 | + /** @var int[] map: column name => offset of the first column of the name */ |
|
25 | + private $colNameMap; |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * @param resource $resultHandler the result, with the internal pointer at the beginning |
|
30 | + * @param ITypeDictionary $typeDictionary |
|
31 | + * @param string|null $lastNotice last notice captured on the connection |
|
32 | + */ |
|
33 | + public function __construct($resultHandler, ITypeDictionary $typeDictionary, $lastNotice = null) |
|
34 | + { |
|
35 | + parent::__construct($resultHandler, $lastNotice); |
|
36 | + |
|
37 | + $this->typeDictionary = $typeDictionary; |
|
38 | + |
|
39 | + $this->numRows = $this->fetchNumRows(); |
|
40 | + $this->populate(); // not lazy - chances are, when the query was made, the caller will care about its results |
|
41 | + } |
|
42 | + |
|
43 | + private function fetchNumRows() |
|
44 | + { |
|
45 | + $numRows = pg_num_rows($this->handler); |
|
46 | + if ($numRows >= 0 && $numRows !== null) { // NOTE: besides -1, pg_num_rows() might return NULL on error |
|
47 | + return $numRows; |
|
48 | + } |
|
49 | + else { |
|
50 | + throw new ResultException('Error retrieving number of rows of the result.'); |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | //region ICachingDataProcessor |
56 | 56 | |
57 | - public function populate() |
|
58 | - { |
|
59 | - if ($this->populated) { |
|
60 | - return; |
|
61 | - } |
|
62 | - |
|
63 | - $numFields = pg_num_fields($this->handler); |
|
64 | - if ($numFields < 0 || $numFields === null) { |
|
65 | - throw new ResultException('Error retrieving number of fields of the result.'); |
|
66 | - } |
|
67 | - $this->columns = []; |
|
68 | - $this->colNameMap = []; |
|
69 | - for ($i = 0; $i < $numFields; $i++) { |
|
70 | - /* NOTE: pg_field_type() cannot be used for simplicity - multiple types of the same name might exist in |
|
57 | + public function populate() |
|
58 | + { |
|
59 | + if ($this->populated) { |
|
60 | + return; |
|
61 | + } |
|
62 | + |
|
63 | + $numFields = pg_num_fields($this->handler); |
|
64 | + if ($numFields < 0 || $numFields === null) { |
|
65 | + throw new ResultException('Error retrieving number of fields of the result.'); |
|
66 | + } |
|
67 | + $this->columns = []; |
|
68 | + $this->colNameMap = []; |
|
69 | + for ($i = 0; $i < $numFields; $i++) { |
|
70 | + /* NOTE: pg_field_type() cannot be used for simplicity - multiple types of the same name might exist in |
|
71 | 71 | * different schemas. Thus, the only reasonable way to recognize the types is using their OIDs, |
72 | 72 | * returned by pg_field_type_oid(). Up to some extreme cases, within a given database, the same OID |
73 | 73 | * will always refer to the same data type. |
74 | 74 | */ |
75 | - $name = pg_field_name($this->handler, $i); |
|
76 | - if ($name === false || $name === null) { // NOTE: besides false, pg_field_name() might return NULL on error |
|
77 | - throw new ResultException("Error retrieving name of result column $i."); |
|
78 | - } |
|
79 | - if ($name == '?column?') { |
|
80 | - $name = null; |
|
81 | - } |
|
82 | - $typeOid = pg_field_type_oid($this->handler, $i); |
|
83 | - if ($typeOid === false || $typeOid === null) { // NOTE: besides false, pg_field_type_oid() might return NULL on error |
|
84 | - throw new ResultException("Error retrieving type OID of result column $i."); |
|
85 | - } |
|
86 | - $type = $this->typeDictionary->requireTypeByOid($typeOid); |
|
87 | - |
|
88 | - $this->columns[] = new Column($this, $i, $name, $type); |
|
89 | - |
|
90 | - if ($name !== null && !isset($this->colNameMap[$name])) { |
|
91 | - $this->colNameMap[$name] = $i; |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - $this->populated = true; |
|
96 | - } |
|
97 | - |
|
98 | - public function flush() |
|
99 | - { |
|
100 | - $this->populated = false; |
|
101 | - $this->populate(); // re-initialize the internal data right away for the other methods not to call populate() over and over again |
|
102 | - } |
|
103 | - |
|
104 | - //endregion |
|
105 | - |
|
106 | - //region IRelation |
|
107 | - |
|
108 | - public function getColumns() |
|
109 | - { |
|
110 | - return $this->columns; |
|
111 | - } |
|
112 | - |
|
113 | - public function filter($decider) |
|
114 | - { |
|
115 | - return new FilteredRelation($this, $decider); |
|
116 | - } |
|
117 | - |
|
118 | - public function project($columns) |
|
119 | - { |
|
120 | - return new ProjectedRelation($this, $columns); |
|
121 | - } |
|
122 | - |
|
123 | - public function rename($renamePairs) |
|
124 | - { |
|
125 | - return new RenamedRelation($this, $renamePairs); |
|
126 | - } |
|
127 | - |
|
128 | - public function col($offsetOrNameOrEvaluator) |
|
129 | - { |
|
130 | - return $this->_colImpl($offsetOrNameOrEvaluator, $this->columns, $this->colNameMap, $this); |
|
131 | - } |
|
132 | - |
|
133 | - public function uniq($hasher = null, $comparator = null) |
|
134 | - { |
|
135 | - throw new NotImplementedException(); |
|
136 | - } |
|
137 | - |
|
138 | - public function tuple($offset = 0) |
|
139 | - { |
|
140 | - if ($offset >= $this->numRows || $offset < -$this->numRows) { |
|
141 | - throw new \OutOfBoundsException("Offset $offset is out of the result bounds [0,{$this->numRows})"); |
|
142 | - } |
|
143 | - |
|
144 | - $effectiveOffset = ($offset >= 0 ? $offset : $this->numRows + $offset); |
|
145 | - |
|
146 | - $rawData = pg_fetch_row($this->handler, $effectiveOffset); |
|
147 | - if ($rawData === false || $rawData === null) { |
|
148 | - throw new ResultException("Error fetching row at offset $offset"); |
|
149 | - } |
|
150 | - |
|
151 | - $data = []; |
|
152 | - foreach ($this->columns as $i => $col) { |
|
153 | - $data[$i] = $col->getType()->parseValue($rawData[$i]); |
|
154 | - } |
|
155 | - |
|
156 | - return new Tuple($data, $this->columns, $this->colNameMap); |
|
157 | - } |
|
158 | - |
|
159 | - //endregion |
|
160 | - |
|
161 | - //region \Countable |
|
162 | - |
|
163 | - public function count() |
|
164 | - { |
|
165 | - return $this->numRows; |
|
166 | - } |
|
167 | - |
|
168 | - //endregion |
|
169 | - |
|
170 | - //region \IteratorAggregate |
|
171 | - |
|
172 | - public function getIterator() |
|
173 | - { |
|
174 | - return new RelationSeekableIterator($this); |
|
175 | - } |
|
176 | - |
|
177 | - //endregion |
|
75 | + $name = pg_field_name($this->handler, $i); |
|
76 | + if ($name === false || $name === null) { // NOTE: besides false, pg_field_name() might return NULL on error |
|
77 | + throw new ResultException("Error retrieving name of result column $i."); |
|
78 | + } |
|
79 | + if ($name == '?column?') { |
|
80 | + $name = null; |
|
81 | + } |
|
82 | + $typeOid = pg_field_type_oid($this->handler, $i); |
|
83 | + if ($typeOid === false || $typeOid === null) { // NOTE: besides false, pg_field_type_oid() might return NULL on error |
|
84 | + throw new ResultException("Error retrieving type OID of result column $i."); |
|
85 | + } |
|
86 | + $type = $this->typeDictionary->requireTypeByOid($typeOid); |
|
87 | + |
|
88 | + $this->columns[] = new Column($this, $i, $name, $type); |
|
89 | + |
|
90 | + if ($name !== null && !isset($this->colNameMap[$name])) { |
|
91 | + $this->colNameMap[$name] = $i; |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + $this->populated = true; |
|
96 | + } |
|
97 | + |
|
98 | + public function flush() |
|
99 | + { |
|
100 | + $this->populated = false; |
|
101 | + $this->populate(); // re-initialize the internal data right away for the other methods not to call populate() over and over again |
|
102 | + } |
|
103 | + |
|
104 | + //endregion |
|
105 | + |
|
106 | + //region IRelation |
|
107 | + |
|
108 | + public function getColumns() |
|
109 | + { |
|
110 | + return $this->columns; |
|
111 | + } |
|
112 | + |
|
113 | + public function filter($decider) |
|
114 | + { |
|
115 | + return new FilteredRelation($this, $decider); |
|
116 | + } |
|
117 | + |
|
118 | + public function project($columns) |
|
119 | + { |
|
120 | + return new ProjectedRelation($this, $columns); |
|
121 | + } |
|
122 | + |
|
123 | + public function rename($renamePairs) |
|
124 | + { |
|
125 | + return new RenamedRelation($this, $renamePairs); |
|
126 | + } |
|
127 | + |
|
128 | + public function col($offsetOrNameOrEvaluator) |
|
129 | + { |
|
130 | + return $this->_colImpl($offsetOrNameOrEvaluator, $this->columns, $this->colNameMap, $this); |
|
131 | + } |
|
132 | + |
|
133 | + public function uniq($hasher = null, $comparator = null) |
|
134 | + { |
|
135 | + throw new NotImplementedException(); |
|
136 | + } |
|
137 | + |
|
138 | + public function tuple($offset = 0) |
|
139 | + { |
|
140 | + if ($offset >= $this->numRows || $offset < -$this->numRows) { |
|
141 | + throw new \OutOfBoundsException("Offset $offset is out of the result bounds [0,{$this->numRows})"); |
|
142 | + } |
|
143 | + |
|
144 | + $effectiveOffset = ($offset >= 0 ? $offset : $this->numRows + $offset); |
|
145 | + |
|
146 | + $rawData = pg_fetch_row($this->handler, $effectiveOffset); |
|
147 | + if ($rawData === false || $rawData === null) { |
|
148 | + throw new ResultException("Error fetching row at offset $offset"); |
|
149 | + } |
|
150 | + |
|
151 | + $data = []; |
|
152 | + foreach ($this->columns as $i => $col) { |
|
153 | + $data[$i] = $col->getType()->parseValue($rawData[$i]); |
|
154 | + } |
|
155 | + |
|
156 | + return new Tuple($data, $this->columns, $this->colNameMap); |
|
157 | + } |
|
158 | + |
|
159 | + //endregion |
|
160 | + |
|
161 | + //region \Countable |
|
162 | + |
|
163 | + public function count() |
|
164 | + { |
|
165 | + return $this->numRows; |
|
166 | + } |
|
167 | + |
|
168 | + //endregion |
|
169 | + |
|
170 | + //region \IteratorAggregate |
|
171 | + |
|
172 | + public function getIterator() |
|
173 | + { |
|
174 | + return new RelationSeekableIterator($this); |
|
175 | + } |
|
176 | + |
|
177 | + //endregion |
|
178 | 178 | } |
@@ -45,8 +45,7 @@ |
||
45 | 45 | $numRows = pg_num_rows($this->handler); |
46 | 46 | if ($numRows >= 0 && $numRows !== null) { // NOTE: besides -1, pg_num_rows() might return NULL on error |
47 | 47 | return $numRows; |
48 | - } |
|
49 | - else { |
|
48 | + } else { |
|
50 | 49 | throw new ResultException('Error retrieving number of rows of the result.'); |
51 | 50 | } |
52 | 51 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | |
4 | 4 | class CommandResult extends Result implements ICommandResult |
5 | 5 | { |
6 | - public function __construct($resultHandler, $lastNotice = null) |
|
7 | - { |
|
8 | - parent::__construct($resultHandler, $lastNotice); |
|
9 | - } |
|
6 | + public function __construct($resultHandler, $lastNotice = null) |
|
7 | + { |
|
8 | + parent::__construct($resultHandler, $lastNotice); |
|
9 | + } |
|
10 | 10 | |
11 | - public function getAffectedRows() |
|
12 | - { |
|
13 | - // TODO: Implement getAffectedRows() method. |
|
14 | - } |
|
11 | + public function getAffectedRows() |
|
12 | + { |
|
13 | + // TODO: Implement getAffectedRows() method. |
|
14 | + } |
|
15 | 15 | } |
@@ -9,50 +9,50 @@ |
||
9 | 9 | */ |
10 | 10 | class SqlStateClass |
11 | 11 | { |
12 | - const SUCCESSFUL_COMPLETION = '00'; |
|
13 | - const WARNING = '01'; |
|
14 | - /** No Data (this is also a warning class per the SQL standard) */ |
|
15 | - const NO_DATA = '02'; |
|
16 | - const SQL_STATEMENT_NOT_YET_COMPLETE = '03'; |
|
17 | - const CONNECTION_EXCEPTION = '08'; |
|
18 | - const TRIGGERED_ACTION_EXCEPTION = '09'; |
|
19 | - const FEATURE_NOT_SUPPORTED = '0A'; |
|
20 | - const INVALID_TRANSACTION_INITIATION = '0B'; |
|
21 | - const LOCATOR_EXCEPTION = '0F'; |
|
22 | - const INVALID_GRANTOR = '0L'; |
|
23 | - const INVALID_ROLE_SPECIFICATION = '0P'; |
|
24 | - const DIAGNOSTICS_EXCEPTION = '0Z'; |
|
25 | - const CASE_NOT_FOUND = '20'; |
|
26 | - const CARDINALITY_VIOLATION = '21'; |
|
27 | - const DATA_EXCEPTION = '22'; |
|
28 | - const INTEGRITY_CONSTRAINT_VIOLATION = '23'; |
|
29 | - const INVALID_CURSOR_STATE = '24'; |
|
30 | - const INVALID_TRANSACTION_STATE = '25'; |
|
31 | - const INVALID_SQL_STATEMENT_NAME = '26'; |
|
32 | - const TRIGGERED_DATA_CHANGE_VIOLATION = '27'; |
|
33 | - const INVALID_AUTHORIZATION_SPECIFICATION = '28'; |
|
34 | - const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST = '2B'; |
|
35 | - const INVALID_TRANSACTION_TERMINATION = '2D'; |
|
36 | - const SQL_ROUTINE_EXCEPTION = '2F'; |
|
37 | - const INVALID_CURSOR_NAME = '34'; |
|
38 | - const EXTERNAL_ROUTINE_EXCEPTION = '38'; |
|
39 | - const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION = '39'; |
|
40 | - const SAVEPOINT_EXCEPTION = '3B'; |
|
41 | - const INVALID_CATALOG_NAME = '3D'; |
|
42 | - const INVALID_SCHEMA_NAME = '3F'; |
|
43 | - const TRANSACTION_ROLLBACK = '40'; |
|
44 | - const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42'; |
|
45 | - const WITH_CHECK_OPTION_VIOLATION = '44'; |
|
46 | - const INSUFFICIENT_RESOURCES = '53'; |
|
47 | - const PROGRAM_LIMIT_EXCEEDED = '54'; |
|
48 | - const OBJECT_NOT_IN_PREREQUISITE_STATE = '55'; |
|
49 | - const OPERATOR_INTERVENTION = '57'; |
|
50 | - /* System Error (errors external to PostgreSQL itself) */ |
|
51 | - const SYSTEM_ERROR = '58'; |
|
52 | - const CONFIG_FILE_ERROR = 'F0'; |
|
53 | - /* Foreign Data Wrapper Error (SQL/MED) */ |
|
54 | - const FDW_ERROR = 'HV'; |
|
55 | - /* PL/pgSQL Error */ |
|
56 | - const PLPGSQL_ERROR = 'P0'; |
|
57 | - const INTERNAL_ERROR = 'XX'; |
|
12 | + const SUCCESSFUL_COMPLETION = '00'; |
|
13 | + const WARNING = '01'; |
|
14 | + /** No Data (this is also a warning class per the SQL standard) */ |
|
15 | + const NO_DATA = '02'; |
|
16 | + const SQL_STATEMENT_NOT_YET_COMPLETE = '03'; |
|
17 | + const CONNECTION_EXCEPTION = '08'; |
|
18 | + const TRIGGERED_ACTION_EXCEPTION = '09'; |
|
19 | + const FEATURE_NOT_SUPPORTED = '0A'; |
|
20 | + const INVALID_TRANSACTION_INITIATION = '0B'; |
|
21 | + const LOCATOR_EXCEPTION = '0F'; |
|
22 | + const INVALID_GRANTOR = '0L'; |
|
23 | + const INVALID_ROLE_SPECIFICATION = '0P'; |
|
24 | + const DIAGNOSTICS_EXCEPTION = '0Z'; |
|
25 | + const CASE_NOT_FOUND = '20'; |
|
26 | + const CARDINALITY_VIOLATION = '21'; |
|
27 | + const DATA_EXCEPTION = '22'; |
|
28 | + const INTEGRITY_CONSTRAINT_VIOLATION = '23'; |
|
29 | + const INVALID_CURSOR_STATE = '24'; |
|
30 | + const INVALID_TRANSACTION_STATE = '25'; |
|
31 | + const INVALID_SQL_STATEMENT_NAME = '26'; |
|
32 | + const TRIGGERED_DATA_CHANGE_VIOLATION = '27'; |
|
33 | + const INVALID_AUTHORIZATION_SPECIFICATION = '28'; |
|
34 | + const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST = '2B'; |
|
35 | + const INVALID_TRANSACTION_TERMINATION = '2D'; |
|
36 | + const SQL_ROUTINE_EXCEPTION = '2F'; |
|
37 | + const INVALID_CURSOR_NAME = '34'; |
|
38 | + const EXTERNAL_ROUTINE_EXCEPTION = '38'; |
|
39 | + const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION = '39'; |
|
40 | + const SAVEPOINT_EXCEPTION = '3B'; |
|
41 | + const INVALID_CATALOG_NAME = '3D'; |
|
42 | + const INVALID_SCHEMA_NAME = '3F'; |
|
43 | + const TRANSACTION_ROLLBACK = '40'; |
|
44 | + const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42'; |
|
45 | + const WITH_CHECK_OPTION_VIOLATION = '44'; |
|
46 | + const INSUFFICIENT_RESOURCES = '53'; |
|
47 | + const PROGRAM_LIMIT_EXCEEDED = '54'; |
|
48 | + const OBJECT_NOT_IN_PREREQUISITE_STATE = '55'; |
|
49 | + const OPERATOR_INTERVENTION = '57'; |
|
50 | + /* System Error (errors external to PostgreSQL itself) */ |
|
51 | + const SYSTEM_ERROR = '58'; |
|
52 | + const CONFIG_FILE_ERROR = 'F0'; |
|
53 | + /* Foreign Data Wrapper Error (SQL/MED) */ |
|
54 | + const FDW_ERROR = 'HV'; |
|
55 | + /* PL/pgSQL Error */ |
|
56 | + const PLPGSQL_ERROR = 'P0'; |
|
57 | + const INTERNAL_ERROR = 'XX'; |
|
58 | 58 | } |
@@ -6,18 +6,18 @@ |
||
6 | 6 | */ |
7 | 7 | interface ICommandResult extends IResult |
8 | 8 | { |
9 | - /** |
|
10 | - * Returns the number of rows affected by the command, if relevant. |
|
11 | - * |
|
12 | - * The affected rows count is relevant for the following commands: |
|
13 | - * - `INSERT`: number of inserted rows; |
|
14 | - * - `UPDATE`: number of updated rows; |
|
15 | - * - `DELETE`: number of deleted rows; |
|
16 | - * - `CREATE TABLE AS`: number of rows inserted right away to the created table; |
|
17 | - * - `MOVE`: number of rows the cursor's position has been changed by; |
|
18 | - * - `COPY`: number of rows copied. |
|
19 | - * |
|
20 | - * @return int|null number of rows affected by the command, or <tt>null</tt> if irrelevant for the command |
|
21 | - */ |
|
22 | - function getAffectedRows(); |
|
9 | + /** |
|
10 | + * Returns the number of rows affected by the command, if relevant. |
|
11 | + * |
|
12 | + * The affected rows count is relevant for the following commands: |
|
13 | + * - `INSERT`: number of inserted rows; |
|
14 | + * - `UPDATE`: number of updated rows; |
|
15 | + * - `DELETE`: number of deleted rows; |
|
16 | + * - `CREATE TABLE AS`: number of rows inserted right away to the created table; |
|
17 | + * - `MOVE`: number of rows the cursor's position has been changed by; |
|
18 | + * - `COPY`: number of rows copied. |
|
19 | + * |
|
20 | + * @return int|null number of rows affected by the command, or <tt>null</tt> if irrelevant for the command |
|
21 | + */ |
|
22 | + function getAffectedRows(); |
|
23 | 23 | } |
@@ -9,269 +9,269 @@ |
||
9 | 9 | */ |
10 | 10 | class SqlState |
11 | 11 | { |
12 | - const SUCCESSFUL_COMPLETION = '00000'; |
|
13 | - const WARNING = '01000'; |
|
14 | - const NULL_VALUE_ELIMINATED_IN_SET_FUNCTION = '01003'; |
|
15 | - const STRING_DATA_RIGHT_TRUNCATION_WARNING = '01004'; |
|
16 | - const PRIVILEGE_NOT_REVOKED = '01006'; |
|
17 | - const PRIVILEGE_NOT_GRANTED = '01007'; |
|
18 | - const IMPLICIT_ZERO_BIT_PADDING = '01008'; |
|
19 | - const DYNAMIC_RESULT_SETS_RETURNED = '0100C'; |
|
20 | - const DEPRECATED_FEATURE = '01P01'; |
|
21 | - const NO_DATA = '02000'; |
|
22 | - const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED = '02001'; |
|
23 | - const SQL_STATEMENT_NOT_YET_COMPLETE = '03000'; |
|
24 | - const CONNECTION_EXCEPTION = '08000'; |
|
25 | - const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION = '08001'; |
|
26 | - const CONNECTION_DOES_NOT_EXIST = '08003'; |
|
27 | - const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION = '08004'; |
|
28 | - const CONNECTION_FAILURE = '08006'; |
|
29 | - const TRANSACTION_RESOLUTION_UNKNOWN = '08007'; |
|
30 | - const PROTOCOL_VIOLATION = '08P01'; |
|
31 | - const TRIGGERED_ACTION_EXCEPTION = '09000'; |
|
32 | - const FEATURE_NOT_SUPPORTED = '0A000'; |
|
33 | - const INVALID_TRANSACTION_INITIATION = '0B000'; |
|
34 | - const LOCATOR_EXCEPTION = '0F000'; |
|
35 | - const INVALID_LOCATOR_SPECIFICATION = '0F001'; |
|
36 | - const INVALID_GRANTOR = '0L000'; |
|
37 | - const INVALID_GRANT_OPERATION = '0LP01'; |
|
38 | - const INVALID_ROLE_SPECIFICATION = '0P000'; |
|
39 | - const DIAGNOSTICS_EXCEPTION = '0Z000'; |
|
40 | - const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER = '0Z002'; |
|
41 | - const CASE_NOT_FOUND = '20000'; |
|
42 | - const CARDINALITY_VIOLATION = '21000'; |
|
43 | - const DATA_EXCEPTION = '22000'; |
|
44 | - const STRING_DATA_RIGHT_TRUNCATION_EXCEPTION = '22001'; |
|
45 | - const NULL_VALUE_NO_INDICATOR_PARAMETER = '22002'; |
|
46 | - const NUMERIC_VALUE_OUT_OF_RANGE = '22003'; |
|
47 | - const NULL_VALUE_NOT_ALLOWED = '22004'; |
|
48 | - const ERROR_IN_ASSIGNMENT = '22005'; |
|
49 | - const INVALID_DATETIME_FORMAT = '22007'; |
|
50 | - const DATETIME_FIELD_OVERFLOW = '22008'; |
|
51 | - const INVALID_TIME_ZONE_DISPLACEMENT_VALUE = '22009'; |
|
52 | - const ESCAPE_CHARACTER_CONFLICT = '2200B'; |
|
53 | - const INVALID_USE_OF_ESCAPE_CHARACTER = '2200C'; |
|
54 | - const INVALID_ESCAPE_OCTET = '2200D'; |
|
55 | - const ZERO_LENGTH_CHARACTER_STRING = '2200F'; |
|
56 | - const MOST_SPECIFIC_TYPE_MISMATCH = '2200G'; |
|
57 | - const NOT_AN_XML_DOCUMENT = '2200L'; |
|
58 | - const INVALID_XML_DOCUMENT = '2200M'; |
|
59 | - const INVALID_XML_CONTENT = '2200N'; |
|
60 | - const INVALID_XML_COMMENT = '2200S'; |
|
61 | - const INVALID_XML_PROCESSING_INSTRUCTION = '2200T'; |
|
62 | - const INVALID_INDICATOR_PARAMETER_VALUE = '22010'; |
|
63 | - const SUBSTRING_ERROR = '22011'; |
|
64 | - const DIVISION_BY_ZERO = '22012'; |
|
65 | - const INVALID_ARGUMENT_FOR_NTILE_FUNCTION = '22014'; |
|
66 | - const INTERVAL_FIELD_OVERFLOW = '22015'; |
|
67 | - const INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION = '22016'; |
|
68 | - const INVALID_CHARACTER_VALUE_FOR_CAST = '22018'; |
|
69 | - const INVALID_ESCAPE_CHARACTER = '22019'; |
|
70 | - const INVALID_REGULAR_EXPRESSION = '2201B'; |
|
71 | - const INVALID_ARGUMENT_FOR_LOGARITHM = '2201E'; |
|
72 | - const INVALID_ARGUMENT_FOR_POWER_FUNCTION = '2201F'; |
|
73 | - const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION = '2201G'; |
|
74 | - const INVALID_ROW_COUNT_IN_LIMIT_CLAUSE = '2201W'; |
|
75 | - const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE = '2201X'; |
|
76 | - const CHARACTER_NOT_IN_REPERTOIRE = '22021'; |
|
77 | - const INDICATOR_OVERFLOW = '22022'; |
|
78 | - const INVALID_PARAMETER_VALUE = '22023'; |
|
79 | - const UNTERMINATED_C_STRING = '22024'; |
|
80 | - const INVALID_ESCAPE_SEQUENCE = '22025'; |
|
81 | - const STRING_DATA_LENGTH_MISMATCH = '22026'; |
|
82 | - const TRIM_ERROR = '22027'; |
|
83 | - const ARRAY_SUBSCRIPT_ERROR = '2202E'; |
|
84 | - const FLOATING_POINT_EXCEPTION = '22P01'; |
|
85 | - const INVALID_TEXT_REPRESENTATION = '22P02'; |
|
86 | - const INVALID_BINARY_REPRESENTATION = '22P03'; |
|
87 | - const BAD_COPY_FILE_FORMAT = '22P04'; |
|
88 | - const UNTRANSLATABLE_CHARACTER = '22P05'; |
|
89 | - const NONSTANDARD_USE_OF_ESCAPE_CHARACTER = '22P06'; |
|
90 | - const INTEGRITY_CONSTRAINT_VIOLATION = '23000'; |
|
91 | - const RESTRICT_VIOLATION = '23001'; |
|
92 | - const NOT_NULL_VIOLATION = '23502'; |
|
93 | - const FOREIGN_KEY_VIOLATION = '23503'; |
|
94 | - const UNIQUE_VIOLATION = '23505'; |
|
95 | - const CHECK_VIOLATION = '23514'; |
|
96 | - const EXCLUSION_VIOLATION = '23P01'; |
|
97 | - const INVALID_CURSOR_STATE = '24000'; |
|
98 | - const INVALID_TRANSACTION_STATE = '25000'; |
|
99 | - const ACTIVE_SQL_TRANSACTION = '25001'; |
|
100 | - const BRANCH_TRANSACTION_ALREADY_ACTIVE = '25002'; |
|
101 | - const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION = '25003'; |
|
102 | - const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION = '25004'; |
|
103 | - const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION = '25005'; |
|
104 | - const READ_ONLY_SQL_TRANSACTION = '25006'; |
|
105 | - const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED = '25007'; |
|
106 | - const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL = '25008'; |
|
107 | - const NO_ACTIVE_SQL_TRANSACTION = '25P01'; |
|
108 | - const IN_FAILED_SQL_TRANSACTION = '25P02'; |
|
109 | - const INVALID_SQL_STATEMENT_NAME = '26000'; |
|
110 | - const TRIGGERED_DATA_CHANGE_VIOLATION = '27000'; |
|
111 | - const INVALID_AUTHORIZATION_SPECIFICATION = '28000'; |
|
112 | - const INVALID_PASSWORD = '28P01'; |
|
113 | - const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST = '2B000'; |
|
114 | - const DEPENDENT_OBJECTS_STILL_EXIST = '2BP01'; |
|
115 | - const INVALID_TRANSACTION_TERMINATION = '2D000'; |
|
116 | - const SQL_ROUTINE_EXCEPTION = '2F000'; |
|
117 | - const MODIFYING_SQL_DATA_NOT_PERMITTED_BY_SQL_ROUTINE = '2F002'; |
|
118 | - const PROHIBITED_SQL_STATEMENT_ATTEMPTED_BY_SQL_ROUTINE = '2F003'; |
|
119 | - const READING_SQL_DATA_NOT_PERMITTED_BY_SQL_ROUTINE = '2F004'; |
|
120 | - const FUNCTION_EXECUTED_NO_RETURN_STATEMENT = '2F005'; |
|
121 | - const INVALID_CURSOR_NAME = '34000'; |
|
122 | - const EXTERNAL_ROUTINE_EXCEPTION = '38000'; |
|
123 | - const CONTAINING_SQL_NOT_PERMITTED = '38001'; |
|
124 | - const MODIFYING_SQL_DATA_NOT_PERMITTED_BY_EXTERNAL_ROUTINE = '38002'; |
|
125 | - const PROHIBITED_SQL_STATEMENT_ATTEMPTED_BY_EXTERNAL_ROUTINE = '38003'; |
|
126 | - const READING_SQL_DATA_NOT_PERMITTED_BY_EXTERNAL_ROUTINE = '38004'; |
|
127 | - const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION = '39000'; |
|
128 | - const INVALID_SQLSTATE_RETURNED = '39001'; |
|
129 | - const NULL_VALUE_NOT_ALLOWED_IN_EXTERNAL_ROUTINE = '39004'; |
|
130 | - const TRIGGER_PROTOCOL_VIOLATED = '39P01'; |
|
131 | - const SRF_PROTOCOL_VIOLATED = '39P02'; |
|
132 | - const SAVEPOINT_EXCEPTION = '3B000'; |
|
133 | - const INVALID_SAVEPOINT_SPECIFICATION = '3B001'; |
|
134 | - const INVALID_CATALOG_NAME = '3D000'; |
|
135 | - const INVALID_SCHEMA_NAME = '3F000'; |
|
136 | - const TRANSACTION_ROLLBACK = '40000'; |
|
137 | - const SERIALIZATION_FAILURE = '40001'; |
|
138 | - const TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION = '40002'; |
|
139 | - const STATEMENT_COMPLETION_UNKNOWN = '40003'; |
|
140 | - const DEADLOCK_DETECTED = '40P01'; |
|
141 | - const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42000'; |
|
142 | - const INSUFFICIENT_PRIVILEGE = '42501'; |
|
143 | - const SYNTAX_ERROR = '42601'; |
|
144 | - const INVALID_NAME = '42602'; |
|
145 | - const INVALID_COLUMN_DEFINITION = '42611'; |
|
146 | - const NAME_TOO_LONG = '42622'; |
|
147 | - const DUPLICATE_COLUMN = '42701'; |
|
148 | - const AMBIGUOUS_COLUMN = '42702'; |
|
149 | - const UNDEFINED_COLUMN = '42703'; |
|
150 | - const UNDEFINED_OBJECT = '42704'; |
|
151 | - const DUPLICATE_OBJECT = '42710'; |
|
152 | - const DUPLICATE_ALIAS = '42712'; |
|
153 | - const DUPLICATE_FUNCTION = '42723'; |
|
154 | - const AMBIGUOUS_FUNCTION = '42725'; |
|
155 | - const GROUPING_ERROR = '42803'; |
|
156 | - const DATATYPE_MISMATCH = '42804'; |
|
157 | - const WRONG_OBJECT_TYPE = '42809'; |
|
158 | - const INVALID_FOREIGN_KEY = '42830'; |
|
159 | - const CANNOT_COERCE = '42846'; |
|
160 | - const UNDEFINED_FUNCTION = '42883'; |
|
161 | - const RESERVED_NAME = '42939'; |
|
162 | - const UNDEFINED_TABLE = '42P01'; |
|
163 | - const UNDEFINED_PARAMETER = '42P02'; |
|
164 | - const DUPLICATE_CURSOR = '42P03'; |
|
165 | - const DUPLICATE_DATABASE = '42P04'; |
|
166 | - const DUPLICATE_PREPARED_STATEMENT = '42P05'; |
|
167 | - const DUPLICATE_SCHEMA = '42P06'; |
|
168 | - const DUPLICATE_TABLE = '42P07'; |
|
169 | - const AMBIGUOUS_PARAMETER = '42P08'; |
|
170 | - const AMBIGUOUS_ALIAS = '42P09'; |
|
171 | - const INVALID_COLUMN_REFERENCE = '42P10'; |
|
172 | - const INVALID_CURSOR_DEFINITION = '42P11'; |
|
173 | - const INVALID_DATABASE_DEFINITION = '42P12'; |
|
174 | - const INVALID_FUNCTION_DEFINITION = '42P13'; |
|
175 | - const INVALID_PREPARED_STATEMENT_DEFINITION = '42P14'; |
|
176 | - const INVALID_SCHEMA_DEFINITION = '42P15'; |
|
177 | - const INVALID_TABLE_DEFINITION = '42P16'; |
|
178 | - const INVALID_OBJECT_DEFINITION = '42P17'; |
|
179 | - const INDETERMINATE_DATATYPE = '42P18'; |
|
180 | - const INVALID_RECURSION = '42P19'; |
|
181 | - const WINDOWING_ERROR = '42P20'; |
|
182 | - const COLLATION_MISMATCH = '42P21'; |
|
183 | - const INDETERMINATE_COLLATION = '42P22'; |
|
184 | - const WITH_CHECK_OPTION_VIOLATION = '44000'; |
|
185 | - const INSUFFICIENT_RESOURCES = '53000'; |
|
186 | - const DISK_FULL = '53100'; |
|
187 | - const OUT_OF_MEMORY = '53200'; |
|
188 | - const TOO_MANY_CONNECTIONS = '53300'; |
|
189 | - const CONFIGURATION_LIMIT_EXCEEDED = '53400'; |
|
190 | - const PROGRAM_LIMIT_EXCEEDED = '54000'; |
|
191 | - const STATEMENT_TOO_COMPLEX = '54001'; |
|
192 | - const TOO_MANY_COLUMNS = '54011'; |
|
193 | - const TOO_MANY_ARGUMENTS = '54023'; |
|
194 | - const OBJECT_NOT_IN_PREREQUISITE_STATE = '55000'; |
|
195 | - const OBJECT_IN_USE = '55006'; |
|
196 | - const CANT_CHANGE_RUNTIME_PARAM = '55P02'; |
|
197 | - const LOCK_NOT_AVAILABLE = '55P03'; |
|
198 | - const OPERATOR_INTERVENTION = '57000'; |
|
199 | - const QUERY_CANCELED = '57014'; |
|
200 | - const ADMIN_SHUTDOWN = '57P01'; |
|
201 | - const CRASH_SHUTDOWN = '57P02'; |
|
202 | - const CANNOT_CONNECT_NOW = '57P03'; |
|
203 | - const DATABASE_DROPPED = '57P04'; |
|
204 | - const SYSTEM_ERROR = '58000'; |
|
205 | - const IO_ERROR = '58030'; |
|
206 | - const UNDEFINED_FILE = '58P01'; |
|
207 | - const DUPLICATE_FILE = '58P02'; |
|
208 | - const CONFIG_FILE_ERROR = 'F0000'; |
|
209 | - const LOCK_FILE_EXISTS = 'F0001'; |
|
210 | - const FDW_ERROR = 'HV000'; |
|
211 | - const FDW_OUT_OF_MEMORY = 'HV001'; |
|
212 | - const FDW_DYNAMIC_PARAMETER_VALUE_NEEDED = 'HV002'; |
|
213 | - const FDW_INVALID_DATA_TYPE = 'HV004'; |
|
214 | - const FDW_COLUMN_NAME_NOT_FOUND = 'HV005'; |
|
215 | - const FDW_INVALID_DATA_TYPE_DESCRIPTORS = 'HV006'; |
|
216 | - const FDW_INVALID_COLUMN_NAME = 'HV007'; |
|
217 | - const FDW_INVALID_COLUMN_NUMBER = 'HV008'; |
|
218 | - const FDW_INVALID_USE_OF_NULL_POINTER = 'HV009'; |
|
219 | - const FDW_INVALID_STRING_FORMAT = 'HV00A'; |
|
220 | - const FDW_INVALID_HANDLE = 'HV00B'; |
|
221 | - const FDW_INVALID_OPTION_INDEX = 'HV00C'; |
|
222 | - const FDW_INVALID_OPTION_NAME = 'HV00D'; |
|
223 | - const FDW_OPTION_NAME_NOT_FOUND = 'HV00J'; |
|
224 | - const FDW_REPLY_HANDLE = 'HV00K'; |
|
225 | - const FDW_UNABLE_TO_CREATE_EXECUTION = 'HV00L'; |
|
226 | - const FDW_UNABLE_TO_CREATE_REPLY = 'HV00M'; |
|
227 | - const FDW_UNABLE_TO_ESTABLISH_CONNECTION = 'HV00N'; |
|
228 | - const FDW_NO_SCHEMAS = 'HV00P'; |
|
229 | - const FDW_SCHEMA_NOT_FOUND = 'HV00Q'; |
|
230 | - const FDW_TABLE_NOT_FOUND = 'HV00R'; |
|
231 | - const FDW_FUNCTION_SEQUENCE_ERROR = 'HV010'; |
|
232 | - const FDW_TOO_MANY_HANDLES = 'HV014'; |
|
233 | - const FDW_INCONSISTENT_DESCRIPTOR_INFORMATION = 'HV021'; |
|
234 | - const FDW_INVALID_ATTRIBUTE_VALUE = 'HV024'; |
|
235 | - const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH = 'HV090'; |
|
236 | - const FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER = 'HV091'; |
|
237 | - const PLPGSQL_ERROR = 'P0000'; |
|
238 | - const RAISE_EXCEPTION = 'P0001'; |
|
239 | - const NO_DATA_FOUND = 'P0002'; |
|
240 | - const TOO_MANY_ROWS = 'P0003'; |
|
241 | - const INTERNAL_ERROR = 'XX000'; |
|
242 | - const DATA_CORRUPTED = 'XX001'; |
|
243 | - const INDEX_CORRUPTED = 'XX002'; |
|
12 | + const SUCCESSFUL_COMPLETION = '00000'; |
|
13 | + const WARNING = '01000'; |
|
14 | + const NULL_VALUE_ELIMINATED_IN_SET_FUNCTION = '01003'; |
|
15 | + const STRING_DATA_RIGHT_TRUNCATION_WARNING = '01004'; |
|
16 | + const PRIVILEGE_NOT_REVOKED = '01006'; |
|
17 | + const PRIVILEGE_NOT_GRANTED = '01007'; |
|
18 | + const IMPLICIT_ZERO_BIT_PADDING = '01008'; |
|
19 | + const DYNAMIC_RESULT_SETS_RETURNED = '0100C'; |
|
20 | + const DEPRECATED_FEATURE = '01P01'; |
|
21 | + const NO_DATA = '02000'; |
|
22 | + const NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED = '02001'; |
|
23 | + const SQL_STATEMENT_NOT_YET_COMPLETE = '03000'; |
|
24 | + const CONNECTION_EXCEPTION = '08000'; |
|
25 | + const SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION = '08001'; |
|
26 | + const CONNECTION_DOES_NOT_EXIST = '08003'; |
|
27 | + const SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION = '08004'; |
|
28 | + const CONNECTION_FAILURE = '08006'; |
|
29 | + const TRANSACTION_RESOLUTION_UNKNOWN = '08007'; |
|
30 | + const PROTOCOL_VIOLATION = '08P01'; |
|
31 | + const TRIGGERED_ACTION_EXCEPTION = '09000'; |
|
32 | + const FEATURE_NOT_SUPPORTED = '0A000'; |
|
33 | + const INVALID_TRANSACTION_INITIATION = '0B000'; |
|
34 | + const LOCATOR_EXCEPTION = '0F000'; |
|
35 | + const INVALID_LOCATOR_SPECIFICATION = '0F001'; |
|
36 | + const INVALID_GRANTOR = '0L000'; |
|
37 | + const INVALID_GRANT_OPERATION = '0LP01'; |
|
38 | + const INVALID_ROLE_SPECIFICATION = '0P000'; |
|
39 | + const DIAGNOSTICS_EXCEPTION = '0Z000'; |
|
40 | + const STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER = '0Z002'; |
|
41 | + const CASE_NOT_FOUND = '20000'; |
|
42 | + const CARDINALITY_VIOLATION = '21000'; |
|
43 | + const DATA_EXCEPTION = '22000'; |
|
44 | + const STRING_DATA_RIGHT_TRUNCATION_EXCEPTION = '22001'; |
|
45 | + const NULL_VALUE_NO_INDICATOR_PARAMETER = '22002'; |
|
46 | + const NUMERIC_VALUE_OUT_OF_RANGE = '22003'; |
|
47 | + const NULL_VALUE_NOT_ALLOWED = '22004'; |
|
48 | + const ERROR_IN_ASSIGNMENT = '22005'; |
|
49 | + const INVALID_DATETIME_FORMAT = '22007'; |
|
50 | + const DATETIME_FIELD_OVERFLOW = '22008'; |
|
51 | + const INVALID_TIME_ZONE_DISPLACEMENT_VALUE = '22009'; |
|
52 | + const ESCAPE_CHARACTER_CONFLICT = '2200B'; |
|
53 | + const INVALID_USE_OF_ESCAPE_CHARACTER = '2200C'; |
|
54 | + const INVALID_ESCAPE_OCTET = '2200D'; |
|
55 | + const ZERO_LENGTH_CHARACTER_STRING = '2200F'; |
|
56 | + const MOST_SPECIFIC_TYPE_MISMATCH = '2200G'; |
|
57 | + const NOT_AN_XML_DOCUMENT = '2200L'; |
|
58 | + const INVALID_XML_DOCUMENT = '2200M'; |
|
59 | + const INVALID_XML_CONTENT = '2200N'; |
|
60 | + const INVALID_XML_COMMENT = '2200S'; |
|
61 | + const INVALID_XML_PROCESSING_INSTRUCTION = '2200T'; |
|
62 | + const INVALID_INDICATOR_PARAMETER_VALUE = '22010'; |
|
63 | + const SUBSTRING_ERROR = '22011'; |
|
64 | + const DIVISION_BY_ZERO = '22012'; |
|
65 | + const INVALID_ARGUMENT_FOR_NTILE_FUNCTION = '22014'; |
|
66 | + const INTERVAL_FIELD_OVERFLOW = '22015'; |
|
67 | + const INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION = '22016'; |
|
68 | + const INVALID_CHARACTER_VALUE_FOR_CAST = '22018'; |
|
69 | + const INVALID_ESCAPE_CHARACTER = '22019'; |
|
70 | + const INVALID_REGULAR_EXPRESSION = '2201B'; |
|
71 | + const INVALID_ARGUMENT_FOR_LOGARITHM = '2201E'; |
|
72 | + const INVALID_ARGUMENT_FOR_POWER_FUNCTION = '2201F'; |
|
73 | + const INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION = '2201G'; |
|
74 | + const INVALID_ROW_COUNT_IN_LIMIT_CLAUSE = '2201W'; |
|
75 | + const INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE = '2201X'; |
|
76 | + const CHARACTER_NOT_IN_REPERTOIRE = '22021'; |
|
77 | + const INDICATOR_OVERFLOW = '22022'; |
|
78 | + const INVALID_PARAMETER_VALUE = '22023'; |
|
79 | + const UNTERMINATED_C_STRING = '22024'; |
|
80 | + const INVALID_ESCAPE_SEQUENCE = '22025'; |
|
81 | + const STRING_DATA_LENGTH_MISMATCH = '22026'; |
|
82 | + const TRIM_ERROR = '22027'; |
|
83 | + const ARRAY_SUBSCRIPT_ERROR = '2202E'; |
|
84 | + const FLOATING_POINT_EXCEPTION = '22P01'; |
|
85 | + const INVALID_TEXT_REPRESENTATION = '22P02'; |
|
86 | + const INVALID_BINARY_REPRESENTATION = '22P03'; |
|
87 | + const BAD_COPY_FILE_FORMAT = '22P04'; |
|
88 | + const UNTRANSLATABLE_CHARACTER = '22P05'; |
|
89 | + const NONSTANDARD_USE_OF_ESCAPE_CHARACTER = '22P06'; |
|
90 | + const INTEGRITY_CONSTRAINT_VIOLATION = '23000'; |
|
91 | + const RESTRICT_VIOLATION = '23001'; |
|
92 | + const NOT_NULL_VIOLATION = '23502'; |
|
93 | + const FOREIGN_KEY_VIOLATION = '23503'; |
|
94 | + const UNIQUE_VIOLATION = '23505'; |
|
95 | + const CHECK_VIOLATION = '23514'; |
|
96 | + const EXCLUSION_VIOLATION = '23P01'; |
|
97 | + const INVALID_CURSOR_STATE = '24000'; |
|
98 | + const INVALID_TRANSACTION_STATE = '25000'; |
|
99 | + const ACTIVE_SQL_TRANSACTION = '25001'; |
|
100 | + const BRANCH_TRANSACTION_ALREADY_ACTIVE = '25002'; |
|
101 | + const INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION = '25003'; |
|
102 | + const INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION = '25004'; |
|
103 | + const NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION = '25005'; |
|
104 | + const READ_ONLY_SQL_TRANSACTION = '25006'; |
|
105 | + const SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED = '25007'; |
|
106 | + const HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL = '25008'; |
|
107 | + const NO_ACTIVE_SQL_TRANSACTION = '25P01'; |
|
108 | + const IN_FAILED_SQL_TRANSACTION = '25P02'; |
|
109 | + const INVALID_SQL_STATEMENT_NAME = '26000'; |
|
110 | + const TRIGGERED_DATA_CHANGE_VIOLATION = '27000'; |
|
111 | + const INVALID_AUTHORIZATION_SPECIFICATION = '28000'; |
|
112 | + const INVALID_PASSWORD = '28P01'; |
|
113 | + const DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST = '2B000'; |
|
114 | + const DEPENDENT_OBJECTS_STILL_EXIST = '2BP01'; |
|
115 | + const INVALID_TRANSACTION_TERMINATION = '2D000'; |
|
116 | + const SQL_ROUTINE_EXCEPTION = '2F000'; |
|
117 | + const MODIFYING_SQL_DATA_NOT_PERMITTED_BY_SQL_ROUTINE = '2F002'; |
|
118 | + const PROHIBITED_SQL_STATEMENT_ATTEMPTED_BY_SQL_ROUTINE = '2F003'; |
|
119 | + const READING_SQL_DATA_NOT_PERMITTED_BY_SQL_ROUTINE = '2F004'; |
|
120 | + const FUNCTION_EXECUTED_NO_RETURN_STATEMENT = '2F005'; |
|
121 | + const INVALID_CURSOR_NAME = '34000'; |
|
122 | + const EXTERNAL_ROUTINE_EXCEPTION = '38000'; |
|
123 | + const CONTAINING_SQL_NOT_PERMITTED = '38001'; |
|
124 | + const MODIFYING_SQL_DATA_NOT_PERMITTED_BY_EXTERNAL_ROUTINE = '38002'; |
|
125 | + const PROHIBITED_SQL_STATEMENT_ATTEMPTED_BY_EXTERNAL_ROUTINE = '38003'; |
|
126 | + const READING_SQL_DATA_NOT_PERMITTED_BY_EXTERNAL_ROUTINE = '38004'; |
|
127 | + const EXTERNAL_ROUTINE_INVOCATION_EXCEPTION = '39000'; |
|
128 | + const INVALID_SQLSTATE_RETURNED = '39001'; |
|
129 | + const NULL_VALUE_NOT_ALLOWED_IN_EXTERNAL_ROUTINE = '39004'; |
|
130 | + const TRIGGER_PROTOCOL_VIOLATED = '39P01'; |
|
131 | + const SRF_PROTOCOL_VIOLATED = '39P02'; |
|
132 | + const SAVEPOINT_EXCEPTION = '3B000'; |
|
133 | + const INVALID_SAVEPOINT_SPECIFICATION = '3B001'; |
|
134 | + const INVALID_CATALOG_NAME = '3D000'; |
|
135 | + const INVALID_SCHEMA_NAME = '3F000'; |
|
136 | + const TRANSACTION_ROLLBACK = '40000'; |
|
137 | + const SERIALIZATION_FAILURE = '40001'; |
|
138 | + const TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION = '40002'; |
|
139 | + const STATEMENT_COMPLETION_UNKNOWN = '40003'; |
|
140 | + const DEADLOCK_DETECTED = '40P01'; |
|
141 | + const SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION = '42000'; |
|
142 | + const INSUFFICIENT_PRIVILEGE = '42501'; |
|
143 | + const SYNTAX_ERROR = '42601'; |
|
144 | + const INVALID_NAME = '42602'; |
|
145 | + const INVALID_COLUMN_DEFINITION = '42611'; |
|
146 | + const NAME_TOO_LONG = '42622'; |
|
147 | + const DUPLICATE_COLUMN = '42701'; |
|
148 | + const AMBIGUOUS_COLUMN = '42702'; |
|
149 | + const UNDEFINED_COLUMN = '42703'; |
|
150 | + const UNDEFINED_OBJECT = '42704'; |
|
151 | + const DUPLICATE_OBJECT = '42710'; |
|
152 | + const DUPLICATE_ALIAS = '42712'; |
|
153 | + const DUPLICATE_FUNCTION = '42723'; |
|
154 | + const AMBIGUOUS_FUNCTION = '42725'; |
|
155 | + const GROUPING_ERROR = '42803'; |
|
156 | + const DATATYPE_MISMATCH = '42804'; |
|
157 | + const WRONG_OBJECT_TYPE = '42809'; |
|
158 | + const INVALID_FOREIGN_KEY = '42830'; |
|
159 | + const CANNOT_COERCE = '42846'; |
|
160 | + const UNDEFINED_FUNCTION = '42883'; |
|
161 | + const RESERVED_NAME = '42939'; |
|
162 | + const UNDEFINED_TABLE = '42P01'; |
|
163 | + const UNDEFINED_PARAMETER = '42P02'; |
|
164 | + const DUPLICATE_CURSOR = '42P03'; |
|
165 | + const DUPLICATE_DATABASE = '42P04'; |
|
166 | + const DUPLICATE_PREPARED_STATEMENT = '42P05'; |
|
167 | + const DUPLICATE_SCHEMA = '42P06'; |
|
168 | + const DUPLICATE_TABLE = '42P07'; |
|
169 | + const AMBIGUOUS_PARAMETER = '42P08'; |
|
170 | + const AMBIGUOUS_ALIAS = '42P09'; |
|
171 | + const INVALID_COLUMN_REFERENCE = '42P10'; |
|
172 | + const INVALID_CURSOR_DEFINITION = '42P11'; |
|
173 | + const INVALID_DATABASE_DEFINITION = '42P12'; |
|
174 | + const INVALID_FUNCTION_DEFINITION = '42P13'; |
|
175 | + const INVALID_PREPARED_STATEMENT_DEFINITION = '42P14'; |
|
176 | + const INVALID_SCHEMA_DEFINITION = '42P15'; |
|
177 | + const INVALID_TABLE_DEFINITION = '42P16'; |
|
178 | + const INVALID_OBJECT_DEFINITION = '42P17'; |
|
179 | + const INDETERMINATE_DATATYPE = '42P18'; |
|
180 | + const INVALID_RECURSION = '42P19'; |
|
181 | + const WINDOWING_ERROR = '42P20'; |
|
182 | + const COLLATION_MISMATCH = '42P21'; |
|
183 | + const INDETERMINATE_COLLATION = '42P22'; |
|
184 | + const WITH_CHECK_OPTION_VIOLATION = '44000'; |
|
185 | + const INSUFFICIENT_RESOURCES = '53000'; |
|
186 | + const DISK_FULL = '53100'; |
|
187 | + const OUT_OF_MEMORY = '53200'; |
|
188 | + const TOO_MANY_CONNECTIONS = '53300'; |
|
189 | + const CONFIGURATION_LIMIT_EXCEEDED = '53400'; |
|
190 | + const PROGRAM_LIMIT_EXCEEDED = '54000'; |
|
191 | + const STATEMENT_TOO_COMPLEX = '54001'; |
|
192 | + const TOO_MANY_COLUMNS = '54011'; |
|
193 | + const TOO_MANY_ARGUMENTS = '54023'; |
|
194 | + const OBJECT_NOT_IN_PREREQUISITE_STATE = '55000'; |
|
195 | + const OBJECT_IN_USE = '55006'; |
|
196 | + const CANT_CHANGE_RUNTIME_PARAM = '55P02'; |
|
197 | + const LOCK_NOT_AVAILABLE = '55P03'; |
|
198 | + const OPERATOR_INTERVENTION = '57000'; |
|
199 | + const QUERY_CANCELED = '57014'; |
|
200 | + const ADMIN_SHUTDOWN = '57P01'; |
|
201 | + const CRASH_SHUTDOWN = '57P02'; |
|
202 | + const CANNOT_CONNECT_NOW = '57P03'; |
|
203 | + const DATABASE_DROPPED = '57P04'; |
|
204 | + const SYSTEM_ERROR = '58000'; |
|
205 | + const IO_ERROR = '58030'; |
|
206 | + const UNDEFINED_FILE = '58P01'; |
|
207 | + const DUPLICATE_FILE = '58P02'; |
|
208 | + const CONFIG_FILE_ERROR = 'F0000'; |
|
209 | + const LOCK_FILE_EXISTS = 'F0001'; |
|
210 | + const FDW_ERROR = 'HV000'; |
|
211 | + const FDW_OUT_OF_MEMORY = 'HV001'; |
|
212 | + const FDW_DYNAMIC_PARAMETER_VALUE_NEEDED = 'HV002'; |
|
213 | + const FDW_INVALID_DATA_TYPE = 'HV004'; |
|
214 | + const FDW_COLUMN_NAME_NOT_FOUND = 'HV005'; |
|
215 | + const FDW_INVALID_DATA_TYPE_DESCRIPTORS = 'HV006'; |
|
216 | + const FDW_INVALID_COLUMN_NAME = 'HV007'; |
|
217 | + const FDW_INVALID_COLUMN_NUMBER = 'HV008'; |
|
218 | + const FDW_INVALID_USE_OF_NULL_POINTER = 'HV009'; |
|
219 | + const FDW_INVALID_STRING_FORMAT = 'HV00A'; |
|
220 | + const FDW_INVALID_HANDLE = 'HV00B'; |
|
221 | + const FDW_INVALID_OPTION_INDEX = 'HV00C'; |
|
222 | + const FDW_INVALID_OPTION_NAME = 'HV00D'; |
|
223 | + const FDW_OPTION_NAME_NOT_FOUND = 'HV00J'; |
|
224 | + const FDW_REPLY_HANDLE = 'HV00K'; |
|
225 | + const FDW_UNABLE_TO_CREATE_EXECUTION = 'HV00L'; |
|
226 | + const FDW_UNABLE_TO_CREATE_REPLY = 'HV00M'; |
|
227 | + const FDW_UNABLE_TO_ESTABLISH_CONNECTION = 'HV00N'; |
|
228 | + const FDW_NO_SCHEMAS = 'HV00P'; |
|
229 | + const FDW_SCHEMA_NOT_FOUND = 'HV00Q'; |
|
230 | + const FDW_TABLE_NOT_FOUND = 'HV00R'; |
|
231 | + const FDW_FUNCTION_SEQUENCE_ERROR = 'HV010'; |
|
232 | + const FDW_TOO_MANY_HANDLES = 'HV014'; |
|
233 | + const FDW_INCONSISTENT_DESCRIPTOR_INFORMATION = 'HV021'; |
|
234 | + const FDW_INVALID_ATTRIBUTE_VALUE = 'HV024'; |
|
235 | + const FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH = 'HV090'; |
|
236 | + const FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER = 'HV091'; |
|
237 | + const PLPGSQL_ERROR = 'P0000'; |
|
238 | + const RAISE_EXCEPTION = 'P0001'; |
|
239 | + const NO_DATA_FOUND = 'P0002'; |
|
240 | + const TOO_MANY_ROWS = 'P0003'; |
|
241 | + const INTERNAL_ERROR = 'XX000'; |
|
242 | + const DATA_CORRUPTED = 'XX001'; |
|
243 | + const INDEX_CORRUPTED = 'XX002'; |
|
244 | 244 | |
245 | 245 | |
246 | - private $code; |
|
246 | + private $code; |
|
247 | 247 | |
248 | - /** |
|
249 | - * @param string $code SQL STATE code; one of {@link SqlState} constants |
|
250 | - * @return SqlState |
|
251 | - */ |
|
252 | - public static function fromCode($code) |
|
253 | - { |
|
254 | - return new SqlState($code); |
|
255 | - } |
|
248 | + /** |
|
249 | + * @param string $code SQL STATE code; one of {@link SqlState} constants |
|
250 | + * @return SqlState |
|
251 | + */ |
|
252 | + public static function fromCode($code) |
|
253 | + { |
|
254 | + return new SqlState($code); |
|
255 | + } |
|
256 | 256 | |
257 | - private function __construct($code) |
|
258 | - { |
|
259 | - $this->code = $code; |
|
260 | - } |
|
257 | + private function __construct($code) |
|
258 | + { |
|
259 | + $this->code = $code; |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
263 | - * @return string the SQL STATE code; one of {@link SqlState} constants |
|
264 | - */ |
|
265 | - public function getCode() |
|
266 | - { |
|
267 | - return $this->code; |
|
268 | - } |
|
262 | + /** |
|
263 | + * @return string the SQL STATE code; one of {@link SqlState} constants |
|
264 | + */ |
|
265 | + public function getCode() |
|
266 | + { |
|
267 | + return $this->code; |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * @return string the class of the SQL STATE; one of {@link SqlStateClass} constants |
|
272 | - */ |
|
273 | - public function getClass() |
|
274 | - { |
|
275 | - return substr($this->code, 0, 2); |
|
276 | - } |
|
270 | + /** |
|
271 | + * @return string the class of the SQL STATE; one of {@link SqlStateClass} constants |
|
272 | + */ |
|
273 | + public function getClass() |
|
274 | + { |
|
275 | + return substr($this->code, 0, 2); |
|
276 | + } |
|
277 | 277 | } |
@@ -5,21 +5,21 @@ |
||
5 | 5 | |
6 | 6 | class CopyOutResult extends Result implements ICopyOutResult |
7 | 7 | { |
8 | - private $connHandler; |
|
8 | + private $connHandler; |
|
9 | 9 | |
10 | - public function __construct($connHandler, $resultHandler, $lastNotice = null) |
|
11 | - { |
|
12 | - parent::__construct($resultHandler, $lastNotice); |
|
10 | + public function __construct($connHandler, $resultHandler, $lastNotice = null) |
|
11 | + { |
|
12 | + parent::__construct($resultHandler, $lastNotice); |
|
13 | 13 | |
14 | - $this->connHandler = $connHandler; |
|
15 | - } |
|
14 | + $this->connHandler = $connHandler; |
|
15 | + } |
|
16 | 16 | |
17 | - public function end() |
|
18 | - { |
|
19 | - $res = pg_end_copy($this->connHandler); |
|
20 | - if ($res === false) { |
|
21 | - throw new ConnectionException('Error ending copying data from the database server.'); |
|
22 | - // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
23 | - } |
|
24 | - } |
|
17 | + public function end() |
|
18 | + { |
|
19 | + $res = pg_end_copy($this->connHandler); |
|
20 | + if ($res === false) { |
|
21 | + throw new ConnectionException('Error ending copying data from the database server.'); |
|
22 | + // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
23 | + } |
|
24 | + } |
|
25 | 25 | } |
@@ -6,32 +6,32 @@ |
||
6 | 6 | */ |
7 | 7 | interface IResult |
8 | 8 | { |
9 | - /** |
|
10 | - * Returns the last notice emitted for this result. |
|
11 | - * |
|
12 | - * Note some notices might be swallowed - see the notes below. A notice is returned by this method only if it is |
|
13 | - * sure it was emitted for this result. |
|
14 | - * |
|
15 | - * Unfortunately, on PHP 5.6, it seems the PostgreSQL client library is pretty limited: |
|
16 | - * - there is no other way of getting notices of successful statements than using pg_last_notice() (except |
|
17 | - * pg_trace(), which would write the frontend/backend communication to a file - then, the file would have to be |
|
18 | - * read and truncated, which would result in quite some overhead); |
|
19 | - * - yet, it only reports the last notice - thus, none but the last notice of a single successful statement can be |
|
20 | - * caught by any means; |
|
21 | - * - there is no clearing mechanism, thus, successful statement emitting the same notice as the previous statement |
|
22 | - * is indistinguishable from a statement emitting nothing; moreover, statements with no notice do not clear the |
|
23 | - * notice returned by pg_last_notice(); last but not least, it is connection-wide, thus, notion of last received |
|
24 | - * notice must be kept on the whole connection, and a notice found out by get_last_notice() should only be |
|
25 | - * reported if different from the last one. |
|
26 | - * |
|
27 | - * @return string|null notice emitted for this result, or <tt>null</tt> if no notice was emitted or it was |
|
28 | - * indistinguishable from previous notices |
|
29 | - */ |
|
30 | - function getLastNotice(); |
|
9 | + /** |
|
10 | + * Returns the last notice emitted for this result. |
|
11 | + * |
|
12 | + * Note some notices might be swallowed - see the notes below. A notice is returned by this method only if it is |
|
13 | + * sure it was emitted for this result. |
|
14 | + * |
|
15 | + * Unfortunately, on PHP 5.6, it seems the PostgreSQL client library is pretty limited: |
|
16 | + * - there is no other way of getting notices of successful statements than using pg_last_notice() (except |
|
17 | + * pg_trace(), which would write the frontend/backend communication to a file - then, the file would have to be |
|
18 | + * read and truncated, which would result in quite some overhead); |
|
19 | + * - yet, it only reports the last notice - thus, none but the last notice of a single successful statement can be |
|
20 | + * caught by any means; |
|
21 | + * - there is no clearing mechanism, thus, successful statement emitting the same notice as the previous statement |
|
22 | + * is indistinguishable from a statement emitting nothing; moreover, statements with no notice do not clear the |
|
23 | + * notice returned by pg_last_notice(); last but not least, it is connection-wide, thus, notion of last received |
|
24 | + * notice must be kept on the whole connection, and a notice found out by get_last_notice() should only be |
|
25 | + * reported if different from the last one. |
|
26 | + * |
|
27 | + * @return string|null notice emitted for this result, or <tt>null</tt> if no notice was emitted or it was |
|
28 | + * indistinguishable from previous notices |
|
29 | + */ |
|
30 | + function getLastNotice(); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @return string the command tag, e.g., <tt>SELECT 2</tt> or <tt>CREATE FUNCTION</tt> |
|
34 | - * @see http://www.postgresql.org/docs/9.4/static/protocol-message-formats.html |
|
35 | - */ |
|
36 | - function getCommandTag(); |
|
32 | + /** |
|
33 | + * @return string the command tag, e.g., <tt>SELECT 2</tt> or <tt>CREATE FUNCTION</tt> |
|
34 | + * @see http://www.postgresql.org/docs/9.4/static/protocol-message-formats.html |
|
35 | + */ |
|
36 | + function getCommandTag(); |
|
37 | 37 | } |
@@ -5,32 +5,32 @@ |
||
5 | 5 | |
6 | 6 | class CopyInResult extends Result implements ICopyInResult |
7 | 7 | { |
8 | - private $connHandler; |
|
8 | + private $connHandler; |
|
9 | 9 | |
10 | - public function __construct($connHandler, $resultHandler, $lastNotice = null) |
|
11 | - { |
|
12 | - parent::__construct($resultHandler, $lastNotice); |
|
10 | + public function __construct($connHandler, $resultHandler, $lastNotice = null) |
|
11 | + { |
|
12 | + parent::__construct($resultHandler, $lastNotice); |
|
13 | 13 | |
14 | - $this->connHandler = $connHandler; |
|
15 | - } |
|
14 | + $this->connHandler = $connHandler; |
|
15 | + } |
|
16 | 16 | |
17 | - public function putLine($line) |
|
18 | - { |
|
19 | - $res = pg_put_line($this->connHandler, $line); |
|
20 | - if ($res === false) { |
|
21 | - throw new ConnectionException('Error sending data to the database server.'); |
|
22 | - // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
23 | - } |
|
24 | - } |
|
17 | + public function putLine($line) |
|
18 | + { |
|
19 | + $res = pg_put_line($this->connHandler, $line); |
|
20 | + if ($res === false) { |
|
21 | + throw new ConnectionException('Error sending data to the database server.'); |
|
22 | + // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
23 | + } |
|
24 | + } |
|
25 | 25 | |
26 | - public function end() |
|
27 | - { |
|
28 | - $this->putLine("\\.\n"); |
|
26 | + public function end() |
|
27 | + { |
|
28 | + $this->putLine("\\.\n"); |
|
29 | 29 | |
30 | - $res = pg_end_copy($this->connHandler); |
|
31 | - if ($res === false) { |
|
32 | - throw new ConnectionException('Error ending copying data to the database server.'); |
|
33 | - // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
34 | - } |
|
35 | - } |
|
30 | + $res = pg_end_copy($this->connHandler); |
|
31 | + if ($res === false) { |
|
32 | + throw new ConnectionException('Error ending copying data to the database server.'); |
|
33 | + // TODO: try to squeeze the client to get some useful information; maybe trap errors issued by pg_end_copy()? |
|
34 | + } |
|
35 | + } |
|
36 | 36 | } |