PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.6
Kubio AI Page Builder v2.8.6
2.9.0 2.8.6 2.8.5 2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / vendor / symfony / var-dumper / Caster / PgSqlCaster.php
kubio / vendor / symfony / var-dumper / Caster Last commit date
AmqpCaster.php 1 year ago ArgsStub.php 1 year ago Caster.php 1 year ago ClassStub.php 1 year ago ConstStub.php 4 years ago CutArrayStub.php 4 years ago CutStub.php 4 years ago DOMCaster.php 1 year ago DateCaster.php 1 year ago DoctrineCaster.php 1 year ago DsCaster.php 1 year ago DsPairStub.php 4 years ago EnumStub.php 4 years ago ExceptionCaster.php 1 year ago FiberCaster.php 1 year ago FrameStub.php 4 years ago GmpCaster.php 1 year ago ImagineCaster.php 4 years ago ImgStub.php 1 year ago IntlCaster.php 1 year ago LinkStub.php 1 year ago MemcachedCaster.php 1 year ago MysqliCaster.php 1 year ago PdoCaster.php 1 year ago PgSqlCaster.php 1 year ago ProxyManagerCaster.php 1 year ago RdKafkaCaster.php 1 year ago RedisCaster.php 1 year ago ReflectionCaster.php 1 year ago ResourceCaster.php 1 year ago SplCaster.php 1 year ago StubCaster.php 1 year ago SymfonyCaster.php 1 year ago TraceStub.php 1 year ago UuidCaster.php 4 years ago XmlReaderCaster.php 1 year ago XmlResourceCaster.php 1 year ago
PgSqlCaster.php
157 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\VarDumper\Caster;
13
14 use Symfony\Component\VarDumper\Cloner\Stub;
15
16 /**
17 * Casts pqsql resources to array representation.
18 *
19 * @author Nicolas Grekas <p@tchwork.com>
20 *
21 * @final
22 */
23 class PgSqlCaster
24 {
25 private const PARAM_CODES = [
26 'server_encoding',
27 'client_encoding',
28 'is_superuser',
29 'session_authorization',
30 'DateStyle',
31 'TimeZone',
32 'IntervalStyle',
33 'integer_datetimes',
34 'application_name',
35 'standard_conforming_strings',
36 ];
37
38 private const TRANSACTION_STATUS = [
39 \PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
40 \PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
41 \PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
42 \PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
43 \PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
44 ];
45
46 private const RESULT_STATUS = [
47 \PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
48 \PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
49 \PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
50 \PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
51 \PGSQL_COPY_IN => 'PGSQL_COPY_IN',
52 \PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
53 \PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
54 \PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
55 ];
56
57 private const DIAG_CODES = [
58 'severity' => \PGSQL_DIAG_SEVERITY,
59 'sqlstate' => \PGSQL_DIAG_SQLSTATE,
60 'message' => \PGSQL_DIAG_MESSAGE_PRIMARY,
61 'detail' => \PGSQL_DIAG_MESSAGE_DETAIL,
62 'hint' => \PGSQL_DIAG_MESSAGE_HINT,
63 'statement position' => \PGSQL_DIAG_STATEMENT_POSITION,
64 'internal position' => \PGSQL_DIAG_INTERNAL_POSITION,
65 'internal query' => \PGSQL_DIAG_INTERNAL_QUERY,
66 'context' => \PGSQL_DIAG_CONTEXT,
67 'file' => \PGSQL_DIAG_SOURCE_FILE,
68 'line' => \PGSQL_DIAG_SOURCE_LINE,
69 'function' => \PGSQL_DIAG_SOURCE_FUNCTION,
70 ];
71
72 public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested)
73 {
74 $a['seek position'] = pg_lo_tell($lo);
75
76 return $a;
77 }
78
79 public static function castLink($link, array $a, Stub $stub, bool $isNested)
80 {
81 $a['status'] = pg_connection_status($link);
82 $a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
83 $a['busy'] = pg_connection_busy($link);
84
85 $a['transaction'] = pg_transaction_status($link);
86 if (isset(self::TRANSACTION_STATUS[$a['transaction']])) {
87 $a['transaction'] = new ConstStub(self::TRANSACTION_STATUS[$a['transaction']], $a['transaction']);
88 }
89
90 $a['pid'] = pg_get_pid($link);
91 $a['last error'] = pg_last_error($link);
92 $a['last notice'] = pg_last_notice($link);
93 $a['host'] = pg_host($link);
94 $a['port'] = pg_port($link);
95 $a['dbname'] = pg_dbname($link);
96 $a['options'] = pg_options($link);
97 $a['version'] = pg_version($link);
98
99 foreach (self::PARAM_CODES as $v) {
100 if (false !== $s = pg_parameter_status($link, $v)) {
101 $a['param'][$v] = $s;
102 }
103 }
104
105 $a['param']['client_encoding'] = pg_client_encoding($link);
106 $a['param'] = new EnumStub($a['param']);
107
108 return $a;
109 }
110
111 public static function castResult($result, array $a, Stub $stub, bool $isNested)
112 {
113 $a['num rows'] = pg_num_rows($result);
114 $a['status'] = pg_result_status($result);
115 if (isset(self::RESULT_STATUS[$a['status']])) {
116 $a['status'] = new ConstStub(self::RESULT_STATUS[$a['status']], $a['status']);
117 }
118 $a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING);
119
120 if (-1 === $a['num rows']) {
121 foreach (self::DIAG_CODES as $k => $v) {
122 $a['error'][$k] = pg_result_error_field($result, $v);
123 }
124 }
125
126 $a['affected rows'] = pg_affected_rows($result);
127 $a['last OID'] = pg_last_oid($result);
128
129 $fields = pg_num_fields($result);
130
131 for ($i = 0; $i < $fields; ++$i) {
132 $field = [
133 'name' => pg_field_name($result, $i),
134 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
135 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
136 'nullable' => (bool) pg_field_is_null($result, $i),
137 'storage' => pg_field_size($result, $i).' bytes',
138 'display' => pg_field_prtlen($result, $i).' chars',
139 ];
140 if (' (OID: )' === $field['table']) {
141 $field['table'] = null;
142 }
143 if ('-1 bytes' === $field['storage']) {
144 $field['storage'] = 'variable size';
145 } elseif ('1 bytes' === $field['storage']) {
146 $field['storage'] = '1 byte';
147 }
148 if ('1 chars' === $field['display']) {
149 $field['display'] = '1 char';
150 }
151 $a['fields'][] = new EnumStub($field);
152 }
153
154 return $a;
155 }
156 }
157