21
21
abstract class BasePdoQueryReflector implements QueryReflector, RecordingReflector
22
22
{
23
23
private const PSQL_SYNTAX_ERROR = '42601 ' ;
24
+
24
25
private const PSQL_INVALID_TEXT_REPRESENTATION = '22P02 ' ;
26
+
25
27
private const PSQL_UNDEFINED_COLUMN = '42703 ' ;
28
+
26
29
private const PSQL_UNDEFINED_TABLE = '42P01 ' ;
27
30
28
31
private const MYSQL_SYNTAX_ERROR_CODE = '42000 ' ;
32
+
29
33
private const MYSQL_UNKNOWN_COLUMN_IN_FIELDLIST = '42S22 ' ;
34
+
30
35
private const MYSQL_UNKNOWN_TABLE = '42S02 ' ;
31
36
32
37
private const PDO_SYNTAX_ERROR_CODES = [
@@ -62,6 +67,7 @@ abstract class BasePdoQueryReflector implements QueryReflector, RecordingReflect
62
67
* @phpstan-ignore-next-line
63
68
*/
64
69
protected $ stmt = null ;
70
+
65
71
/**
66
72
* @var array<string, array<string, list<string>>>
67
73
*/
@@ -82,7 +88,7 @@ public function validateQueryString(string $queryString): ?Error
82
88
{
83
89
$ result = $ this ->simulateQuery ($ queryString );
84
90
85
- if (!$ result instanceof PDOException) {
91
+ if (! $ result instanceof PDOException) {
86
92
return null ;
87
93
}
88
94
@@ -108,7 +114,7 @@ public function getResultType(string $queryString, int $fetchType): ?Type
108
114
{
109
115
$ result = $ this ->simulateQuery ($ queryString );
110
116
111
- if (!\is_array ($ result )) {
117
+ if (! \is_array ($ result )) {
112
118
return null ;
113
119
}
114
120
@@ -157,7 +163,7 @@ protected function emulateFlags(string $nativeType, string $tableName, string $c
157
163
// determine flags of all columns of the given table once
158
164
$ schemaFlags = $ this ->checkInformationSchema ($ tableName );
159
165
foreach ($ schemaFlags as $ schemaColumnName => $ flag ) {
160
- if (!\array_key_exists ($ schemaColumnName , $ this ->emulatedFlags [$ tableName ])) {
166
+ if (! \array_key_exists ($ schemaColumnName , $ this ->emulatedFlags [$ tableName ])) {
161
167
$ this ->emulatedFlags [$ tableName ][$ schemaColumnName ] = [];
162
168
}
163
169
$ this ->emulatedFlags [$ tableName ][$ schemaColumnName ][] = $ flag ;
@@ -171,9 +177,13 @@ public function getDatasource()
171
177
return $ this ->pdo ;
172
178
}
173
179
174
- /** @return PDOException|list<ColumnMeta>|null */
180
+ /**
181
+ * @return PDOException|list<ColumnMeta>|null
182
+ */
175
183
abstract protected function simulateQuery (string $ queryString );
176
184
177
- /** @return Iterator<string, TypeMapper::FLAG_*> */
185
+ /**
186
+ * @return Iterator<string, TypeMapper::FLAG_*>
187
+ */
178
188
abstract protected function checkInformationSchema (string $ tableName );
179
189
}
0 commit comments