comparison vendor/symfony/var-dumper/Caster/PgSqlCaster.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
18 * 18 *
19 * @author Nicolas Grekas <p@tchwork.com> 19 * @author Nicolas Grekas <p@tchwork.com>
20 */ 20 */
21 class PgSqlCaster 21 class PgSqlCaster
22 { 22 {
23 private static $paramCodes = array( 23 private static $paramCodes = [
24 'server_encoding', 24 'server_encoding',
25 'client_encoding', 25 'client_encoding',
26 'is_superuser', 26 'is_superuser',
27 'session_authorization', 27 'session_authorization',
28 'DateStyle', 28 'DateStyle',
29 'TimeZone', 29 'TimeZone',
30 'IntervalStyle', 30 'IntervalStyle',
31 'integer_datetimes', 31 'integer_datetimes',
32 'application_name', 32 'application_name',
33 'standard_conforming_strings', 33 'standard_conforming_strings',
34 ); 34 ];
35 35
36 private static $transactionStatus = array( 36 private static $transactionStatus = [
37 PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE', 37 PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
38 PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE', 38 PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
39 PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS', 39 PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
40 PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR', 40 PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
41 PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN', 41 PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
42 ); 42 ];
43 43
44 private static $resultStatus = array( 44 private static $resultStatus = [
45 PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY', 45 PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
46 PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK', 46 PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
47 PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK', 47 PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
48 PGSQL_COPY_OUT => 'PGSQL_COPY_OUT', 48 PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
49 PGSQL_COPY_IN => 'PGSQL_COPY_IN', 49 PGSQL_COPY_IN => 'PGSQL_COPY_IN',
50 PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE', 50 PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
51 PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR', 51 PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
52 PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR', 52 PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
53 ); 53 ];
54 54
55 private static $diagCodes = array( 55 private static $diagCodes = [
56 'severity' => PGSQL_DIAG_SEVERITY, 56 'severity' => PGSQL_DIAG_SEVERITY,
57 'sqlstate' => PGSQL_DIAG_SQLSTATE, 57 'sqlstate' => PGSQL_DIAG_SQLSTATE,
58 'message' => PGSQL_DIAG_MESSAGE_PRIMARY, 58 'message' => PGSQL_DIAG_MESSAGE_PRIMARY,
59 'detail' => PGSQL_DIAG_MESSAGE_DETAIL, 59 'detail' => PGSQL_DIAG_MESSAGE_DETAIL,
60 'hint' => PGSQL_DIAG_MESSAGE_HINT, 60 'hint' => PGSQL_DIAG_MESSAGE_HINT,
63 'internal query' => PGSQL_DIAG_INTERNAL_QUERY, 63 'internal query' => PGSQL_DIAG_INTERNAL_QUERY,
64 'context' => PGSQL_DIAG_CONTEXT, 64 'context' => PGSQL_DIAG_CONTEXT,
65 'file' => PGSQL_DIAG_SOURCE_FILE, 65 'file' => PGSQL_DIAG_SOURCE_FILE,
66 'line' => PGSQL_DIAG_SOURCE_LINE, 66 'line' => PGSQL_DIAG_SOURCE_LINE,
67 'function' => PGSQL_DIAG_SOURCE_FUNCTION, 67 'function' => PGSQL_DIAG_SOURCE_FUNCTION,
68 ); 68 ];
69 69
70 public static function castLargeObject($lo, array $a, Stub $stub, $isNested) 70 public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
71 { 71 {
72 $a['seek position'] = pg_lo_tell($lo); 72 $a['seek position'] = pg_lo_tell($lo);
73 73
125 $a['last OID'] = pg_last_oid($result); 125 $a['last OID'] = pg_last_oid($result);
126 126
127 $fields = pg_num_fields($result); 127 $fields = pg_num_fields($result);
128 128
129 for ($i = 0; $i < $fields; ++$i) { 129 for ($i = 0; $i < $fields; ++$i) {
130 $field = array( 130 $field = [
131 'name' => pg_field_name($result, $i), 131 'name' => pg_field_name($result, $i),
132 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)), 132 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
133 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)), 133 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
134 'nullable' => (bool) pg_field_is_null($result, $i), 134 'nullable' => (bool) pg_field_is_null($result, $i),
135 'storage' => pg_field_size($result, $i).' bytes', 135 'storage' => pg_field_size($result, $i).' bytes',
136 'display' => pg_field_prtlen($result, $i).' chars', 136 'display' => pg_field_prtlen($result, $i).' chars',
137 ); 137 ];
138 if (' (OID: )' === $field['table']) { 138 if (' (OID: )' === $field['table']) {
139 $field['table'] = null; 139 $field['table'] = null;
140 } 140 }
141 if ('-1 bytes' === $field['storage']) { 141 if ('-1 bytes' === $field['storage']) {
142 $field['storage'] = 'variable size'; 142 $field['storage'] = 'variable size';